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 to use Describe or STRLEN

former_member810660
Participant
0 Kudos

Hi Experts,

I am getting internal table's table fields into another internal table.

DATA: BEGIN OF itab OCCURS 10,
       date TYPE sy-datum,
       time TYPE sy-uzeit,
       matnr TYPE mara-matnr,
      END OF itab,

In another internal table i am getting values like below.

BEGIN of i_tabnam occurs 10,
       fieldnam(15) type c,
      end of i_tabnam,

values in i_tabnam are:

itab-date, itab-time,itab-matnr

Now i want to describe the field lengths of actual table itab-date, itab-time and itab-matnr using the above values which are in i_tabnam. by using DESCRIBE, STRLEN or by any other means like using field symbols.

Like DESCRIBE FIELD I_TABNAM-FIELD LENGH LEN. in place of I_TABNAM-FIELD i should get the value of itab-date dynamically.

I need this requirement as a part of developing a tool.

Please help me, give me your suggestions.

Thanks & Regards,

Poorna.

1 ACCEPTED SOLUTION

former_member195698
Active Contributor
0 Kudos

DATA: BEGIN OF itab OCCURS 10,

date TYPE sy-datum,

time TYPE sy-uzeit,

matnr TYPE mara-matnr,

END OF itab,

BEGIN of i_tabnam occurs 10,

fieldnam(15) type c,

end of i_tabnam.

data:wf_len type i.

i_tabnam-fieldnam = 'ITAB-DATE'.

append i_tabnam.

i_tabnam-fieldnam = 'ITAB-TIME'.

append i_tabnam.

i_tabnam-fieldnam = 'ITAB-MATNR'.

append i_tabnam.

field-symbols:

<fs> type any.

loop at i_tabnam.

assign (i_tabnam-fieldnam) to <fs>.

describe field <fs> length wf_len.

write 😕 wf_len.

endloop.

3 REPLIES 3

former_member195698
Active Contributor
0 Kudos

DATA: BEGIN OF itab OCCURS 10,

date TYPE sy-datum,

time TYPE sy-uzeit,

matnr TYPE mara-matnr,

END OF itab,

BEGIN of i_tabnam occurs 10,

fieldnam(15) type c,

end of i_tabnam.

data:wf_len type i.

i_tabnam-fieldnam = 'ITAB-DATE'.

append i_tabnam.

i_tabnam-fieldnam = 'ITAB-TIME'.

append i_tabnam.

i_tabnam-fieldnam = 'ITAB-MATNR'.

append i_tabnam.

field-symbols:

<fs> type any.

loop at i_tabnam.

assign (i_tabnam-fieldnam) to <fs>.

describe field <fs> length wf_len.

write 😕 wf_len.

endloop.

0 Kudos

Thanks Abishek and all.

Thanks & Regards,

Poorna

former_member191735
Active Contributor
0 Kudos

use STRLEN to define the field length or use describe table for lines.