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: 

To check all fields in a row

BALAMURUGANG
Participant
0 Kudos

TYPES : BEGIN OF ty_mara,

matnr TYPE mara-matnr,

ersda TYPE mara-ersda,

ernam TYPE mara-ernam,

laeda TYPE mara-laeda,

mtart TYPE mara-mtart,

END OF ty_mara.

I've the above structure.How to check which fields are having date type at a time.I'm using internal table for the above structure.

For example ersda,laeda having date type ,how to find the type of the fields in a row.

Thanks.

Bala

5 REPLIES 5

Former Member
0 Kudos

Hi

You can use DESCRIBE FIELD statament

Max

0 Kudos

I can find the field type by 'describe field' but how to find all the fields at time.Now i want to find which fields are having date type at time in a row without using describe filed for all fields.

0 Kudos

Hi

Try to use the class CL_ABAP_STRUCTDESCR:

TYPES : BEGIN OF TY_MARA,
          MATNR TYPE MARA-MATNR,
          ERSDA TYPE MARA-ERSDA,
          ERNAM TYPE MARA-ERNAM,
          LAEDA TYPE MARA-LAEDA,
          MTART TYPE MARA-MTART,
        END OF TY_MARA.

DATA: ITAB TYPE STANDARD TABLE OF TY_MARA WITH HEADER LINE.

DATA: MY_STRUCT   TYPE REF TO CL_ABAP_STRUCTDESCR. "CL_ABAP_TYPEDESCR.
DATA: W_COMPONENT TYPE ABAP_COMPDESCR.

APPEND INITIAL LINE TO ITAB.
* Get header line
READ TABLE ITAB INDEX 1.

MY_STRUCT ?= CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_DATA( ITAB ).

LOOP AT MY_STRUCT->COMPONENTS INTO W_COMPONENT.
  WRITE: / W_COMPONENT-NAME, W_COMPONENT-TYPE_KIND.
ENDLOOP.

Max

0 Kudos

Thanks Max

BALAMURUGANG
Participant
0 Kudos

Thanks