Application Development and Automation 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: 
Read only

error when use function BAPI_MATERIAL_SAVEDATA

Former Member
0 Likes
560

Hello everyone I try to use function BAPI_MATERIAL_SAVEDATA

to update MM02 field planned price (future)

but it's generate error "CURRENCY initial v., currency amount 88,888.0000 in PLND_PRICE was transferred without a currency"

please see my code and advice

**************************************************************

* Get Material Number to be processed

PARAMETERS: MATERIAL LIKE  BAPI_MARA_GA-MATERIAL.

* Read Material Data

CALL FUNCTION 'BAPI_MATERIAL_GET_ALL'

  EXPORTING

    MATERIAL                   = MATERIAL

  IMPORTING

*    CLIENTDATA                 = CLIDAINP

    VALUATIONDATA = VALUATION_MATERIAL

  TABLES

    RETURN                     = RETURNMES.

* Header Data: Material and View to maintain

HEADDATA-MATERIAL    = MATERIAL.

HEADDATA-COST_VIEW = 'X'.

* Detail Data: Field Value, and 'X'-Structure to mark the field for maintenance

EXPORT_VALUATION-PLND_PRICE = 88888.

EXPORT_VALUATION_X-PLND_PRICE = 'X'.

*test

* Call the BAPI

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

  EXPORTING

    HEADDATA                   = HEADDATA

VALUATIONDATA = EXPORT_VALUATION

VALUATIONDATAX = EXPORT_VALUATION_X

  IMPORTING

    RETURN                     = RETURN

  TABLES

    RETURNMESSAGES             = RETURNMES.

* Commit to release the locks

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

* RETURN-TYPE is 'E' in case of error, else 'S'.

IF RETURN-TYPE = 'E'.

  LOOP AT RETURNMES.

    WRITE: / RETURNMES-MESSAGE.

  ENDLOOP.

ELSEIF RETURN-TYPE = 'S'..

  WRITE: / 'Weight of material ', MATERIAL, 'Sucessfully doubled'.

2 REPLIES 2
Read only

former_member196490
Active Participant
0 Likes
490

Check if VALUATIONDATA-VAL_AREA is passed correctly.

Read only

laurent_fournier2
Contributor
0 Likes
490

You need to pass valuation area in order to get the currency.