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

How can we read data from dynamic internal table?

Former Member
0 Likes
4,906

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

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
Read only

Former Member
0 Likes
2,359

Pls reply. its very urgent to me..

Read only

0 Likes
2,359

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>.

Read only

0 Likes
2,359

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. 

Read only

Former Member
0 Likes
2,359

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.

Read only

0 Likes
2,359

Thanks it's work..

Thank you so much...

Read only

0 Likes
2,359

You're welcome

Read only

ipravir
Active Contributor
0 Likes
2,359

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.

Read only

venuarun
Active Participant
0 Likes
2,359

Hi Mital,

Please refer this link

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

With Regards

Arun VS