Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to use Describe or STRLEN

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.

Tags:
Former Member
replied

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 View this answer in context
Not what you were looking for? View more on this topic or Ask a question