2007 Jun 06 12:54 PM
IF WE ARE USING SCREEN PROGRAMMING AND WE GIVE SOME DATA IN SCREEN , THEN HOW CAN WE SAVE THE GIVEN DATA ON SCREEN TO A DATABASE TABLE.
(LOGIC IN MAIN PROGRAM TO SAVE THE DATA ON SCREEN TO A DB TABLE).
2007 Jun 06 12:57 PM
it should some user command.
if you save button.
case sy-ucomm.
when 'SAVE' . " Save Function code
modify db table from table int_table
endcase.
2007 Jun 06 12:57 PM
HI,
U can save the database table using update statement.
When user clicks on save button after providing the inputs in screen.
regards
Suresh.D
2007 Jun 06 12:57 PM
hi jaya,
u have to use either Insert, modify command to save the data in the database.
for that u have to use the insert or modify pushbutton in the screen and write the codes for the same in PAI.
Regards...
Arun.
Reward points if useful.
2007 Jun 06 2:28 PM
Kishore,
- In screen programing, we need to write logic in Process after input (PAI Event) for storing/validating the fields on the screen to Custom/Data base table.
- Give a system command to save push button like "SAVE". That will be available in sy-ucom sytem field after the save event.
- Write update statement like...
If sy-ucomm eq 'SAVE'.
insert z_itab from itab
endif
All the very best to you ..
Regards,
-Mohan
2007 Jun 06 2:34 PM
You can save data in two ways
Immediate
UPDATE or INSERT database.
Or asynchronous
CALL FUNCTION 'Z_MYTAB_UPDATE' IN UPDATE TASK
and then in both case
COMMIT WORK.
The function module is executer asynchronously (SM13) after COMMIT WORK and release the lock of the transaction (ENQUEUE FM)
First way is easier, and good if few data to update and no calculation, second is longer but the interactive user is free to work on another object immediately?
2007 Jun 06 2:36 PM
2007 Jun 07 6:03 AM
SELECT-OPTIONS : S_NAME FOR ZTABLE-NAME.
Module Input.
CASE SY-UCOMM.
WHEN 'SAVE'.
INSERT ZTABLE.
IF SY-DBCNT <> 0.
MESSAGE I0001(ZTEST) WITH 'RECORDS ADDED'.
WHEN 'DISP'.
SELECT SINGLE * FROM ZTABLE WHERE ZFIELD = ZTABLE-XXXX.
ENDCASE.
Assign points if this helps u ......