06-12-2012 9:49 AM
Hello everyone,
I am using ALV grid in my program. It collects data from tables. I want to set buttons - Add, Edit and Delete. After selecting a row from ALV grid and clicking 'Edit', data from the table should be copied to In/Out fileds in the other part of the screen. I have to use GUI Status buttons. What's strange for me, when exactly the same code is called after clicking ALV toolbar button or Status GUI button program behaves differently. ALV toolbar works fine and data is copied correctly, but using button 'Edit' or 'Add' from GUI Status Toolbar makes In/Out Fields grey out.
Does anyone have idea of why the program behaves this way and how to solve it?
06-12-2012 10:30 AM
Hello Karol,
In case of ALV toolbar button click, both PAI and PBO get invoked while in case of GUI status button click, only PAI is invoked.
This is the reason of your problem.
Regards,
ManuB
06-12-2012 10:17 AM
Here is a part of code executed after clicking 'Edit' . I am using "DYNP_UPDATE_FIELDS" because otherwise in/out fields are not refreshing correctly..
WHEN '&EDIT&'.
CALL METHOD alv_grid->get_selected_rows
IMPORTING et_index_rows = i_selected_rows.
CASE number1.
WHEN '1101'.
LOOP AT i_selected_rows INTO w_selected_rows.
READ TABLE it_przedm INTO wa_przedm INDEX w_selected_rows-index. "ZMIANA
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa_przedm TO w_modified_przedm. "ZMIANA
* APPEND w_modified TO i_modified.
ENDIF.
ENDLOOP.
PRZEDM_N = w_modified_przedm-PRZEDMIOT.
PRZEDM_S = w_modified_przedm-SKROT.
PRZEDM_ID = w_modified_przedm-ID.
"CLEAR I_DYNPFIELDS.
W_DYNPFIELDS-FIELDNAME = 'PRZEDM_N'. W_DYNPFIELDS-FIELDVALUE = PRZEDM_N.
APPEND W_DYNPFIELDS TO I_DYNPFIELDS.
W_DYNPFIELDS-FIELDNAME = 'PRZEDM_S'. W_DYNPFIELDS-FIELDVALUE = PRZEDM_S. "ZMIANA
APPEND W_DYNPFIELDS TO I_DYNPFIELDS.
(...)
CLEAR W_DYNPFIELDS.
MOVE number1 TO DNMB.
CALL FUNCTION 'DYNP_UPDATE_FIELDS'
EXPORTING
DYNAME = SY-REPID
DYNUMB = number1
TABLES
DYNPFIELDS = I_DYNPFIELDS.
06-12-2012 10:30 AM
Hello Karol,
In case of ALV toolbar button click, both PAI and PBO get invoked while in case of GUI status button click, only PAI is invoked.
This is the reason of your problem.
Regards,
ManuB
06-12-2012 10:35 AM
@Manu: Thank you, but I am not sure this is the case.
Anyway, removing DYNP_UPDATE_FIELDS seems to be solution. Problem solved.