‎2009 Jan 05 9:48 AM
Hi All,
I have made a screen in module pool. Whenever I enter data on my screen fields and click save button, the data should get saved . I do not have to update any DB table.
Please suggest what more code should be written in PAI:
case sy-ucomm.
when 'SAVE'
....
...
Every useful aswer will be rewarded.
Abhimanyu
‎2009 Jan 05 9:53 AM
Hi Abhimanyu,
Take the names of the input/output fields as work_area-field_name.
Use code, its working:-
In PAI,
PROCESS AFTER INPUT.
MODULE USER_COMMAND_8003.
LOOP WITH CONTROL PO_TB. "po_tb is name of table control
MODULE INSERT_DATA. "to insert data from table control into internal table
ENDLOOP.
*&---------------------------------------------------------------------*
*& Module INSERT_DATA INPUT
*&---------------------------------------------------------------------*
MODULE INSERT_DATA INPUT.
APPEND WA_ZEKPO TO IT_ZEKPO.
"append data from work area fields into internal table on user command
ENDMODULE. " INSERT_DATA INPUT
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2009 Jan 05 9:54 AM
module USER_COMMAND_0100 input.
case sy-ucomm.
when 'DISP'.
select name city salary role from ztable into table it_data
where name = wa_data-name.
read table it_data into wa_data with key name = wa_data-name.
when 'INS'.
WA_DATA-NAME = ztable-NAME.
WA_DATA-city = ztable-city .
WA_DATA-salary = ztable-salary.
WA_DATA-role = ztable-role.
append wa_data to it_data.
clear wa_data.
insert ztable from table it_data.
IF sy-subrc = 0.
MESSAGE 'records created succesfully' TYPE 'S'.
ENDIF.
when 'SAVE'.
modify ztable from ztable.
if sy-subrc = 0.
message 'record updated succesfully' type 'S'.
endif.
Endcase.
endmodule. " USER_COMMAND_0100 INPUT
‎2009 Jan 05 9:59 AM
Hi abhimanyu...
Your screen fields will refer a dictionary structure...and you need to have a work area were ,you can transport the statemnt from screen to work area using FIELD statements .
e,g FIELD (SCREENFIELD NAME)
‎2009 Jan 05 10:02 AM
Hi,
Just pass the values of corresponding screen fields to the table fields in the loop.
Hope it helps!!
let me know if you still not clear!!
Regards,
Pavan
‎2009 Jan 05 12:40 PM
Hi,
When save just insert the internal table row into db table after the validation using INSERT stmt.
Do the insertion into the loop stmt.
I hope this will help u.
Thanks.
‎2009 Jan 05 2:17 PM
HI....
I do not have to update table....
Data should remain on the screen when the screen is opened again.
‎2009 Jan 05 2:26 PM
>
> HI....
>
> I do not have to update table....
>
> Data should remain on the screen when the screen is opened again.
Make the screen fields global and pass the data into it.
‎2010 Aug 24 6:40 PM