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

Can't change PO unit to basic unit by BAPI:BAPI_MATERIAL_MAINTAINDATA_RT

jack_wang4
Explorer
0 Likes
1,548

Hi experts,

I am trying to change PO unit to basic by BAPI: BAPI_MATERIAL_MAINTAINDATA_RT, but it didn't work well.

the following is the error messages. but it is ok to change PO unit to any other unit as long as the PO unit is difference from basic unit. how to fix it? thanks in advance.

-


The alternative unit of measure is the same as the base unit of measure

Message no. M3332

Diagnosis

You have entered an alternative unit of measure that is the same as the base unit of measure. These units must be different.

Procedure

Only enter an alternative unit of measure if it differs from the base unit of measure. Otherwise, leave this field blank.

-


6 REPLIES 6
Read only

Former Member
0 Likes
1,196

As the message indicates, you trying to create an alternate uom which is same as Base UoM. If Basic UoM and Order UoM are same, then anyway you can use it in Purchase order. Why you want to change the Article Master ?

Read only

0 Likes
1,196

yes, the user can use any maintained unit in purchase order creation, I just want to change the default PO unit since the PO items will be thousands of lines and user will take more time to change unit. that is not acceptable.

I tried to change it by tcode:mm42 and it worked very well.

Why can't BAPI:BAPI_MATERIAL_MAINTAINDATA_RT change it to basic unit?

Read only

0 Likes
1,196

In MM42, are you changing the PO UoM in Purchasing View - column Order Unit ? Can you paste the relevant code used in BAPI to update the PO Unit ?

Read only

0 Likes
1,196

the code looks like:

clear: wa_bapi_header.

wa_bapi_header-MATERIAL = lwa_matnr-matnr.

wa_bapi_header-BASIC_VIEW = c_true.

refresh:

lit_clientdata, lit_clientdatax,

lit_clientdataext, lit_clientdataextx.

clear:

lwa_clientdata, lwa_clientdatax,

lwa_clientdataext, lwa_clientdataextx.

lwa_clientdata-function = c_change.

lwa_clientdata-material = lwa_matnr-matnr.

lwa_clientdata-po_unit = lwa_matnr-pomeins.

append lwa_clientdata to lit_clientdata.

lwa_clientdatax-function = c_change.

lwa_clientdatax-material = lwa_matnr-matnr.

lwa_clientdatax-po_unit = c_true.

append lwa_clientdatax to lit_clientdatax.

clear: lwa_return.

CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'

EXPORTING

HEADDATA = wa_bapi_header

IMPORTING

RETURN = lwa_return

TABLES

CLIENTDATA = lit_clientdata

CLIENTDATAX = lit_clientdatax.

Read only

0 Likes
1,196

You don't need to pass the UoM in PO_UNIT field if its same as of Base UoM. See the Function module documentation for structure CLIENTDATA.

You need specify a unit of measure in field PO_UNIT (or PO_UNIT_ISO)
only if the order unit is not the same as the base unit of measure
(field BASE_UOM or BASE_UOM_ISO).

If units of measure that do not yet exist in the system are transferred
in the following fields, an entry in the structure UNITSOFMEASURE must
also be transferred for these new units of measure:

o   BASE_UOM (or BASE_UOM_ISO)

o   PO_UNIT (or PO_UNIT_ISO)

In transaction code MM42, See the Basic Data View of the Material. Check whether Order Unit Radio Button is selected for the Base UoM.

Read only

0 Likes
1,196

Thank you very much.

The BAPI is different from tcode.

By tcode:mm42

step1: change po unit from basic unit to other -> save OK

step2: change po unit from other to basic unit -> save OK

By BAPI:BAPI_MATERIAL_MAINTAINDATA_RT

step1: change po unit from basic unit to other OK

step2: change po unit from other to basic unit ERROR

This is the difference.

You let me know what can do and what can not do of this BAPI Although the problem is not solved.

Thanks a lot.