on 05-11-2006 2:53 PM - last edited on 02-04-2024 6:04 AM by postmig_api_4
Hi everybody,
In my alv I'd like to display a column "plan quantity" in relation with a unit column "um_of". I mean that if the unit is, for example 'pc', the quantity must be in whole numbers, and for an other unit, as "kg", I want to display a decimal number.
So, in the fieldcat, I add the qfieldname, but it doesn't work. Where am I wrong? How can I do?
Here is the code :
CLEAR lt_fieldcat.
lt_fieldcat-fieldname = 'QT_OF'.
lt_fieldcat-col_pos = 6.
lt_fieldcat-outputlen = 10.
lt_fieldcat-seltext_m = 'Plan Qty'.
lt_fieldcat-qfieldname = 'UM_OF'.
APPEND lt_fieldcat TO r_alv-fieldcat.
CLEAR lt_fieldcat.
lt_fieldcat-fieldname = 'UM_OF'.
lt_fieldcat-col_pos = 12.
lt_fieldcat-outputlen = 5.
lt_fieldcat-seltext_m = 'UoM'.
APPEND lt_fieldcat TO r_alv-fieldcat.
Thanks in advance !
Hi,
For displaying any field with decimals then you can define that field with character and before append this quantity field to output internal table do this.
write 'quantity' to v_qty quantity 'EA'.
Note:v_qty should be character type and no need to use t_fieldcat-qfield in field cat internal table for quantity field.
Cheers,
Bujji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
GIVE DECIMALS_OUT = 'X' IN THE FIELDCAT.
HOPE THIS HELPS,
PRIYA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in such a case u define two seperate forms which are called according to the requirement...
The fieldcats are to be defined according to ur requirement in both the forms and then u can use performs as usual
append fieldcatalog with rest of fields as usual
After this use
if unit = 'pc'.
perform pc.
endif.
if unit = 'kg'.
perform kg.
endif.
form pc.
CLEAR lt_fieldcat.
lt_fieldcat-fieldname = 'QT_OF'.
lt_fieldcat-col_pos = 6.
lt_fieldcat-outputlen = 10.
lt_fieldcat-seltext_m = 'Plan Qty'.
lt_fieldcat-qfieldname = 'UM_OF'.
APPEND lt_fieldcat TO r_alv-fieldcat.
CLEAR lt_fieldcat.
lt_fieldcat-fieldname = 'UM_OF'.
lt_fieldcat-col_pos = 12.
lt_fieldcat-outputlen = 5.
lt_fieldcat-seltext_m = 'UoM'.
APPEND lt_fieldcat TO r_alv-fieldcat.
endform.
form kg.
CLEAR lt_fieldcat.
lt_fieldcat-fieldname = 'QT_OF'.
lt_fieldcat-col_pos = 6.
lt_fieldcat-outputlen = 10.
lt_fieldcat-seltext_m = 'Plan Qty'.
lt_fieldcat-qfieldname = 'UM_OF'.
lt_fieldcat-decimals_out = 'X'
APPEND lt_fieldcat TO r_alv-fieldcat.
CLEAR lt_fieldcat.
lt_fieldcat-fieldname = 'UM_OF'.
lt_fieldcat-col_pos = 12.
lt_fieldcat-outputlen = 5.
lt_fieldcat-seltext_m = 'UoM'.
APPEND lt_fieldcat TO r_alv-fieldcat.
endform.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess it depends on the column data type
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Welcome to SDN forums.
Its the data type of the column that decides to round the value or not, irrespective of the unit type.
So, I think you might have to do this manually depending on the UoM.
Regards,
Ravi
Note : Please mark the helpful answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.