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: 

DDIF_FIELDINFO_GET type conflict

former_member2492
Active Participant
0 Kudos

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.


1 ACCEPTED SOLUTION

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.
7 REPLIES 7

0 Kudos

How is STR2 declared?

0 Kudos

type string.

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.

0 Kudos

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 .

0 Kudos

IDK why datatab is not recognized as a table,even if I replace the datatab with str1 it still dumps.

0 Kudos

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 )

0 Kudos

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