cancel
Showing results for 
Search instead for 
Did you mean: 

Create new line in list uibb

Former Member
0 Kudos

Hi all,

I am trying to create a button in a list uibb, that adds a new line to an existing list. I am doing this in the lean sales order web dynpro application using class CL_LO_OIF_GUIBB_ITEM_LIST. I can get the additional line if i implement an enhancement in the flush and just "piggyback" on an existing change in the context. However if i click my button and try to call the flush method, then my coding isn't working. I tried to trigger a new event loop but then my changes are gone.

I tried to trigger a new event loop that catches the flush method. However my enhancement isn't being caught as there is a return statement that are being executed before this.

As i see it i can modify the class, which i would prefer not to do.

Is there any way to manipulate the context of the web dynpro uibb through an interface or something like that?

I would appreciate any help i can get.

Kind regards Jakob

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Jakob,

We had a similar development to add a line item to the sales order , we added a button to open popup to enter the article and we used following code to add the line item on enter action. Please check if this might work for you ?

DATA: LO_MODEL              TYPE REF TO CL_LO_OIF_MODEL.
DATA: LV_HANDLE TYPE GUID_32,
             LT_OBJINST    
TYPE TDT_OBJINST,
              LS_OBJINST    
TYPE TDS_OBJINST.
* GET THE MODEL
LO_MODEL
= CL_LO_OIF_MODEL=>GET_MODEL( ).

IF LV_MATERIAL IS NOT INITIAL.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
EV_GUID_32
= LV_HANDLE.
LS_OBJINST
-OBJECT_ID = CL_LORD_CO=>SC_OT_ITEM.
LS_OBJINST
-HANDLE    LV_HANDLE.
INSERT LS_OBJINST INTO TABLE LT_OBJINST.
LS_ITEM_COMV
-HANDLE = LV_HANDLE.
LS_ITEM_COMV
-MABNR LV_MATERIAL.
LS_ITEM_COMV
-KWMENG = '1'.
APPEND LS_ITEM_COMV TO LT_ITEM_COMV.
LS_ITEM_COMX
-HANDLE = LV_HANDLE.
LS_ITEM_COMX
-MABNR = 'X'.
LS_ITEM_COMX
-KWMENG = 'X'.
LS_ITEM_COMX
-ZZPACKAGE_PRICE = 'X'.
APPEND LS_ITEM_COMX TO LT_ITEM_COMX.
CALL METHOD LO_MODEL->REGISTER_CHANGES
EXPORTING
IT_OBJINST  
= LT_OBJINST
IT_ITEM_COMV
= LT_ITEM_COMV
IT_ITEM_COMX
= LT_ITEM_COMX.
*   construct fpm event on enter
DATA:     LO_FPM_EVT              TYPE REF TO CL_FPM_EVENT,
LO_FPM                 
TYPE REF TO IF_FPM.
LO_FPM_EVT
= CL_FPM_EVENT=>CREATE_BY_ID( 'FPM_GUIBB_LIST_CELL_ACTION' ).
LO_FPM
= LO_MODEL->GET_FPM_API( ).
LO_FPM
->RAISE_EVENT( LO_FPM_EVT ).
LO_FPM_EVT
= CL_FPM_EVENT=>CREATE_BY_ID( LO_MODEL->C_EVT_ENTER ).
LO_FPM    
= LO_MODEL->GET_FPM_API( ).
LO_FPM
->RAISE_EVENT( LO_FPM_EVT ).
CALL METHOD LO_MODEL->CLOSE_POPUP
EXPORTING
IV_POPUP
= 'XXXXXXX' .
ENDIF.

ulrich_miller
Active Participant
0 Kudos

Hi Jakob,
actually the method flush is not intended to make changes to the data, its only purpose is to receive the changes done by the user and to do with those changes whatever is appropriate. For making changes to the data please use the method get_data.

Kind regards,

Ulrich

Former Member
0 Kudos

Hi Ulrich,

I get that i shouldn't use the flush method. However the get data method doesn't really let me "manipulate" the data context. I am not editing existing data, i want to create basically an empty new line for the user to input the material number and quantity into.

ulrich_miller
Active Participant
0 Kudos

Hi Jakob,
the wd abap context really is internal stuff, manipulating it would be "a bad hack" and such a solution would not be supported officially by SAP. I see two option:

1) Via get_data add a new empty row to ct_data.

2) Use the new FPM List ATS UIBB (wd component fpm_list_uibb_ats). There is a build in feature
    for exactly this use case.

I assume that solution 2) is not an option since you are building on a existing solution.