‎2009 May 08 6:43 AM
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
‎2009 May 08 7:52 AM
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.
‎2009 May 08 7:38 AM
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.
‎2009 May 08 7:52 AM
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.
‎2009 May 08 9:16 AM
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
‎2009 May 08 10:54 AM
Please look into this thread and help me, I really need this thing on high priority.
Kindly understand my problem,
‎2009 May 08 11:28 AM
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.
‎2009 May 08 11:34 AM
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
‎2009 May 08 12:27 PM
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
‎2009 May 10 4:47 AM
‎2009 May 11 7:04 AM
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