01-20-2022 5:35 AM
hi.
Need suggestion. I have one scenario
Values are coming into FM like 5678.65800341 , Char(30). ( should not change data type).
decimal points.. need to pick dynamically.
In t006, Field ANDEC - No of decimals. (values will exists like 0,1,2,3)
if 0 means. 5678 then, 1 means 5678.6 and, 2 means 5678.65
Like suppose to come.
If i use any round function like below.
DATA(lv_round) = round( val = '5678.65800341' dec = 2 ).
The result is '5678.66. I need '5678.65.
How could i achieve this requirement.
01-20-2022 6:57 AM
Please check SAP Help round, rescale - Rounding Functions .
You can use mode = ROUND_HALF_DOWN in your round formula.
01-20-2022 6:45 AM
looks like you want to change Idoc input data to quantity field with dynamic unit of quantity. If yes, check the code of FM CIF_GEN_CONVERT_QUANTITY_ISO
01-20-2022 6:46 AM
01-20-2022 6:57 AM
Please check SAP Help round, rescale - Rounding Functions .
You can use mode = ROUND_HALF_DOWN in your round formula.
01-24-2022 5:29 PM
If values coming into FM are type char. You can search for the '.' in the number and then shown only the number of characters from the point that are required.
FIND FIRST OCCURRENCE OF '.' IN number MATCH OFFSET(dec_point)
dec_point = dec_point + places + 1. "Plus 1 for the point and places is the number of decimals to be shown
decimal = number(dec_point).