12-05-2013 4:34 PM
Is there somewhere that explains this function module in detail. The help files are not very good at explaining this particular FM in my opinion.
For example, I see there are two ways of getting the results back. One is using a TABLES and then DFIES_TAB yet the other way is to not use TABLES and instead use IMPORTING DFIES_WA.
What advantage does one of these have over the other? For example: In what circumstance would you HAVE to use the TABLES option instead of IMPORTING.
Also on the calling side of this FM I see in some cases you specify FIELDNAME and then other cases LFIELDNAME. Why not do everything using just FIELDNAME? What's the point of LFIELDNAME?
Any detailed explanation is well appreciated. Thank you!
For reference, here is what I used in my code but it was simply because this is what was offered to me to fix my problem. In this case it uses the IMPORTING way of getting the data back. Why not use the TABLES way of getting info back?
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = fu_tabname
FIELDNAME = fu_fieldname
LFIELDNAME = fu_fieldname
IMPORTING
DFIES_WA = fwa_field_tab
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3
12-05-2013 5:34 PM
Hi Richard,
What do you need to know about this function module?. I remember I had used this FM to get the label of a field in different languages.
Thanks,
Faisal
12-05-2013 5:57 PM
Hi Richard,
I think the Function Module documentation is quiet clear on the above points.
If the IMPORT parameter LFIELDNAME does not have the initial value, only those fields whose long name is the same as the contents of the parameter are taken into consideration. Since there can be at most one such field, the information is then returned in the EXPORT parameter DFIES_WA. DFIES_TAB is undefined in this case. If there is no such field (or if the type is a data element or a table type), the exception NOT_FOUND is triggered.
If the type is a data element or a table type (and ALL_TYPES is set), the description of the type is also returned in parameter DFIES_WA, but if one of the two parameters FIELDNAME and LFIELDNAME does not have the initial value, the exception NOT_FOUND is triggered.
If both IMPORT parameters FIELDNAME and LFIELDNAME do not have initial value, both restrictions are analyzed. The results can be found in DFIES_WA.
In general you should only use parameter LFIELDNAME. Parameter FIELDNAME is only supported for compatibility reasons.
Thanks,
Kiran
12-05-2013 11:33 PM
Hi, Kiran.
The first sentence in itself is confusing:
"If the import parameter LFIELDNAME does not have the initial value only those fields whos long name is the same as the contents of the paramenter"
If it has no initial value, how could anything have a long name the same as LFIELDNAME?
Isn't LFIELDNAME the matching parameter for the long name?
If this is the case, then there would be a match for any item with a blank long name.
You see my thinking in this?
12-06-2013 4:59 AM
Hi Richard ,
You can use the TABLES too to import the table structure. Please see the code below:
Do the following 2 steps. Then create your ABAP program accordingly with the SELECT statement.
1. From table DD03L, give your tablename and get all of its field names and corresponding data element names.
2. From table DD03T, get the description of each data element you have got in step 1.
Then Use Function Module DDIF_FIELDINFO_GET
The sample program will look like this:
REPORT ZTABLEFIELDNAME.
TABLES: DFIES,
X030L.
DATA: BEGIN OF INTTAB OCCURS 100.
INCLUDE STRUCTURE DFIES.
DATA: END OF INTTAB.
PARAMETERS: TABLENM TYPE DDOBJNAME DEFAULT 'MSEG',
FIELDNM TYPE DFIES-FIELDNAME DEFAULT 'MENGE'.
call function 'DDIF_FIELDINFO_GET'
exporting
tabname = TABLENM
FIELDNAME = FIELDNM
LANGU = SY-LANGU
* LFIELDNAME = ' '
* ALL_TYPES = ' '
* IMPORTING
* X030L_WA = WATAB
* DDOBJTYPE =
* DFIES_WA =
* LINES_DESCR =
TABLES
DFIES_TAB = INTTAB
* FIXED_VALUES =
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE:/ 'Field name not found'.
endif.
LOOP AT INTTAB.
WRITE:/ INTTAB-TABNAME, INTTAB-FIELDNAME, INTTAB-FIELDTEXT.
ENDLOOP.
*** End of Program
Thanks and Regards,
Ashish Kumar
12-06-2013 1:56 PM
Ashish, I ran your code and I understand this portion.
Using your example, under what circumstances would you use EXPORTING DFIES_WA instead of the the TABLES statement?
Why would you use the TABLES statement when you already had the table (ITAB) defined in your initial data statement?