04-22-2009 10:25 AM
Hi Friends ,
i have a requirement , its a report and in that based on the user action ( if the user checks a check box that is available in the output screen of the report and saves it) the value should be updated in a standard table as 'X'. I have appended the field in the standard table and now i need to write a logic at user command to populate the zfield that i have added in the table based on the user's input. Can someone suggest me how to proceed further on this ? Kindly let me know if you have any sample piece of code related to this scenario...
thanks in advance.
04-22-2009 10:31 AM
use event check_changed_data( ) of ALV grid and then update the ztable.
04-22-2009 10:33 AM
04-22-2009 10:33 AM
HI,
Usually we can udpate the tables using UPDATE statement.
But SAP will not suggest to use these statements which will hit the table directly. We need to use the standard transactions to create or update the standard tables.
For eg: you are using a ztable.
then once your report is ready, then use the user_command form ( for ALV) .
fetch the records where the user have selected the records ( check box = 'X").
&----
*& Form USER_COMMAND
&----
FORM user_command USING g_ucomm TYPE sy-ucomm
gs_selfield TYPE slis_selfield .
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ls_ref1.
CALL METHOD ls_ref1->check_changed_data .
this will update the check box values in your internal table.
now you can use
loop at itab into wa where check eq 'X'.
fill your final internal table where you need to update the table.
endloop.
loop at newtable.
update ztable set value = 'X'
where keyfield = w_keyfield.
if sy-subrc eq 0.
message s000.
endif.
endloop.
endform.
regards,
Venkatesh
04-22-2009 10:38 AM
Hello friends ,
This is not an ALV report , it is a classical report.
04-22-2009 10:43 AM
when u check the checkbox in your classical report, does the internal table which you are showing reflects that change or not(of the checkbox tic).
if yes , then when u press the save button Update the Ztable at the sy-ucomm of the save button.
04-22-2009 11:25 AM
Hi,
can you be more clear on the requirement, at what user's input the code at user command should get triggred.
04-24-2009 2:28 PM