Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Standard Table to be updated based on User action

Former Member
0 Kudos

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.

7 REPLIES 7

Former Member
0 Kudos

use event check_changed_data( ) of ALV grid and then update the ztable.

0 Kudos

also implement the handle data changed event in PBO

Former Member
0 Kudos

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

Former Member
0 Kudos

Hello friends ,

This is not an ALV report , it is a classical report.

0 Kudos

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.

Former Member
0 Kudos

Hi,

can you be more clear on the requirement, at what user's input the code at user command should get triggred.

Former Member
0 Kudos

thanks