Application Development and Automation 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: 
Read only

HOW TO SAVE

Former Member
0 Likes
3,601

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).

7 REPLIES 7
Read only

Former Member
0 Likes
2,270

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.

Read only

Former Member
0 Likes
2,270

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

Read only

Former Member
0 Likes
2,270

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.

Read only

Former Member
0 Likes
2,270

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

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,270

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?

Read only

0 Likes
2,270

Look at <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCSTUP/BCCSTUP_PT.pdf">Updates in the R/3 System (BC-CST-UP)</a>

Regards

Read only

Former Member
0 Likes
2,270

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 ......