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

Data Conversion from decimal to currency field

Former Member
0 Kudos
1,794

Hi Friends,

I am using BAPI_PO_CHANGE FM. in that i am passing net price (NET_PRICE) = (NEW_PRICE). But NET_PRICE type is DEC | 28 | 9 and NEW_PRICE type is CURR | 11 | 2. it will work or i have to convert type of NEW_PRICE. How to convert type of NEW_PRICE?

any other FM for changing PO item price. Please let me know

Thanks in advance,

Parag

4 REPLIES 4

Former Member
0 Kudos
259

Hello Parag,

You will have to convert NEW_PRICE to the type of NET_PRICE. Since the target is of greater length specification than the source, you can use a simple move statement. I think there will not be any problem of truncation.


data: new_price type BPREI      value <some value>,
      net_price type BAPICUREXT.  

move new_price to net_price.

Hope this helps,

Regards,

Anand Mandalika.

Former Member
0 Kudos
259

Hi Expert,

I would like to add to this trail..

i also have a issue in creating PO upload program using BAPI_PO_CREATE1, with regards to the net price.

If the specified CUrrency has a decimal of 2. the program works perfectly. But when using a currency with no decimals,(like IDR). if the specified net price has a length of 10 of 11. (ex. 1234567890), the program would only get the first 9 digits from the given net price. PO created would have an item with net price 123,456,789.

could anyone advise me on how could i make the net price in the PO to 11 chars if currency is IDR??

please advise.

NOTE in populating the net price in bapi,

in FM 'MAP2I_BAPIITEM_TO_ITEM'.

-


TRY.

MOVE bapimepoitem-net_price

TO mepoitem-netpr .

ENDTRY.

-


they have different data type.

bapimepoitem-net_price is type DEC 28 with decimals 9.

mepoitem-netpr is type CURR 5.

Former Member
0 Kudos
259

Hi,

Always pass the same format as allowed in Fun Mod, else dump will come.

you can later change it to whatever format you want,

declare one variable of required format & pass the value to it.

Thanks & Regards,

Krishna..

0 Kudos
259

Hi Krishna,

Thanks for the reply.

i think the problem is inside BAPI_PO_CREATE1 in which bapimepoitem-net_price has a different length of type with mepoitem-netpr.

in my point of view, mepoitem-netpr would only accept 11 characters(9 + 2 decimals.), but the bapimepoitem-net_price has a length greater than of mepoitem-netpr.

so in the codes of FM 'MAP2I_BAPIITEM_TO_ITEM' in BAPI_PO_CREATE1:

TRY.

MOVE bapimepoitem-net_price

TO mepoitem-netpr .

ENDTRY.

the program would possible dump, because of the inconsistency.

if i would create manualy a PO in ME21N, i could have a net price of 11 characters with no decimals( curr=IDR). but in the program using BAPI_PO_CREATE_PO1, only the first 9 characters of the netprice are taken into the PO.

please advise, we need this asap.

many thanks..

Richard