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

transferring data from internal table to table control on screen.

Former Member
0 Likes
2,794

Hi abapers,

I am new to module pool programming.

i would like to know how do we transfer the data from our internal table to a table control on a screen.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,149

Hi Aditya,

Please try this code

  • OPTIONAL: If it_zsd00003 hasn't allready been filled with
  • data, you can do it the first time PBO is called
  • Setting the number of lines of the table control
  • Optional: Place the cursor on line g_current_line e.g. after a
  • validation error has occured
  • Optional: Protect some of the columns on the
  • table control
  • Modify an existing entry
  • OR
  • Appending a new entry
Table control : TC1 Internal table : it_zsd00003 In the attributes of the table control, select w/SelColumn to get a selection column on the table control, and give a name (In this example IT_ZSD00003-LINESEL). Remember to include the field IT_ZSD00003-LINESEL in the internal table ( linesel(1) type c, ). When used with an internal table, remember to program the update functionality of the database tables. Update and validation can be done when leaving the screen or in PAI using controlname- current_line (E.g. TC1-current_line ) to indentify the entry in the internal table. process before output. module status_0100. loop at it_zsd00003 with control tc1 cursor tc1- current_line. module tc1_set_field_attr. "Optional endloop. module status_0100 output. set pf-status 'SCREEN0100'. module read_data. describe table it_zsd00003 lines tc1-lines. if not ( g_current_line is initial ). tc1-top_line = g_current_line. clear g_current_line. endif. endmodule. " STATUS_0100 OUTPUT module read_data. if flag is initial. perform read_data. flag = 1. endif. endmodule. module tc1_set_field_attr output. loop at screen. if screen-group1 = 'X'. screen-input = 0. modify screen. endif. endloop. endif. endmodule. " tc1_set_field_attr OUTPUT process after input. loop at it_zsd00003. module modify_tc1. endloop. module user_command_0100. module modify_tc1 input. modify it_zsd00003 index tc1-current_line. append it_zsd00003. endmodule. " modify_tc1 INPUT Deleting a single line selected with the selection column: form delete_record. loop at it_zsd00003. if it_zsd00003-linesel = 'X'. exit. endif. endloop. delete from zsd00003 where zdriftscenter = it_zsd00003-zdriftscenter ................................. endform.

Regards

Krishna

6 REPLIES 6
Read only

Former Member
0 Likes
1,149

Hello,

Create the table control using wizard, there itself you will be asked to give the internal name, database table name etc, so once you populate the table, those will be reflected in the table control.

For more details, kindly viist this site :

http://help.sap.com/saphelp_47x200/helpdata/en/d1/801bdf454211d189710000e8322d00/frameset.htm

Regards,

Mansi.

Read only

Former Member
Read only

Former Member
0 Likes
1,150

Hi Aditya,

Please try this code

  • OPTIONAL: If it_zsd00003 hasn't allready been filled with
  • data, you can do it the first time PBO is called
  • Setting the number of lines of the table control
  • Optional: Place the cursor on line g_current_line e.g. after a
  • validation error has occured
  • Optional: Protect some of the columns on the
  • table control
  • Modify an existing entry
  • OR
  • Appending a new entry
Table control : TC1 Internal table : it_zsd00003 In the attributes of the table control, select w/SelColumn to get a selection column on the table control, and give a name (In this example IT_ZSD00003-LINESEL). Remember to include the field IT_ZSD00003-LINESEL in the internal table ( linesel(1) type c, ). When used with an internal table, remember to program the update functionality of the database tables. Update and validation can be done when leaving the screen or in PAI using controlname- current_line (E.g. TC1-current_line ) to indentify the entry in the internal table. process before output. module status_0100. loop at it_zsd00003 with control tc1 cursor tc1- current_line. module tc1_set_field_attr. "Optional endloop. module status_0100 output. set pf-status 'SCREEN0100'. module read_data. describe table it_zsd00003 lines tc1-lines. if not ( g_current_line is initial ). tc1-top_line = g_current_line. clear g_current_line. endif. endmodule. " STATUS_0100 OUTPUT module read_data. if flag is initial. perform read_data. flag = 1. endif. endmodule. module tc1_set_field_attr output. loop at screen. if screen-group1 = 'X'. screen-input = 0. modify screen. endif. endloop. endif. endmodule. " tc1_set_field_attr OUTPUT process after input. loop at it_zsd00003. module modify_tc1. endloop. module user_command_0100. module modify_tc1 input. modify it_zsd00003 index tc1-current_line. append it_zsd00003. endmodule. " modify_tc1 INPUT Deleting a single line selected with the selection column: form delete_record. loop at it_zsd00003. if it_zsd00003-linesel = 'X'. exit. endif. endloop. delete from zsd00003 where zdriftscenter = it_zsd00003-zdriftscenter ................................. endform.

Regards

Krishna

Read only

Former Member
0 Likes
1,149

Define the table control in the Top include.

IN PBO:

LOOP AT ITAB WITH TABLE CONTOL.

MODULE UPLOAD_DATA.

ENDLOOP.

IN PAI.

LOOP AT ITAB.

Module OPERATIONS.

ENDLOOP.

[Reference Table Control|http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbacac35c111d1829f0000e829fbfe/content.htm]

Regards,

gurpreet

Read only

Former Member
0 Likes
1,149

refer the programs DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

and RSDEMO_TABLE_CONTROL

For Example :

Give the name of fields as the internal table field like

Itab-F1,Itab-f2.

Then in the flow logic.

PBO.

loop at itab with control (Table Control Name).

endloop.

PAI.

LOOP AT ITAB:

ENDLOOP:

This will popularte the data to itab.

Read only

Former Member
0 Likes
1,149

in PBO

Syntax:

LOOP AT <IT TABLE NAME> INTO <WA NAME> WITH CONROL <TABLE CONROL NAME> CURSOR <TABLE CONROL NAME>-CURRENT _LINE.

EG: IT_EKKO INTO WA_EKKO WITH CONROL TBC CURSOR TBC-CURRENT_LINE.