Application Development and Automation 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: 
Read only

SET HEADER

former_member328919
Participant
0 Likes
1,969

Hi all,

I have an internal table like this :

TYPES : BEGIN OF lty_wrk,

          bukrs type bkpf-bukrs,

          gjahr type bkpf-gjahr,

          belnr type bkpf-belnr,

               END OF lty_wrk.

DATA : tb_wrk TYPE TABLE OF lty_wrk.

I want to have the description of each data element.

That is to say, I want to have : 'Society', 'Exercice year', 'Document post'.

Thanks in advance for your help !

BR,

Wals

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,882

Use RTTI as explained in the ABAP documentation (RTTS - Run Time Type Services; use the methods DESCRIBE_BY_NAME for type 'LTY_WRK', then method GET_DDIC_OBJECT of CL_ABAP_TYPEDESCR to get the data elements, and function module DDIF_NAMETAB_GET to get the texts).

12 REPLIES 12
Read only

0 Likes
1,882

Hi ,

Please use the table - DD04T (R/3 DD: Data element texts) to get description of data elements.

Thanks.

Read only

0 Likes
1,882

Thanks Pavan but I only have the internal table.

And I want to have all element data from this internal table before reading DD04T.

BR,

Wals

Read only

0 Likes
1,882

Hi,

I think your requirement is to get field catalog from your custom structure.

In this case , please use the following FM

LVC_FIELDCATALOG_MERGE - just pass your structure you will get field catalog.

If not ,please elaborate your requirement.

Read only

Former Member
0 Likes
1,882

Hi,

where would you like this header text.

means you want to print those text or want to use in some other place.

please clear your requirement.

Read only

0 Likes
1,882

I want the list of the description of each data element of my internal table.

i want it in an other internal table.

Read only

0 Likes
1,882

follow this link you will get some idea.

SAPTechnical.COM - Dynamic Internal Table

Read only

former_member194965
Active Participant
0 Likes
1,882

Hi,

For header in report use class CL_SALV_TABLE and method FACTORY. After calling of method pass Output table into it. it will give you description of field in Data element.

like

      BUKRS = Company code

      GJAHR = Year

      BELNR = Document Number.

If you want to change the Description Use  CL_SALV_COLUMNS_TABLE,

                                                                 CL_SALV_COLUMN_TABLE.

Regards,

E.Ananthachari.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,883

Use RTTI as explained in the ABAP documentation (RTTS - Run Time Type Services; use the methods DESCRIBE_BY_NAME for type 'LTY_WRK', then method GET_DDIC_OBJECT of CL_ABAP_TYPEDESCR to get the data elements, and function module DDIF_NAMETAB_GET to get the texts).

Read only

0 Likes
1,882

The MF DDIF_NAMETAB_GET need a structure defined in the DDIC.

Or I declare the internal table in the program not in the DDIC.

Read only

0 Likes
1,882

Sorry for the error. Better use the method GET_DDIC_FIELD of CL_ABAP_ELEMDESCR (RTTI).

So, the general algorithm is (please correct the errors):

DATA rtti_struct TYPE REF TO CL_ABAP_STRUCTDESCR.

DATA rtti_elem TYPE REF TO CL_ABAP_ELEMDESCR.

rtti_struct ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( 'LTY_WRK' ).

DATA(comps) = rtti_struct->GET_COMPONENTS( ).

LOOP AT comps. "consider we should not use header line

  IF comps-type->type_kind = comps-type->typekind_elem.

    rtti_elem ?= comps-type.

    "before using get_ddic_field, we should check the field with method is_ddic_type

    DATA(dfies) = rtti_elem->get_ddic_field( ).

    WRITE : / comps-fieldname, dfies-fieldtext.

  ENDIF.

ENDLOOP.

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,882

What exactly is the use case for this? What are you trying to accomplish?

Also I'm curious how do you expect to get 'Society', 'Exercice year', 'Document post' from those fields when the dictionary description is different...

Read only

former_member328919
Participant
0 Likes
1,882

Thanks very much to everybody for your help.

Thank you Sandra Rossi !

@Jelena : Sorry, it's true I didn't explain very well.