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

Dynamic declaration

Former Member
0 Likes
226

I have to create an internal table of certain database table type. without using field symbols.

Paramaters: Ledger like t881-rldnr.

data: itab like table of t881.

data: line like line of itab.

select single * from t881 into line where rldnr = ledger.

  • here comes the problem

I have to declare a table of type as follows

jtab should have the structure of value in (line-tab)

If the solution is with field symbols then can i declare an internal table of that type.

please provide some inputs.

Please help me.

Thanks in Advance.

Helpful answers would be rewarded.

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
201

Hello Kalpana

You have to use field symbols, there is no other way available. However, instead of defining all possible itabs you can make favour of the <b>RTTI</b>.

  DATA:
    ldo_data     TYPE REF TO data.

  FIELD-SYMBOLS:
    <lt_itab>    TYPE table.


  UNASSIGN <lt_Itab>.

  SELECT SINGLE * FROM t881 INTO line
    WHERE ( rldnr = ledger ).
  IF ( syst-subrc = 0      AND
        line-tab   IS NOT INITIAL ).
    CREATE DATA ldo_data TYPE TABLE OF (line-tab).
    ASSIGN ldo_data->* TO <lt_itab>.
  ENDIF.

  IF ( <lt_itab> IS ASSIGNED ).
... " do processing of itab contents
  ENDIF.

Regards

Uwe