Application Development 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: 

How can we read data from dynamic internal table?

Former Member
0 Kudos

Hi All,

I have a problem to read data from dynamic internal table.

My code is..

FIELD-SYMBOLS:<t_dyntable> TYPE STANDARD TABLE"Dynamic internal table name

                          <fs_dyntable>.     " work area

      fld_name = 'EAN11'.

        READ TABLE <t_dyntable> INTO <fs_dyntable> WITH KEY (fld_name) = ean_no.

           IF sy-subrc = 0.                                    " Perfect till now

              

               Now i want the value of filed EAN11 and MATNR which is already assigned.

              

              Variable1 = <fs_dyntable>-????? " have error (want EAN11 Value)

              Variable2 = <fs_dyntable>-????? " have error (want MATNR Value)

          endif.


Thanks & Regards,

Mital

8 REPLIES 8

Former Member
0 Kudos

Pls reply. its very urgent to me..

0 Kudos

hi mital,

I think you are missing dynamic work area

Create like this and try please:

CREATE DATA T_NEWLINE LIKE LINE OF <t_dyntable>.

  ASSIGN T_NEWLINE->* TO <fs_dyntable>.

0 Kudos

Hi abdul,

I don't have Fixed structure of dynamic internal table.

have have read internal table successfully but i don't know the how to get value from dynamic work area. 

nikolayevstigneev
Contributor
0 Kudos

Hi, Mital!

You can try smth like that

   ASSIGN COMPONENT 'EAN11' OF STRUCTURE <fs_dyntable> TO <lv_ean11>.
   IF sy-subrc 0.
     Variable1 = <lv_ean11>.
   ENDIF.
   ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_dyntable> TO <lv_matnr>.
   IF sy-subrc 0.
     Variable2 = <lv_matnr>.
   ENDIF.

0 Kudos

Thanks it's work..

Thank you so much...

0 Kudos

You're welcome

ipravir
Active Contributor
0 Kudos

Hi, Please find to create the dynamic table,

FIELD-SYMBOLS:    <GIT> TYPE STANDARD TABLE,

     <GFL> TYPE ANY,

     <VAL> type ANY.

data: GIT_FLDS    TYPE LVC_T_FCAT,

GIT        TYPE REF TO DATA,

CALL METHOD

CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

EXPORTING

IT_FIELDCATALOG = GIT_FLDS

IMPORTING

EP_TABLE        = GIT.

IF IS ASSIGNED.

UNASSIGN .

ENDIF.

ASSIGN GIT->* TO  <GIT>.

CREATE DATA GFL LIKE LINE OF .

IF IS ASSIGNED.

UNASSIGN .

ENDIF.

ASSIGN GFL->* TO <GFL>.

and to read or update the information in dynamic table,

ASSIGN COMPONENT  GFL_FLDS-FIELDNAME OF STRUCTURE <GFL> TO <VAL>.

Regards.

Praveer.

venuarun
Active Participant
0 Kudos

Hi Mital,

Please refer this link

http://scn.sap.com/docs/DOC-53788

With Regards

Arun VS