11-05-2018 10:22 AM
I am trying to find all date fields in a generic table.I create a dynamic table of the generic table DATATAB of exit EXIT_RSAQEXCE_001!
Datatab has some column like P0002-VORNA .I try to split this column into two strings then use the DDIF_FIELDINFO_GET function module to find out if the field is type date or not in order to modify it from 20181212 to 12.12.2018!
This gives the error::
The function module interface allows you to specify only fields of a particular type under "FIELDNAME". The field "STR2" specified here is a different field type .
Code is as follows::
READ TABLE LT_COMPONENTS ASSIGNING <LS_COMP> INDEX SY-INDEX.
"field name: <ls_comp>-name.
CLEAR STR4.
STR4 = <LS_COMP>-NAME.
IF STR4 CS '-'.
SPLIT STR4 AT '-' INTO: STR1 STR2 .
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = DATATAB
FIELDNAME = STR2
LANGU = SY-LANGU
IMPORTING
DDOBJTYPE = STR3
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
11-05-2018 10:31 AM
You need to declare it using type FIELDNAME, check the definition of IMPORTING parameter FIELDNAME of function module DDIF_FIELDINFO_GET:
*" VALUE(FIELDNAME) TYPE DFIES-FIELDNAME DEFAULT ' '
Or change your code as follows:
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = DATATAB
FIELDNAME = CONV FIELDNAME( STR2 )
LANGU = SY-LANGU
IMPORTING
DDOBJTYPE = STR3
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
11-05-2018 10:25 AM
11-05-2018 10:28 AM
11-05-2018 10:31 AM
You need to declare it using type FIELDNAME, check the definition of IMPORTING parameter FIELDNAME of function module DDIF_FIELDINFO_GET:
*" VALUE(FIELDNAME) TYPE DFIES-FIELDNAME DEFAULT ' '
Or change your code as follows:
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = DATATAB
FIELDNAME = CONV FIELDNAME( STR2 )
LANGU = SY-LANGU
IMPORTING
DDOBJTYPE = STR3
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
11-05-2018 10:43 AM
The function module interface allows you to specify only fields of a particular type under "TABNAME". The field "DATATAB" specified here is a different field type .
11-05-2018 10:56 AM
IDK why datatab is not recognized as a table,even if I replace the datatab with str1 it still dumps.
11-05-2018 11:33 AM
Same story I assume, in case you declared TABNAME as STRING, too. Either declare it as DDOBJNAME, or replace
TABNAME = DATATAB
with
TABNAME = CONV DDOBJNAME( DATATAB )
11-05-2018 1:19 PM
can you please also help me with str3.but thanks you have been a great help.I have declared it type DDEUTYPE but not working