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.
Showing results for 
Search instead for 
Did you mean: 

converting string field to type P and increasing length size in dynamic internal table

Former Member
0 Kudos


I am working on dynamic internal table report list where I am facing data type and length size issue in the amount and quantity fields. For dynamic internal table, I am using class cl_abap_structdescr and calling CL_ABAP_OBJECTDESCR->GET_STRING  for appending field names. this leads to data type is string and the length is fixed based on the values. Due to this my Net amount and Quantity values are not translating CURR types and not able to write the value to Right-Justified in the output.

Output ex like;

Net amount                                                                  Quantity

305623.00   (to be 305.623,00 & right-justified)   25.00 (to be 25,00 & right-justified).

Please guide me how to fix this issue by changing the field type to P (Currency and Quantity type).



Former Member
0 Kudos

We can set the field type during the field creation.

DATA: required_type TYPE REF TO cl_abap_elemdescr,

CALL METHOD cl_abap_elemdescr=>get_p


     p_length     = Required_length

     p_decimals = Required_decimals


      p_result     = required_type.

Also refer the following code snippet which uses different data types for the dynamic field creation

Hope it helps