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

data in table control

Former Member
0 Likes
708

Hi all,

I need a small help i want to enter data in table control so that on saving should update in data base table please help with some code.thank you.full points awarded.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
667

Hai Babitha,

Here is a sample code for data control..

PROCESS BEFORE OUTPUT.

MODULE STATUS_0900.

LOOP AT i_data WITH CONTROL TC1_TAB.

CURSOR TC1_TAB-CURRENT_LINE.

MODULE TRANSFER_DATA.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP.

ENDLOOP.

MODULE USER_COMMAND_0900.

*****************

MODULE STATUS_0900 OUTPUT.

perform populate_table.

describe table i_data lines v_lines.

tc1_tab-lines = v_lines.

ENDMODULE. " STATUS_0900 OUTPUT

****************

MODULE TRANSFER_DATA OUTPUT.

    • Module to transfer data into the screen.

ZZSMSTATUS-ZCODE = I_DATA-ZCODE.

ZZSMSTATUS-ZUSER = I_DATA-ZUSER.

ZZSMSTATUS-ZDETAIL = I_DATA-ZDETAIL.

ZZSMSTATUS-ZDATE = I_DATA-ZDATE.

ZZSMSTATUS-ZTIME = I_DATA-ZTIME.

V_LOOPLINES_NB = SY-LOOPC.

ENDMODULE. " TRANSFER_DATA OUTPUT

**********************************

FORM populate_table .

select zcode zuser zdetail zdate ztime from zzsmstatus

into corresponding fields of table i_data

where aufnr = aufk-aufnr.

ENDFORM. " populate_table

Also Just refer this link..

Regards,

Srikanth.

5 REPLIES 5
Read only

Former Member
0 Likes
668

Hai Babitha,

Here is a sample code for data control..

PROCESS BEFORE OUTPUT.

MODULE STATUS_0900.

LOOP AT i_data WITH CONTROL TC1_TAB.

CURSOR TC1_TAB-CURRENT_LINE.

MODULE TRANSFER_DATA.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP.

ENDLOOP.

MODULE USER_COMMAND_0900.

*****************

MODULE STATUS_0900 OUTPUT.

perform populate_table.

describe table i_data lines v_lines.

tc1_tab-lines = v_lines.

ENDMODULE. " STATUS_0900 OUTPUT

****************

MODULE TRANSFER_DATA OUTPUT.

    • Module to transfer data into the screen.

ZZSMSTATUS-ZCODE = I_DATA-ZCODE.

ZZSMSTATUS-ZUSER = I_DATA-ZUSER.

ZZSMSTATUS-ZDETAIL = I_DATA-ZDETAIL.

ZZSMSTATUS-ZDATE = I_DATA-ZDATE.

ZZSMSTATUS-ZTIME = I_DATA-ZTIME.

V_LOOPLINES_NB = SY-LOOPC.

ENDMODULE. " TRANSFER_DATA OUTPUT

**********************************

FORM populate_table .

select zcode zuser zdetail zdate ztime from zzsmstatus

into corresponding fields of table i_data

where aufnr = aufk-aufnr.

ENDFORM. " populate_table

Also Just refer this link..

Regards,

Srikanth.

Read only

Former Member
0 Likes
667

Hi Babita,

Please find the code sample:

From Program : DEMO_DYNPRO_TABCONT_LOOP_AT

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

LOOP AT ITAB INTO DEMO_CONN WITH CONTROL FLIGHTS.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE CANCEL AT EXIT-COMMAND.

LOOP AT ITAB.

module read_table_control.

ENDLOOP.

module user_command_0100.

MODULE read_table_control INPUT.

MODIFY itab FROM demo_conn INDEX flights-current_line.

ENDMODULE.

Hope this will help you

Cheers

Sunny

Rewrd points, if found helpful

Read only

Former Member
0 Likes
667

Have u look at tcode BIBS or otherwise do a search in this forum.

Read only

Former Member
0 Likes
667

Hi Babita,

for me this program is working fine for saving data from table control. I hope it will be useful for you.

In screens,

PROCESS BEFORE OUTPUT.

module BUD3_init.

loop at g_BUD3_itab

into g_BUD3_wa

with control BUD3

cursor BUD3-current_line.

module BUD3_move.

endloop.

PROCESS AFTER INPUT.

loop at g_BUD3_itab.

chain.

field ZUVRATE-MATNR.

field ZUVRATE-VALIDFROMDATE.

field ZUVRATE-VALIDTODATE.

field ZUVRATE-DMBTR.

module BUD3_modify on chain-request.

MODULE ZUVRATE-VALIDFROMDATE_onchange ON CHAIN-REQUEST.

MODULE BUD3_ONCHANGE ON CHAIN-REQUEST.

endchain.

endloop.

module BUD3_user_command.

in report,

module BUD3_move output.

move-corresponding G_BUD3_WA TO ZUVRATE.

endmodule.

MODULE BUD3_USER_COMMAND INPUT.

CASE SY-UCOMM.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'CANCEL' .

LEAVE PROGRAM.

WHEN 'SAVE'.

SELECT SLNO INTO ITAB1-SLNO FROM ZUVRATE.

APPEND ITAB1.

COUNT = ITAB1-SLNO.

CLEAR ITAB1.

ENDSELECT.

LOOP AT G_BUD3_ITAB.

SELECT SINGLE MAKTX INTO VMAKTX FROM MAKT WHERE MATNR EQ

G_BUD3_ITAB-MATNR.

COUNT = COUNT + 1.

MOVE COUNT TO ZUVRATE-SLNO.

MOVE G_BUD3_ITAB-MATNR TO ZUVRATE-MATNR.

MOVE VMAKTX TO ZUVRATE-MAKTX.

MOVE G_BUD3_ITAB-VALIDFROMDATE TO ZUVRATE-VALIDFROMDATE.

MOVE G_BUD3_ITAB-VALIDTODATE TO ZUVRATE-VALIDTODATE.

MOVE G_BUD3_ITAB-DMBTR TO ZUVRATE-DMBTR.

INSERT ZUVRATE.

MESSAGE i123 WITH 'Record Saved Sucessfully'.

CLEAR VMAKTX.

ENDLOOP.

ENDCASE.

endmodule.

module BUD3_modify input.

move-corresponding ZUVRATE to g_BUD3_wa.

modify g_BUD3_itab

from g_BUD3_wa

index BUD3-current_line.

IF SY-SUBRC = 0.

ELSE.

APPEND G_BUD3_WA TO G_BUD3_ITAB.

  • w_cid = w_cid + 1 .

ENDIF.

endmodule.

With Regards,

Neptune.M

Read only

Former Member
0 Likes
667

Hi,

Go to transaction DWDM, expand the node "Control" and check for the node "Table Control".

Regs,

Venkat Ramanan