cancel
Showing results for 
Search instead for 
Did you mean: 

Get the label of the field in runtime for RAP in BTP

arunsubbu
Explorer
0 Kudos

Hello Experts,
In my RAP programming in BTP, in order to show the label of the field which is mandatory in error message, I tried to use CL_DD_DDL_ANNOTATION_SERVICE which can read the annotation and provide the field label. But I get the error that use of this class is not permitted.

Do you know why this is not permitted? Is there some other way to get the field label that was defined in the metadata extension in runtime?
Hint: Even there is a restriction using RTTE to get the field label information as I get the following runtime error.
Method 'GET_DDIC_FIELD_LIST' of class 'CL_ABAP_STRUCTDESCR' is not released for use. For further
information, see the documentation for class 'CL_ABAP_STRUCTDESCR' and/or method 'GET_DDIC_FIELD_LIST'.

Thanks & Regards
Arun

Accepted Solutions (0)

Answers (2)

Answers (2)

patrick_winkler
Product and Topic Expert
Product and Topic Expert
0 Kudos

For such use case I would recommend the XCO library, however the implementation for metadata extension DDLX does not provide field information.

Example with Data Definition:
xco_cp_abap_repository=>object->ddls->for( 'ZI_FUENF' )->view_entity( 'ZI_Fuenf' )->field( 'ID' )->content( )->get( ).

In RAP validations you can use the %element and %path structure to associate the message with a specific element instead of making the element label part of the message itself.

Victor_Alvarez
Participant
0 Kudos

Dear Patrick.

We tested it and no data element label or description is shown:

Victor_Alvarez_0-1711037881958.png

Is there any option to get this data?

Victor_Alvarez_1-1711037932397.png

We tried to do something like this:

DATA(test3) = xco_cp_abap_repository=>object->dtel->for( 'BUKRS' )->content( ).

test3->get_long_field_label( RECEIVING rs_long_field_label = DATA(test4) ).

 

but test4 has the long_field_label in german and we did not find how to pass language parameter.

 

Regards

Victor_Alvarez
Participant
0 Kudos

.

Victor_Alvarez
Participant
0 Kudos

Same question here.