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

Table Control - READ

Former Member
0 Likes
1,102

Hi Gurus,

Requirement: I need to read data from a table control and store it in an internal table. From Screen to internal table.

I have declared the internal table of the same structure as that of the Table Control.

I tried a lot, but I am looking for some accurate ways, can anyone please help me ?

Thanks

Chandan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,078

Hi

Use below logic

Loop at internal table TB_TABLE_CONT( which has the fields which are displayed in the table control)

if the entry if not blank then i.e not TB_TABLE_CONT is initial.

MODIFY tb_table_cont INDEX tc_fact_in-current_line.

if sy-subrc <> 0. append tb_table_cont.

endif.

endif.

endloop.

9 REPLIES 9
Read only

Former Member
0 Likes
1,078

hi chandan,

i have tried the following code for reading of list. it works fine....

tables: vbrk.

data: begin of itab occurs 0,

vbeln TYPE vbrk-vbeln,

kurrf like vbrk-kurrf,

netwr like vbrk-netwr,

x(15) TYPE c,

end of itab.

start-of-selection.

SELECT vbeln kurrf netwr Up TO 5 ROWS

FROM vbrk

INTO TABLE itab.

loop at itab.

itab-x = itab-netwr * itab-kurrf.

MODIFY itab.

ENDLOOP.

end-of-selection.

loop at itab.

write:/ itab-vbeln,

itab-netwr ,

itab-kurrf,

itab-x.

endloop.

AT LINE-SELECTION.

READ TABLE ITAB INDEX sy-loopc.

loop at itab.

WRITE / ITAB-vbeln.

endloop.

SY-LOOPC is used to read the tablecontrol and use the logic of sy-ucomm as given in previous thread. Hope it will work for u.... and if u r not using the previous thread pls close it, marking on star mark.

Read only

Former Member
0 Likes
1,079

Hi

Use below logic

Loop at internal table TB_TABLE_CONT( which has the fields which are displayed in the table control)

if the entry if not blank then i.e not TB_TABLE_CONT is initial.

MODIFY tb_table_cont INDEX tc_fact_in-current_line.

if sy-subrc <> 0. append tb_table_cont.

endif.

endif.

endloop.

Read only

0 Likes
1,078

Hey Lavanya, can you suggest me, why the Internal Table which is of same structure as that of the Table Control is empty,

I entered 1 row of data from the Screen, but in PAI, the internal table for the same is empty.

Please help

Read only

0 Likes
1,078

Please look into this thread and help me, I really need this thing on high priority.

Kindly understand my problem,

Read only

0 Likes
1,078

Pls follow this code and modify accordingly.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0905.

MODULE FILL_TABLE.

LOOP AT T_LOTNR WITH CONTROL TABLE1.

*MODULE FILL_TABLE_CONTROL.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT T_LOTNR.

MODULE READ_TABLE_CONTROL.

ENDLOOP.

MODULE USER_COMMAND_0905.

MODULE READ_TABLE_CONTROL INPUT.

IF SY-UCOMM NE 'GOBACK'.

APPEND T_LOTNR.

SORT T_LOTNR BY LOTNR.

DELETE ADJACENT DUPLICATES FROM T_LOTNR COMPARING LOTNR.

CLEAR T_LOTNR.

ELSE.

DATA : T_LOTNR3 TYPE TABLE OF TP_LOTNR WITH HEADER LINE.

REFRESH T_LOTNR.

L_SYUCOMM = SY-UCOMM.

IF SY-UCOMM NE 'BACK'.

CLEAR : SY-UCOMM.

ENDIF.

APPEND T_LOTNR.

SORT T_LOTNR BY LOTNR.

DELETE ADJACENT DUPLICATES FROM T_LOTNR COMPARING LOTNR.

CLEAR T_LOTNR.

ENDIF.

ENDMODULE.

Regards,

Krishna.

Read only

0 Likes
1,078

Hi

the columns in the table control should refer to the internal table like

TB_TABLE_CONT-KSCHL

TB_TABLE_CONT-VARCOND

these are 2 fields in the internal table and are defined as columns in the screen layout of table control, if this is done then there will entries in the internal table

Read only

0 Likes
1,078

I didnt get u lavanya, what I did is I created one structure having say 10 fields.

I designed the table control exactly like that of the structure above.

I declared one ITAB type of this structure.

In PAI, I am using LOOP AT ITAB

MODULE data_cal.

ENDLOOP.

Now even though, I am entering data on screen, this ITAB is not getting filled. WHY ?

Please suggest on this

Read only

0 Likes
1,078

Hi

Check below links-

Refer below programs- how to create table control and define table control elements

and use the logic posted in earlier forum how to save data.

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

Read only

0 Likes
1,078

Hi Lavanya,

I went through your links and programs, but still my requirement is not completed.

Data from table control is not coming to my Internal Table in the Program.

I just need to keep those data which is entered on the screen in the table control.

Please help.

Thanks

Chandan