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: 

I am unable to insert a Condition type 'ZGLC' - item level using BAPI_PO_CHNAGE FM

0 Kudos
759

Hi,

I am unable to insert a Condition type 'ZGLC' at  item level using : BAPI_PO_CHNAGE FM.

Find the below code :

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

DATA  : it_cond   TYPE STANDARD TABLE OF bapimepocond,

            it_condx  TYPE STANDARD TABLE OF bapimepocondx,

            it_return TYPE STANDARD TABLE OF bapiret2,

            IT_CONDH  TYPE STANDARD TABLE OF BAPIMEPOCONDHEADER,

            IT_CONDHX  TYPE STANDARD TABLE OF BAPIMEPOCONDHEADERX,

            WA_CONH TYPE BAPIMEPOCONDHEADER,

            WA_CONHX TYPE BAPIMEPOCONDHEADERX,

            wa_cond   TYPE bapimepocond,

            wa_condx  TYPE bapimepocondx.

*HEADER COND

   WA_CONH-COND_TYPE     'ZGLC'.

   WA_CONH-COND_VALUE   =   '6.0'.

   WA_CONH-CURRENCY     =    'USD'.

   WA_CONH-CHANGE_ID    = 'I'.

   APPEND WA_CONH TO IT_CONDH.

   CLAER WA_CONH.

   WA_CONHX-COND_TYPE     'X'.

   WA_CONHX-COND_VALUE   =   'X'.

   WA_CONHX-CURRENCY     =    'X'.

   WA_CONHX-CHANGE_ID    = 'X'.

   APPEND WA_CONHX TO IT_CONDHX.

  CLEAR WA_CONHX.

***ITEM COND

*wa_cond-condition_no   =  '460000080'.

wa_cond-itm_number     '000010'.

wa_cond-cond_type      'ZGLC'.

wa_cond-cond_value     '6.0'.

wa_cond-currency       = 'USD'.

wa_cond-change_id      'I'.

APPEND wa_cond TO it_cond.

CLEAR wa_cond .

wa_condx-itm_number     '000010'.

wa_condx-cond_type      'X'.

wa_condx-cond_value     'X'.

wa_condx-currency       = 'X'.

wa_condx-change_id      'X'.

APPEND wa_condx TO it_condx.

CLEAR wa_condX.

CALL FUNCTION 'BAPI_PO_CHANGE'

   EXPORTING

     purchaseorder = '0460000080'

   TABLES

     return        =             it_return

    POCONDHEADER  =             IT_CONDH

    POCONDHEADERX =              IT_CONDHX

     pocond        =            it_cond

     pocondx       =            it_condx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

* EXPORTING

*   WAIT          =

* IMPORTING

*   RETURN        =

   .

7 REPLIES 7

ziolkowskib
Active Contributor
0 Kudos
569

And what is the outcome of your operation? Do you get any errors in IT_RETURN? If so please share them with us.

If you do not get any errors please check if your condition ZGLC has any requirements assigned to it. If so check if they are fulfilled (debugging suggested).

0 Kudos
569

Hi ,

I am unable to insert manually 'ZGLC' to the transaction me22n .

i think problem with test data. Could you please confirm the parameters what i have passed is right or not? Still need to pass anymore parameters ?

Once the test data  come from functional consultant i will update you the status.

Regards,

Chaitanya

0 Kudos
569

If you can't add that condition with ME22N pricing configuration must be maintained. Most probably if you execute your code right now you should get similar error as the one displayed in ME22N while inserting ZGLC condition.

At first sight your code seems correct but you are never sure unless you test it

0 Kudos
569

In the code :

Should i need to pass the item no as :

wa_cond-itm_number     '000010'. or wa_cond-itm_number     '000001'.

Regards,

Chaitanya

0 Kudos
569

My requirement is to update at item level for all PO corresponding to SO condition records data.

Here i doubt about should i need to fill header constion records. Currently i am filling header condition records also in the bapi_po_change FM.

0 Kudos
569

Field ITM_NUMBER should have number of corresponding item from PO document - I do not know what number range you use for PO items hence can't answer directly to your question.

Based on your code I can only say that you try to update PO with additional pricing condition ZGLC.

If you want to update PO conditions based on SO conditions you should first read conditions that you are interested in from SO and then try to pass it to PO conditions referring to corresponding PO items.

I can't tell you if you should or should not take also header conditions as this is up to business requirements that I'm not aware of

0 Kudos
569

i am fetching sales conditions and passing it FM, but "wa_cond-itm_number" is condition number

not a item number. As i checked in FM documentation. it was as "00001".

Thanks for your response.

Regards,

Chaitanya