09-09-2011 11:21 AM
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
09-09-2011 11:22 AM
09-09-2011 11:27 AM
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.
09-09-2011 11:39 AM
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
09-09-2011 11:52 AM
09-12-2011 5:45 AM