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

mbew updation

former_member211992
Active Participant
0 Likes
1,223

Dear all,

i have done dialog programming for material updation , this is the coding i have done , my requirement is i have to maitain the table mbew's moving avg price should be even in all plants based on valuation type . for example material 001 is in all plants with valuation class(sf-dom) say 100 rs in plant1 with valuation type sf-dom i need to get rs 100 in all other plants for the valuation type sf-dom,help me with this

 

LOOP AT T_ZMUITEM WHERE UPDAT1 = 'X'.

BAPI_HEAD-MATERIAL = T_ZMUITEM-MATNR.

BAPI_HEAD-ACCOUNT_VIEW = 'X'.

BAPI_MBEW-MOVING_PR = T_ZMUITEM-VERPR.

BAPI_MBEWX-MOVING_PR = 'X'.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = BAPI_HEAD

 

* CLIENTDATA =

* CLIENTDATAX =

* PLANTDATA =

* PLANTDATAX =

* FORECASTPARAMETERS =

* FORECASTPARAMETERSX =

* PLANNINGDATA =

* PLANNINGDATAX =

* STORAGELOCATIONDATA =

* STORAGELOCATIONDATAX =

 

VALUATIONDATA = BAPI_MBEW

VALUATIONDATAX = BAPI_MBEWX

 

* WAREHOUSENUMBERDATA =

* WAREHOUSENUMBERDATAX =

* SALESDATA =

* SALESDATAX =

* STORAGETYPEDATA =

* STORAGETYPEDATAX =

* FLAG_ONLINE = ' '

* FLAG_CAD_CALL = ' '

* NO_DEQUEUE = ' '

* NO_ROLLBACK_WORK = ' '

* IMPORTING

* RETURN =

* TABLES

* MATERIALDESCRIPTION =

* UNITSOFMEASURE =

* UNITSOFMEASUREX =

* INTERNATIONALARTNOS =

* MATERIALLONGTEXT =

* TAXCLASSIFICATIONS =

* RETURNMESSAGES =

* PRTDATA =

* PRTDATAX =

* EXTENSIONIN =

* EXTENSIONINX =

 

.

 

* ENDCASE.

 

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = RET_COMMIT

.

ENDLOOP.

Dear all,

i have done dialog programming for material updation , this is the coding i have done , my requirement is i have to maitain the table mbew's moving avg price should be even in all plants based on valuation type . for example material 001 is in all plants with valuation class(sf-dom) say 100 rs in plant1 with valuation type sf-dom i need to get rs 100 in all other plants for the valuation type sf-dom,help me with this

 

LOOP AT T_ZMUITEM WHERE UPDAT1 = 'X'.

BAPI_HEAD-MATERIAL = T_ZMUITEM-MATNR.

BAPI_HEAD-ACCOUNT_VIEW = 'X'.

BAPI_MBEW-MOVING_PR = T_ZMUITEM-VERPR.

BAPI_MBEWX-MOVING_PR = 'X'.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = BAPI_HEAD

 

* CLIENTDATA =

* CLIENTDATAX =

* PLANTDATA =

* PLANTDATAX =

* FORECASTPARAMETERS =

* FORECASTPARAMETERSX =

* PLANNINGDATA =

* PLANNINGDATAX =

* STORAGELOCATIONDATA =

* STORAGELOCATIONDATAX =

 

VALUATIONDATA = BAPI_MBEW

VALUATIONDATAX = BAPI_MBEWX

 

* WAREHOUSENUMBERDATA =

* WAREHOUSENUMBERDATAX =

* SALESDATA =

* SALESDATAX =

* STORAGETYPEDATA =

* STORAGETYPEDATAX =

* FLAG_ONLINE = ' '

* FLAG_CAD_CALL = ' '

* NO_DEQUEUE = ' '

* NO_ROLLBACK_WORK = ' '

* IMPORTING

* RETURN =

* TABLES

* MATERIALDESCRIPTION =

* UNITSOFMEASURE =

* UNITSOFMEASUREX =

* INTERNATIONALARTNOS =

* MATERIALLONGTEXT =

* TAXCLASSIFICATIONS =

* RETURNMESSAGES =

* PRTDATA =

* PRTDATAX =

* EXTENSIONIN =

* EXTENSIONINX =

 

.

 

* ENDCASE.

 

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = RET_COMMIT

.

ENDLOOP.

3 REPLIES 3
Read only

Kartik2
Contributor
0 Likes
973

Hi

What is the return error message you are getting after executing this code ??

I think that you have to find out in what all plants the material is present and for all those plants you have to call this function module 'BAPI_MATERIAL_SAVEDATA'. For each call you have to pass the exporting parameters

PLANTDATA and

PLANTDATAX

Pass only the field PLANT for both these exporting parameters.

Also in VALUATIONDATA and VALUATIONDATAX pass the fields VAL_AREA as Plant name.

Hope it helps. Thank you.

Regards,

kartik

Read only

0 Likes
973

Thanks for ur reply karthik ,,,i havent got any error msg , it just executed but no updation in mbew , here i given a brief expla of my requirement

my t_zmuitem table have follwing fields

matnr     description       sourceplant       update        valuationtype         value verpr (in sourceplnt here mups for matnr 001)

001         bolt                     mups             x             sf dom                    100

                                         mups                           sf inhouse                 80

                                         mups                                                          70

002         screw                   chis                             sf-dom                    120

                                          chis                             sf-repair                   45

here the matnr 001 is in plants mapl chis , i have choosen mups as the source plant , now mups- sf-dom value is 100 , this value should be updated in mapl   chis  for the valuation type sf-dom , mapl chis - sf inhouse should be updated with rs 80 , mapl chis -space shoul;d be updated with 70 .

here update filed is a checkbox , when click that check box and update button , the value 100 should be updated in all plants which has valuation type sf-dom.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
973

BAPI_MATERIAL_SAVEDATA has a similar behavior to MM02. Lets try to update average cost of a valuated material which stock is not zero with transaction MM02 (field should not be available) - changing average/standard cost will create an accounting document posting.

Look at transaction MR21 and try BDC (AFAIK no true released BAPI, even if you can copy FM BAPI_M_REVAL_CREATEPRICECHANGE to a Z_BAPI FM removing the error flag at the start of code)

Regards,

Raymond