How to check window state(minimized,maximized etc) in Team developer ? Is there any built in function available for the same ?
You can use SalGetWindowState() function for checking window state.
Function take only one argument which is the handle of the window to be checked.
If SalGetWindowState(windowhandle) = Window_Minimized
Call VisWinShow(windowhandle, SHOW_Normal)
Please Note: VisWinShow() function sets visibility state of a window. Its first argument is the window handle and second argument can be SHOW_Minimized, SHOW_Normal, SHOW_Maximized or SHOW_Hidden.
Using SalGetWindowState(hWndForm) you can check any of the following states:
`Window_Invalid ( Value = 1 )
Window_Maximized ( Value = 3 )
Window_Minimized ( Value = 4 )
Window_Normal ( Value = 5 )
Window_NotVisible ( Value = 2 )`
Of course if you are using Word automation, you can't refer to hWndForm, so in this case use:
Set nState = iWord__Application.PropGetWindowState( )
Other options are:
Set bIsMaximised = VisWinIsMaximized (hWndForm)
Set bIsMinimised = VisWinIsMinimized(hWndForm)
Set bIsNormal = VisWinIsRestored (hWndForm)
Set bIsValid = VisWinIsWindow(hWndForm)
Related
I have a custom dialog dynpro including an input field named DYN_MATNR as listbox for which I have included a list of particular materials as selection.
How can I set a specific material (of that list) as selected when the dialog dynpro is opened?
PBO of dialog dynpro:
data lt_values type vrm_values.
select matnr,
maktx
into table #data(lt_materials)
from makt
where matnr in #so_matnr
and spras = 'D'
order by matnr.
loop at lt_materials assigning field-symbol(<material>).
append initial line to lt_values assigning field-symbol(<value>).
<value>-key = <material>-matnr.
<value>-text = <material>-maktx.
endloop.
call function 'VRM_SET_VALUES'
exporting
id = 'DYN_MATNR'
values = lt_values
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
" ...
endif.
This works and it shows the list of materials as listbox values. To select a particular material I have included the FM DYNP_VALUES_UPDATE afterwards and also in PBO but this did not work:
data lv_stepl type syst-stepl.
call function 'DYNP_GET_STEPL'
importing
povstepl = lv_stepl
exceptions
stepl_not_found = 1
others = 2.
if sy-subrc <> 0.
" ...
endif.
data(lt_dynpfields) = value dynpread_tabtype(
( fieldname = 'DYN_MATNR'
stepl = lv_stepl
fieldvalue = gcl_helper->get_matnr( ) " matnr which should be selected is stored here
fieldinp = space )
).
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-repid
dynumb = sy-dynnr
tables
dynpfields = lt_dynpfields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
if sy-subrc <> 0.
" ...
endif.
I am also not able to directly set DYN_MATNR as it is not available in PBO.
Any hints?
Got it:
You need to additionally define a global(!) variable with the name and (wished) type of the input field (e.g. in the top include of the report or in a separate include of the dynpro logic):
data dyn_matnr type matnr.
Then you can set the initial value of the dynpro field in PBO directly:
dyn_matnr = gcl_helper->get_matnr( ).
As this becomes rather irritating when using various dialog dynpros I recommend including the dynpro number in those variables and input fields.
I try to call a GET_EXPANDED_ENTITYSET method of SRA020_PO_TRACKING Project, po tracking project. The following is the method:
METHOD /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset.
DATA: lv_ponumber TYPE bapiekko-po_number,
lv_leading_msg TYPE boolean.
DATA: lo_api TYPE REF TO cl_sra020_po_tracking_api.
DATA: ls_po_details TYPE cl_sra020_po_tracking_api=>ts_podetails,
lt_return TYPE bapirettab,
lo_msgcontainer TYPE REF TO /iwbep/if_message_container.
DATA: lt_poitem_details TYPE cl_sra020_po_tracking_api=>tt_poitemdetail.
FIELD-SYMBOLS: <fs_return> TYPE bapiret2,
<fs_key_tab> TYPE /iwbep/s_mgw_name_value_pair.
lo_api = cl_sra020_po_tracking_api=>get_instance( ).
*========================================================================================
* Read Entities key values within oData service URL
*========================================================================================
IF it_key_tab IS NOT INITIAL.
LOOP AT it_key_tab ASSIGNING <fs_key_tab>.
CASE <fs_key_tab>-name.
WHEN if_sra020_po_tracking_constant=>cc_po_number.
lv_ponumber = <fs_key_tab>-value.
ENDCASE.
ENDLOOP.
ENDIF.
TRY.
CASE iv_entity_set_name.
WHEN if_sra020_po_tracking_constant=>cc_podetaileddatas.
CALL METHOD lo_api->get_po_details
EXPORTING
iv_item_additional_data = 'X' "#EC NOTEXT
iv_po_number = lv_ponumber
IMPORTING
es_po_details = ls_po_details
et_return = lt_return.
IF NOT lt_return IS INITIAL.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception.
ENDIF.
lt_poitem_details = ls_po_details-poitemdetaildatas.
no_cache( ).
* Return the expanded clauses
APPEND cl_sra020_po_tracking_mpc=>gc_poitemdocflow TO et_expanded_tech_clauses.
APPEND cl_sra020_po_tracking_mpc=>gc_accounting TO et_expanded_tech_clauses.
APPEND cl_sra020_po_tracking_mpc=>gc_pricingconditions TO et_expanded_tech_clauses.
APPEND cl_sra020_po_tracking_mpc=>gc_confirmation TO et_expanded_tech_clauses.
CALL METHOD copy_data_to_ref
EXPORTING
is_data = lt_poitem_details
CHANGING
cr_data = er_entityset.
ENDCASE.
CATCH /iwbep/cx_mgw_busi_exception.
lo_msgcontainer = me->mo_context->get_message_container( ).
LOOP AT lt_return ASSIGNING <fs_return> WHERE type EQ 'E' OR type EQ 'A'. "#EC NOTEXT
IF <fs_return>-id EQ 'SRA020'.
lv_leading_msg = abap_true.
ELSE.
lv_leading_msg = abap_false.
ENDIF.
lo_msgcontainer->add_message(
iv_msg_type = <fs_return>-type
iv_msg_id = <fs_return>-id
iv_msg_number = <fs_return>-number
iv_msg_text = <fs_return>-message
iv_msg_v1 = <fs_return>-message_v1
iv_msg_v2 = <fs_return>-message_v2
iv_msg_v3 = <fs_return>-message_v3
iv_msg_v4 = <fs_return>-message_v4
iv_is_leading_message = lv_leading_msg
).
ENDLOOP.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>business_error
message_container = lo_msgcontainer.
ENDTRY.
ENDMETHOD.
Where
if_sra020_po_tracking_constant=>cc_po_number = PONumber
if_sra020_po_tracking_constant=>cc_podetaileddatas = PODetailedDatas
and PODetailedData entity has navigation properties of POItemDetailDatas,POItems,and POList
I try to call the method from Gateway Service Client by executing
/sap/opu/odata/SAP/SRA020_PO_TRACKING_SRV/PODetailedDatas?$expand=POItemDetailDatas,POItems,POList
However I got status code 400 Bad Request instead. What did I miss?
regards
Edit:
The message in the Bad Request says: Error while reading Purchase Order
edit 2:
association screen shot:
navigation screen shot:
Turns out I have to provide PONumber, so that:
PODetailedDatas(PONumber='4500000039')?$expand=POItems
works fine
I'm tyring to implementing the timingPerformance plugin through Adobe DTM. Everything is configured (at least to my knowledge), but there aren't any events triggering.
Here's a snippet of code that's set up within DTM. Note that I've removed all the respected plugins so that it Isn't such a big post. But the necessary functions have been added.
When I jump to a secondary page to test the values, I would expect to see the listed events and eVar, but this is not the case. All I see is the eVar that is collecting my previous page name value, but no events.
s.pte = 'event110,event111,event112,event113,event114,event115,event116,event117,event118,event119'
//[--------------------------- 1 to 8 ---------------------------][-- 9 --][- 10 -]
s.ptc = false;
/*****Plugin Section*******/
s.usePlugins = true
function s_doPlugins(s) {
_satellite.notify("doPlugins fired:" + document.readyState);
/* Previous Page Name */
s.prop55 = s.eVar77 = s.getPreviousValue(s.pageName, 's_ppn');
/* Percent Page Viewed */
/* Pre-requisite: Previous Page Name */
var ppv = s.getPercentPageViewed(s.pageName); //get array of data on prev page % viewed
if (ppv && typeof ppv == 'object' && ppv[0] == s.prop55) { //if ppv array returned and prev page id matches prev page name
s.prop56 = s.eVar78 = ppv[1] + '|' + ppv[2];
}
/* Time Parting Tracking */
var tp = s.getTimeParting('n', '-7');
s.prop44 = s.eVar55 = tp;
/* Performance Timing */
s.eVar77 = s.getPreviousValue(s.pageName, 'gpv_v77', ''); //Record the previous page name in the designated eVar of your choice
//s.performanceTiming('list2') //List variable if one is neededd
/* Pre-requisite: Previous Page Name */
}
Am I missing something or not calling something correctly?
As indicated in the comments the performance timing plugin uses the s.performanceTiming(); to trigger the actual plugin. With that being said here is how it should be configured in order to properly work.
The s.pte is the call for which determines whether or not to execute the actual plugin.
`s.pte = 'event10,event11,event12,event13,event14,event15,event16,event17,event18,event19'
//[--------------------------- 1 to 8 ---------------------------][-- 9 --][- 10 -]
s.ptc = false;`
Next is to initialize the plugin that is set within the doPlugins section of the s_code.
/* Performance Timing */
s.eVar9 = s.getPreviousValue(s.pageName,'gpv_v9',''); //Record the previous page name in the designated eVar of your choice
s.performanceTiming('')
Note: Adobe Analytics documentation references a "list" option within the s.perfomaceTiming('list2)` call itself. This list is optional and is not required; therefore, removing "list" will work for a standard call.
Can someone help me in creating the below xml structure using ESQL in IIB
Input:
<animal>
<animaldomestic>dog<animaldomestic>
<animalwild>cheetah<animalwild>
</animal>
Output:
<animals>
<animal type="domestic">cow</animal>
<animal type="wild">cheetah</animal>
</animals>
SET OuputRoot.XMLNSC.animals.(XMLNSC.Attribute)animal = 'domestic';
SET OutputRoot.XMLNSC.animals.animal = 'cow';
SET OuputRoot.XMLNSC.animals.(XMLNSC.Attribute)animal = 'wild';
SET OutputRoot.XMLNSC.animals.animal = 'cheetah';
I found solution for this.Please find the below code:
SET OutputRoot.XMLNSC.animals.animal[1].(XMLNSC.Attribute)type = 'domestic';
SET OutputRoot.XMLNSC.animals.animal[1]VALUE = InputRoot.XMLNSC.animal.animaldomestic;
SET OutputRoot.XMLNSC.animals.animal[2].(XMLNSC.Attribute)type = 'wild';
SET OutputRoot.XMLNSC.animals.animal[2]VALUE = InputRoot.XMLNSC.animal.animalwild;
If you want universal code:
DECLARE animal REFERENCE TO InputRoot.XMLNSC.animal.*[>];
DECLARE type CHAR;
DECLARE I INTEGER 1;
WHILE LASTMOVE(animal) DO
SET type = SUBSTRING(FIELDNAME(animal) AFTER 'animal');
SET OutputRoot.XMLNSC.animals.animal[I] = FIELDVALUE(animal);
SET OutputRoot.XMLNSC.animals.animal[I].(XMLNSC.Attribute)type = type;
SET I = I + 1;
SET type = '';
MOVE animal NEXTSIBLING;
END WHILE;
#Egorka_nazarov's solution is the best. A couple of improvements are possible, though:
FOR refAnimals AS InputRoot.XMLNSC.animal.*[];
CREATE LASTCHILD OF OutputRoot.XMLNSC.animals
AS refNewAnimal
TYPE NameValue
NAME 'animal'
VALUE FIELDVALUE(refAnimals);
DECLARE type CHARACTER SUBSTRING(FIELDNAME(refAnimals) AFTER 'animal');
SET refNewAnimal.(XMLNSC.Attribute)type = type;
END FOR;
The above code is shorter and less likely to contain bugs (once you have practiced with REFERENCE variables, obviously).
What am I looking for is a code like that.
local sometable = {
[1] = [2] = "abc",
}
So this is surely a wrong way to set 2 keys. ( returned an error )
You received an error because Lua doesn't have a syntax for setting multiple keys to a single value in a table constructor.
You have a few options, when using tables as arrays (sequences) you can omit the key:
local t = {'abc', 'abc'}
If you don't want to repeat the value, use a variable:
local init = 'abc'
local t = {init, init}
Or, write a function to do the initialization:
local function initialize(t, v, first, last)
first = first or 1
last = last or first
assert(first <= last, 'invalid first/last')
for i = first, last do
t[i] = v
end
return t
end
local t = initialize({}, 'abc', 1, 2)