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: 

sap abap read table with key (from internal table)

calvinkarlo
Explorer
0 Kudos
1,110

Hi Gurus!

Need your help.

READ TABLE GT_INTERN INTO LS_INTERN_BASE WITH KEY VALUE = 'CHARGE FOR: CON'.
LOOP AT GT_INTERN INTO GWA_INTERN
ENDLOOP.

Is there a way to use the value from internal table ?

Loop at T_FRT_VLD ASSIGNING FIELD-SYMBOL(<FS01>).
READ TABLE GT_INTERN INTO LS_ROW1 WITH KEY VALUE = (<FS01>-Z_Header for row 1)
READ TABLE GT_INTERN INTO LS_ROW2 WITH KEY VALUE = (<FS01>-Z_Header for row 2)
READ TABLE GT_INTERN INTO LS_ROW3 WITH KEY VALUE = (<FS01>-Z_Header for row 3)
READ TABLE GT_INTERN INTO LS_ROW4 WITH KEY VALUE = (<FS01>-Z_Header for row 4).
ENDLOOP.

like this?

3 REPLIES 3

Matias_AV
Participant
0 Kudos
1,047

Hello,

If i understand what you want to do correctly, something like this should work.

LOOP AT t_frt_vld ASSIGNING FIELD-SYMBOL(<fs01>).
    READ TABLE gt_intern ASSIGNING FIELD-SYMBOL(<ls_row1>) WITH KEY z_header = <fs01>-z_header.
    ......
ENDLOOP.

You could also use the new ABAP syntax instead of a READ TABLE if your system supports it.

Thanks.

Sandra_Rossi
Active Contributor
0 Kudos
1,047

You have asked lots of questions last month about the exact same topic, and it seems you are still stuck, so probably you don't ask well, so I think the only solution to ask the question is to:

  1. Give the input data as ABAP code (which compiles on my server)
  2. Give the expected result as ABAP code (which compiles on my server)
  3. Explain a little bit the logic to go from the input to the output

javier_alonso
Participant
0 Kudos
1,047

I understand that you want to read a line of a global table variable, using a local table column value as key.

You can use table expressions as follows:

DATA(ls_row) = gt_intern[ z_header = t_frt_vld[ 1 ]-z_header ].