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

To Transfer data from internal table to a table control

Former Member
0 Likes
1,942

Hi All,

I have selected some data to be displayed on a screen into an internal table ...............my problem is how to transfer the data from the internal table to this table control so that when screen is displayed the data is also displayed.

Regards,

Shweta

Hi All,

I have selected some data to be displayed on a screen into an internal table ...............my problem is how to transfer the data from the internal table to this table control so that when screen is displayed the data is also displayed.

Regards,

Shweta

9 REPLIES 9
Read only

Former Member
0 Likes
1,235

Hi Shweta,

<b>Please see if the below demo program is helpful...

DEMO_DYNPRO_TABCONT_LOOP</b>

==============================

controls flights type tableview using screen 100.

select * from spfli into corresponding fields of table itab.

call screen 100.

module status_0100 output.

set pf-status 'SCREEN_100'.

describe table itab lines fill.

flights-lines = fill.

endmodule.

module fill_table_control output.

read table itab into demo_conn index flights-current_line.

endmodule.

module cancel input.

leave program.

endmodule.

module read_table_control input.

lines = sy-loopc.

modify itab from demo_conn index flights-current_line.

endmodule.

module user_command_0100 input.

save_ok = ok_code.

clear ok_code.

case save_ok.

when 'NEXT_LINE'.

flights-top_line = flights-top_line + 1.

limit = fill - lines + 1.

if flights-top_line > limit.

flights-top_line = limit.

endif.

when 'PREV_LINE'.

flights-top_line = flights-top_line - 1.

if flights-top_line < 0.

flights-top_line = 0.

endif.

when 'NEXT_PAGE'.

flights-top_line = flights-top_line + lines.

limit = fill - lines + 1.

if flights-top_line > limit.

flights-top_line = limit.

endif.

when 'PREV_PAGE'.

flights-top_line = flights-top_line - lines.

if flights-top_line < 0.

flights-top_line = 0.

endif.

when 'LAST_PAGE'.

flights-top_line = fill - lines + 1.

when 'FIRST_PAGE'.

flights-top_line = 0.

endcase.

endmodule.

Thanks, ABY

Read only

Former Member
0 Likes
1,235

Hi

In the PBO you have to move the data of Internal table (ITAB) into the Table control

Table control fields also might be declared with some internal table(ITAB_TC) fields

So yoou can use move-cooresponding ITAB to ITAB_TC in the loop of ITAb in PBO event of that table control screen.

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
1,235

Hi Shweta,

While Designing the Table control select all the fields from the internal table in that program. and write this code in the PBO.

MODULE fill_tc_eine OUTPUT.

CLEAR i_eine.

READ TABLE i_eine INDEX tc_eine-current_line.

ENDMODULE. " fill_tc_eine OUTPUT

Reply if any help needed.

Regards,

Ramana Prasad.

Read only

0 Likes
1,235

hi,

thnks for ur response.

but the problem is that i have defined the table control using the custom table and not using the internal table.

Read only

0 Likes
1,235

Hi,

I think u have to display the fields of the internal table in the table control. so u can define the table control with the fields in the internal table.

Regards,

Ramana Prasad. T

Read only

Former Member
0 Likes
1,235

Hi,

U can use dictionary/program elements button on screen painter layout screen for getting the fields.

Just after pressing that button->select fields u want 2 display->copy->drag it on screen.

Its done.

Please reward points.

Regards,

Ameet

Read only

Former Member
0 Likes
1,235

hi..

TYPES : BEGIN OF d_struct1,

matnr TYPE z8matnr,

mtart TYPE mtart,

meins TYPE meins,

doc TYPE erdat,

maktx TYPE maktx,

END OF d_struct1.

DATA : itab TYPE STANDARD TABLE OF d_struct1 WITH HEADER LINE.

CONTROLS : tab_cntrl TYPE TABLEVIEW USING SCREEN 0101.

<b>PROCESS PBO</b>

MODULE SET_ATTR_TC.

LOOP AT ITAB WITH .....

ENDLOOP.

MODULE SET_ATTR_TC.

loop at itab with control tab_cntrl .

READ TABLE itab1INDEX tab_cntrl-current_line.

endloop.

ENDMODULE.

Read only

Former Member
0 Likes
1,235

hi,

I think u already put the table control logic in flowlogic:

process before output.

loop at itab with control tc.

module status_0100.

endloop.

process after input.

module user_command_0100.

loop at itab.

endloop.

In the PBO use the following statements(internal table toi table control fields i.e. table)

module status_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

move-corresponding itab to ekko.

move-corresponding itab to ekpo.

tc-lines = sy-dbcnt.

endmodule. " STATUS_0100 OUTPUT

for further clarification:

Check out these demo programs

RSDEMO_TABLE_CONTROL

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

Check

http://www.sap-img.com/ab031.htm

through this link

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm

table control scrolling:

Read only

0 Likes
1,235

hi,

i have met with this problem and i have used the follwing procedur.

create a ztable with all the fields u have in ir internal table .after populating all ur data into ur final internal table .

use modify command

ie) MODIFY <Ztable name> from table <internal table name>.

commit work.

after that gotose16 and view the fields in ur ztable .it would have been populated.

hope this will work.