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

Hw to insert data into database table using table control

Former Member
0 Likes
378

Hi friends,

Hw to insert data into database table using table control.

Thanks & regards,

Madhu

2 REPLIES 2
Read only

Former Member
0 Likes
342

hi,

in user_command module of PAI, write this on SAVE button..

WHEN 'SAVE' OR 'SV'.

LOOP AT itab_det INTO wa_det.

INSERT INTO zform_track_det VALUES wa_det.

ENDLOOP.

Read only

Former Member
0 Likes
342

to do this in PAI do coding fr save button say take an example of storing data into database table z14_eket with data entered in tablecontrol G_TABCTRL2_ITAB

IF OK_CODE EQ 'SAVE'.

LOOP AT G_TABCTRL2_ITAB INTO G_TABCTRL2_WA.

(here G_TABCTRL2_WA is work area of table control G_TABCTRL2_ITAB )

IF G_TABCTRL2_WA-ETENR IS NOT INITIAL AND G_TABCTRL2_WA-EINDT IS NOT

INITIAL AND G_TABCTRL2_WA-MENGE IS NOT INITIAL.

Z14_EKET-EBELN = Z14_EKKO-EBELN .

Z14_EKET-EBELP = G_TABCTRL2_WA-EBELP.

Z14_EKET-ETENR = G_TABCTRL2_WA-ETENR.

Z14_EKET-EINDT = G_TABCTRL2_WA-EINDT.

Z14_EKET-MENGE = G_TABCTRL2_WA-MENGE.

MODIFY Z14_EKET.

ENDIF.

ENDLOOP.

MESSAGE 'SUCCESSFULLY SAVED ! ' TYPE 'I'.

This way data is saved succesfully into database table z14_eket from corresponding fields entered in table control

try it out..this would surely help

reward if useful

where ok-code=sy-ucomm is declared in top include of module program