2008 Nov 14 11:41 PM
Hi Experts!
I have a little problem,
When I try to modify the conditions of a PO, using the BAPI BAPI_PO_CHANGE and I see it using transaction ME23N, some of the header conditions appear duplicated,
For example,
The header condition ZFLE appear twice, one with condition value and the other without condition value (value = 0).
Can U help me?
2008 Nov 15 12:29 AM
2008 Nov 15 1:59 AM
2008 Nov 17 4:16 PM
Hi,
*first I get the PO Detail
CALL FUNCTION 'BAPI_PO_GETDETAIL1'
EXPORTING
purchaseorder = ekko-ebeln
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXT = ' '
HEADER_TEXT = ' '
DELIVERY_ADDRESS = ' '
VERSION = ' '
SERVICES = ' '
IMPORTING
poheader = poheader
poexpimpheader = poexpimpheader
TABLES
return = return
poitem = poitem
poaddrdelivery = poaddrdelivery
poschedule = poschedule
poaccount = poaccount
pocondheader = pocondheader
pocond = pocond
polimits = polimits
pocontractlimits = pocontractlimits
poservices = poservices
posrvaccessvalues = posrvaccessvalues
potextheader = potextheader
potextitem = potextitem
poexpimpitem = poexpimpitem
pocomponents = pocomponents
poshippingexp = poshippingexp
pohistory = pohistory
pohistory_totals = pohistory_totals
poconfirmation = poconfirmation
allversions = allversions
popartner = popartner
extensionout = extensionout.
*Then I delete the 'Z' Header Conditions
LOOP AT pocondheader.
IF pocondheader-cond_type(1) = 'Z'.
MOVE: pocondheader-condition_no TO pocondheaderx-condition_no,
pocondheader-itm_number TO pocondheaderx-itm_number,
pocondheader-cond_st_no TO pocondheaderx-cond_st_no.
MOVE 'D' TO pocondheader-change_id. "DELETE
MOVE 'X' TO pocondheaderx-change_id.
MODIFY pocondheader.
CLEAR pocondheader.
APPEND pocondheaderx.
CLEAR pocondheaderx.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = ekko-ebeln
POHEADER =
POHEADERX =
POADDRVENDOR =
testrun = ' '
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
expheader = poheader
exppoexpimpheader = poexpimpheader
TABLES
return = return
POITEM =
POITEMX =
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
pocondheader = pocondheader
pocondheaderx = pocondheaderx
pocond = pocond
pocondx = pocondx
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
POHISTORY =
POHISTORY_TOTALS =
POCONFIRMATION =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
CALL FUNCTION 'DEQUEUE_ALL'.
Using a Table Control I create the new Header Conditions
LOOP AT ti_cond WHERE kbert NE 0.
CLEAR t685a.
SELECT SINGLE * FROM t685a
WHERE kschl EQ ti_cond-kschl
AND kappl EQ 'M'.
CLEAR lfm1.
SELECT SINGLE * FROM lfm1
WHERE lifnr EQ ekko-lifnr
AND ekorg EQ ekko-ekorg.
CLEAR tmks.
SELECT SINGLE * FROM tmks
WHERE kalsk EQ lfm1-kalsk.
CLEAR t683s.
SELECT SINGLE * FROM t683s
WHERE kschl EQ ti_cond-kschl
AND kappl EQ 'M'
AND kalsm EQ tmks-kalsm.
BREAK-POINT.
pocondheader-condition_no = ekko-knumv.
pocondheader-itm_number = '000000'.
pocondheader-cond_st_no = t683s-stunr. " Número de nivel
pocondheader-cond_count = t683s-zaehk."contador
pocondheader-cond_type = ti_cond-kschl."Clase de cond
IF ti_cond-koein EQ '%'.
pocondheader-cond_value = ti_cond-kbert * 100. "valor
ELSE.
pocondheader-cond_value = ti_cond-kbert. "valor
ENDIF.
pocondheader-cond_value = ti_cond-kbert. "valor
pocondheader-currency = ti_cond-koein.
pocondheader-currency_iso = ti_cond-koein.
pocondheader-applicatio = 'M'.
APPEND pocondheader.
CLEAR pocondheader.
pocondheaderx-condition_no = ekko-knumv.
pocondheaderx-itm_number = '000000'.
pocondheaderx-cond_st_no = t683s-stunr. " Número de nivel
pocondheaderx-cond_count = 'X'."contador
pocondheaderx-cond_type = 'X'."Clase de cond
pocondheaderx-cond_value = 'X'. "valor
pocondheaderx-currency = 'X'. "ti_cond-KOEIN
pocondheaderx-currency_iso = 'X'. "ti_cond-KOEIN
pocondheaderx-applicatio = 'X'.
APPEND pocondheaderx.
CLEAR pocondheaderx.
ENDLOOP.
and Modify the PO
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = ekko-ebeln
POHEADER =
POHEADERX =
POADDRVENDOR =
testrun = ' '
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
expheader = poheader
exppoexpimpheader = poexpimpheader
TABLES
return = return
POITEM =
POITEMX =
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
pocondheader = pocondheader
pocondheaderx = pocondheaderx
pocond = pocond
pocondx = pocondx
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
POHISTORY =
POHISTORY_TOTALS =
POCONFIRMATION =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
CALL FUNCTION 'DEQUEUE_ALL'.
*
When I see the PO using ME23N
Some of these header conditions appear duplicated
Thaks for your help
2008 Nov 18 2:45 PM
2009 Feb 02 12:21 PM
Hi,
There is a option called CHANGE ID- I ,U, D in BAPI_PO_CHANGE
in every condition types add this option
I- means Insert, if previously condition type is not thr,
U- means update, if previously condition type is thr
D- means delete, if previously condition type u want to delete
2009 Mar 23 12:23 PM
2012 Sep 03 6:01 PM
Hey Francisco,
Could you solve the problem?
If you resolved this, can you tell me how you did it, because I have the same problem please.
Thanks!!!!