Is it possible to change the it_outtab, i.e the data of my alv without destroying it?
I know that to change the field catalog it is possible with this method:
CALL METHOD gr_alvpl->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = gt_fldct.
CALL METHOD gr_alvpl->refresh_table_display( ).
But if I have to change the it_outtab parameters, is it possible?
Yes. Use the method REFRESH_TABLE_DISPLAY, as outlined in the documentation.
The ALV Grid keeps a reference to the table you passed to it during initialization. You update the contents of that original table and then tell the Grid to update itself.
Related
How can i retrieve the is_sfparam-content, either using query or function module.
then will be passed as a parameter to cl_recp_data_cn_general=>get_contract.
do you have any idea? Where can I get that is_sfparam-content?
Thanks
CALL METHOD cl_recp_data_cn_general=>get_contract
EXPORTING
id_guid = is_sfparam-content
IMPORTING
es_contract = contract
CHANGING
cf_error = lf_error.
This guid paramater brings no sense as it is generated in runtime. You can check this yourself by putting breakpoint at the first line (e.g. line 102) of method cl_recp_data_cn_general=>get_contract and checking id_guid var in debugger. It will be different with each run of preview in RECN tcode.
Check also line 11 of CONSTRUCTOR method of CL_RECP_SF_DOC class, it is executed during each form generation.
The real contract object lays in variable go_busobj of program SAPLRECA_BDT_APPL_TOOL which brings RECN functionality and it is global i.e. it is loaded into memory constantly while RECN is running, just passing doc object into called methods thru the call stack, which you can follow in debugger.
Where really form generation takes place is CL_RECP_SF_JOB class, for preview it is _FP_PREVIEW method, for print it is _FP_PRINT. For example, in preview method form FM is called in that place
What you need to do if you want to call arbitrary contract print-form, which is what I assume you want to do by asking this question:
Find out smartform FM name by putting breakpoint in the above line
Build parameters for this FM calling. The only obligatory parameter is LS_SFPARAM-CONTENT which is the GUID.
You can generate this GUID manually by creating CL_RECP_SF_DOC object, let it be io_doc var. The constructor of this object has input parameter is_doc which should be filled according to the attributes of contract which you want to print, and which are stored in VIBDRO and VICNCN tables.
After creating this object pass its attribute io_doc->md_guid to ls_sfparam-content, generate other parameters with CL_RECP_SF_JOB->_sf_get_form_param and
Run the smartform FM /1BCDWB/SF000000XX found at step 1 with these parameters
I didn't check all these steps by myself but I believe it should work.
I need to call a function that has a table type as import parameter in a program. I thought about doing this with a selection screen but I can't use deep structures as parameters. When I 'TEST' that function module it shows me a thing where I can add multiple entries and submit everything in the end. Can I get something similar during the execution of a program?
edit: I have to offer a program that calls the function module create_skill_profile.
1
2
3
You can call the function module RS_COMPLEX_OBJECT_EDIT in your report for editing a complex structure. This is the same function module that is used for editing test data in the function module single test.
So, in your report, you could ask for the name of the desired type (if that has to be a dynamic one), and then, in start-of-selection, you can create a data object of this type and pass it to RS_COMPLEX_OBJECT_EDIT to let the user fill it.
A serious limitation of RS_COMPLEX_OBJECT_EDIT is that it can't handle sorted or hashed tables as input. So all the components of your complex structure, if they are of table kind, they have to be standard tables.
What I understand: You want to call a function module that requires a table as import parameter. The table's rows are filled from user input. The number of rows is dynamic.
Approaches:
1) use selection screen with predefined input fields and show/hide them dynamically via PAI (AT SELECTION-SCREEN (on xxx). LOOP AT SCREEN.) then build your table and call your function module on START-OF-SELECTION.
2) show editable ALV grid with table structure. Implement an application toolbar button or use SAVE button to let the user call your function module when he finished inserting his input.
I would defenitely prefer 2), although custom input validation is a bit tricky. But if the required user input is the same as ddic defined table structure the input validation happens automatically.
Before starting development I'm looking for a standard way of doing something like that: I need to implement user-friendly way for ordering table rows in standard Dynpro ALV grid. I think it should look like a form where filter columns are defined, like it implemented, for example, in standard function module LVC_FILTER.
No, there is no standard functionality for this. However you can do this (manual table sort by drag-and-drop) programmatically by inserting/deleting itab rows in runtime. This can be be implemented using standard ALV events: ondrag, ondrop, and ondropcomplete.
Try these code samples for implementing methods:
method handle_grid_ondrag.
data: data_object type ref to drag_drop_object,
help_row like line of gt_outtab. "#EC NEEDED
read table gt_outtab_2 into help_row index es_row_no-row_id.
create object data_object.
move es_row_no-row_id to data_object->index.
read table gt_outtab_2 into data_object->wa_test index
es_row_no-row_id.
e_dragdropobj->object = data_object.
endmethod.
_
method handle_grid_ondrop.
data: data_object type ref to drag_drop_object,
drop_index type i,
help_row like line of gt_outtab. "#EC NEEDED
delete gt_outtab_2 index data_object->index.
insert data_object->wa_test into gt_outtab_2 index e_row-index
endmethod.
_
method handle_grid_ondropcomplete.
if data_cel = ' '.
call method grid->refresh_table_display.
endif.
endmethod.
Refer to sample program BCALV_TEST_DRAG_DROP_02 if you have difficulties.
I want to make the labels of an input field invisible when the input field is invisible.
I cant bind it to the same context because they are build dynamically.
Is there a way to get all view elements so i can loop over them and make the label invisible dynamically?
Here's some example action handler code which finds the label MYLABEL inside a container and hides it. It doesn't completely cover your use case, but I think it will get you started.
data view type ref to cl_wdr_view.
view ?= wd_this->wd_get_api( ).
data container type ref to cl_wd_uielement_container.
container ?= view->root_element.
data children type cl_wd_uielement=>tt_uielement.
children = container->get_children( ).
data element type ref to cl_wd_uielement.
loop at children into element.
data id type string.
id = element->get_id( ).
if id = `MYLABEL`.
element->set_visible( `01` ).
endif.
endloop.
Each view controller contains the method WDDOMODIFYVIEW with an initially empty implementation. Inside this method you have access to the whole UI element hierarcy and should be able to retrieve references to both the label and the input field and hide the lable in case the input field is hidden.
First, write a second program that will be responsible for calling your program using the SUBMIT ABAP instruction with the EXPORTING LIST TO MEMORY addition.
When you run this caller program it will call your program using the SUBIT, but instead of generating output on screen, system will send the output to system memory.
Later, in webdynpro or in any other program, you can call ABAP function LIST_FROM_MEMORY to retrieve your program's earlier output to an internal table.
Cheers!
I am trying to set the toolbar item dynamically. So far I have a back button that resets the toolbar title to 'start' if the user chooses to go back.
But the following code won't work:
menuList.on('itemtap', function(dataView, index, item, e){
viewport.dockedItems.items[0].setTitle('{title}');
});
It tries to use a variable called 'title' out of my data store array. This works great for providing text to my Ext.List items. But the above code sets the toolbar title to the string '{title}' without even thinking of it being a variable.
Can you help me out?
List's use templates so items within curley braces get evaluated... you'll need to pass a reference to a variable without quotes. You haven't provided enough code for me to tell you where that information would be. If you already have a variable in scope called title that you put the data into then you can just reamove the '{ and }' ... otherwise you'll need to get the data you need from your store through some means, like Ext.StoreMgr or [appname].stores
Two things. 1) You will really want to get used to digging into the ST source code. In this case, if you look at the code for "setTitle", you will see that its argument is interpreted as straight HTML, not a template. So you can't use curly bracket syntax here. 2) Note that the type of the "item" argument to the event handler is an Element (i.e. ST's representation of the DOM object, not the selected datastore object. So that's not going to help you. However, the "index" arg gives you an easy way to get the appropriate object from the store. i.e.
[appname].stores.pages.getAt(index).title
I really don't know why, but it works if you put up to variables: One for the record and one for the value inside that record. There is a detailed explanation in the sencha.com-forum