Getting Field Label (Field Description) For A Data Element Using Abap Code

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Getting field label(field

description ) for a data element


using abap code
This question is answered

Hi all,

Please let me know how to get field label(field description ) for a data element using abap
code.

Tags: abap

(https://people.sap.com/deepali.n)

Deepali N (https://people.sap.com/deepali.n)
June 19, 2008 at 14:12 PM
1 Likes
Correct Answer

(https://people.sap.com/sourav.bhaduri)

Sourav Bhaduri (https://people.sap.com/sourav.bhaduri) replied June 19, 2008 at 14:12 PM

Copy Code

1. REPORT ztest_sourav14.
2. , DATA: wa_dd04t TYPE dd04t.
3. ,
4. , PARAMETERS: p_name TYPE rollname DEFAULT 'MATNR' OBLIGATORY.
5. ,
6. , SELECT SINGLE * FROM dd04t
7. , INTO wa_dd04t
8. , WHERE rollname = p_name AND
9. , ddlanguage = sy-langu AND
10. , as4local = 'A'.
11. ,
12. , IF sy-subrc = 0.
13. , WRITE: /1 wa_dd04t-rollname, 31 wa_dd04t-ddtext.
14. , ENDIF.
15. ,

1
View this answer in context (/discussions/message/5635113#5635113)

w more on this topic (https://go.sap.com/community/tag.html?


785639136) or

sap.com/questions/ask.html?primaryTagId=833755570260738661924709785639136)

6 replies
(https://people.sap.com/sandipan.das2)

Sandipan Das (https://people.sap.com/sandipan.das2)replied

June 19, 2008 at 13:51 PM


Hi ,

You can use the function module


DDIF_DOMA_GET .

This function module takes the name of the data


element / domain and gives in back its Dictionary
information.

I hope this will help you .

Help children of U.N World Food Program by


rewarding them and encourage others to answer
your queries.

0
likes
(https://people.sap.com/jagadish.avidi)

Jagadish Avidi (https://people.sap.com/jagadish.avidi)replied

June 19, 2008 at 14:01 PM

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

OR

Step 1.

Run the transaction and click on System -> Status.


Note the program name shown under the
transaction code.

Step 2.

Run SE49 and enter the program name you


identified in step 1 (SAPLCSDI) and then press
enter.

This will identify the tables used, however, as you


want to know the fields used as well then you may
have to resort to looking at the actual code (get a
developer involved if you're not one) using
transaction SE80.

In this case the transaction CS03 is assigned to a


screen with a function group so it's a slightly tricker
process, hence the need for a developers service.

For all the tables, descriptions and fields you can


refer to these tables:

DD02L : ALL SAP TABLE NAMES

DD02T : DESCRIPTION OF TABLE NAMES

DD03L : FIELDS IN A TABLE.

Regards,

Jagadish

1
likes
(https://people.sap.com/kiran.bobbala)

kiran Bobbala (https://people.sap.com/kiran.bobbala)replied June 19, 2008 at 14:08 PM

Deepali,

Use function module RSD_DTEL_GET to get the field labels for a data
element.

*****Reward points if useful

Regards,

Kiran Bobbala

0
likes
(https://people.sap.com/deepali.n)

Deepali N (https://people.sap.com/deepali.n)replied June 19, 2008 at 14:12 PM

Hi,

I tried using this FM.But itsays that this FM doesn't exist.Pl check and let
me know,

0
likes
Correct Answer
(https://people.sap.com/sourav.bhaduri)

Sourav Bhaduri (https://people.sap.com/sourav.bhaduri)replied

June 19, 2008 at 14:12 PM

Copy Code

1. REPORT ztest_sourav14.
2. DATA: wa_dd04t TYPE dd04t.
3.
4. PARAMETERS: p_name TYPE rollname DEF
5.
6. SELECT SINGLE * FROM dd04t
7. INTO wa_dd04t
8. WHERE rollname = p_name AND
9. ddlanguage = sy-langu AND
10. as4local = 'A'.
11.
12. IF sy-subrc = 0.
13. WRITE: /1 wa_dd04t-rollname, 31 wa
14. ENDIF.
15.

1
likes
The message was moderated

Share & Follow


(https://www.facebook.com/sapcommunity) (https://twitter.com/SAPCommunity)
(https://www.youtube.com/c/SAPCommunities) (https://www.linkedin.com/company/sap)
(https://plus.google.com/+SAPCommunities) (https://instagram.com/sap/)
(http://www.slideshare.net/SAP)

Privacy (http://go.sap.com/about/legal/privacy.html) Terms of Use (http://go.sap.com/corporate/en/legal/terms-


of-use.html) Legal Disclosure (http://go.sap.com/about/legal/impressum.html) Copyright
(http://go.sap.com/about/legal/copyright.html) Trademark (http://go.sap.com/about/legal/trademark.html)
Sitemap (http://www.sap.com/sitemap/index.html) Newsletter
(https://go.sap.com/registration/newsletter.html)

You might also like