on 2014 Jul 09 11:22 AM
Dear experts,
We are using BAPI_PO_CREATE1 to create a service
purchase order, PO is created successfully but it is on Hold.
So, we must save this PO via ME22N manually again.
In EKKO, this on hold PO has the field MEMORY set to "X",
MEMORYTYPE set to "H".
We checked the include 'L2012F47', found a BADI:
CL_EXM_IM_ME_BAPI_PO_CUST
Example Implementation for BAdI ME_BAPI_PO_CUST.
METHOD:
IF_EX_ME_BAPI_PO_CREATE_02~INBOUND
METHOD if_ex_me_bapi_po_create_02~inbound.
* distinguish between BAPI_PO_CREATE1 and
BAPI_PO_CHANGE
IF im_aktyp EQ cl_mmpur_constants=>hin.
"BAPI_PO_CREATE1
IF NOT ch_poheader-vendor IS INITIAL.
* hold PO without error====>WHY???
ch_memory_complete = cl_mmpur_constants=>yes.
* do not perform application authority check
ch_no_authority = cl_mmpur_constants=>yes.
ENDIF.
ELSEIF im_aktyp EQ cl_mmpur_constants=>ver.
"BAPI_PO_CHANGE
* clear version management data
CLEAR ch_versions.
ENDIF.
ENDMETHOD.
The question is if we pass a vendor to this BAPI,
the created purchase order will be hold due to the code
above will set the ch_memory_complete to 'X'.
Which means the purchase order will be created but
on hold.
Could you give us a hint on why purchase order will be
hold while a vendor is passed in the BAPI?
Thanks for your kindly help.
Best Regards,
Eason Ling
Hi Eason,
use FM: BAPI_PO_CHANGE.
Regards,
Venkat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello venkat,
Thanks for giving us a hint on this issue.
But i am not very clear on your reply.
Do you mean that:
First, we can create a Purchase order via BAPI BAPI_PO_CREATE1, and status on hold.
Then, we can use BAPI BAPI_PO_CHANGE to set the status back.
The same question:
Why purchase order created by BAPI_PO_CREATE1 will be set 'ON HOLD'?
I find no documents to explain it...
Looking forward your lastest reply~
Best regards,
Eason
Hi,Mallinath
Actually, we checked it and found a 'suspect' code in INCLUDE 'L2012F47'.
Once we pass the vendor data to BAPI:
IF NOT ch_poheader-vendor IS INITIAL.
* hold PO without error
ch_memory_complete = cl_mmpur_constants=>yes.
* do not perform application authority check
ch_no_authority = cl_mmpur_constants=>yes.
ENDIF.
Once the MEMORY_COMPLETE flag is set to 'X', the BAPI will save the Purchase order with status HOLD.
Could you explain or maybe give us some hints on why the purchase order gets held if we maintain a vendor for it
Or other way:
From business point of view, when we should hold a purchase order?
Thanks in advance~
Best regards,
Eason
Hi Eason,
I had a check and it gives something correct when you have the control on MEMORY_COMPLETE flag.
Usually this flag is set as per new functionality in BAPI_PO_CREATE1.
You can have a control based on set flag for MEMORY_COMPLETE.
So better ask your ABAPER not set the flag MEMORY_COMPLETE to "X" when there are no errors and PO can be saved successfully.
Kindly refer the below OSS Note, which explains how to set the PO on hold and can be set the PO saved sucessfully with setting into Hold option.
354771 - Enjoy BAPI: Holding of purchase orders
Rgds,
holding a service order is a new functionality with 605 release.
It is not possible to hold an incomplete PO, e.g. a PO without vendor.
there is a short explanation in the release docu.
I think this is just a check to make sure that the PO is complete before it can be put on hold. That it goes on hold is probably triggered by another parameter.
Hi Mallinath,
We didn't set MEMORY_COMPLETE when calling the BAPI_PO_CREATE1, which means in BAPI_PO_CREATE1 the MEMORY_COMPLETE is ' ', according to NOTE 354771, the purchase order will be saved instead of being held. What's more, our service purchase order is a correct and complete one.
Documentation for the fields:
MEMORY_COMPLETE:
You can use this parameter to control whether a CORRECT and complete purchase order is held or
saved.
If the value of this parameter is 'X', then the purchase order is held.
If the value of this parameter is ' ', then the purchase order is saved.<<<<<<<<
MEMORY_UNCOMPLETE:
You can use this parameter to define whether an INCORRECT or incomplete purchase order is to be held.
If the value of the parameter is 'X', then the purchase order is held.
If the value of the parameter is ' ', then the purchase order NOT is created.
As what i described previously, even we set MEMORY_COMPLETE to ' ' when calling the BAPI_PO_CREATE1,these codes listed below will also set MEMORY_COMPLETE to 'X'.
IF NOT ch_poheader-vendor IS INITIAL.
* hold PO without error
ch_memory_complete = cl_mmpur_constants=>yes.
* do not perform application authority check
ch_no_authority = cl_mmpur_constants=>yes.
ENDIF.
Then in INCLUDE 'L2012F26', line 233(listed below), the code logic will determine if the Purchase order be held or saved.
* docu:
* docu: check document
* check if memory flag can be set
lcl_memory=>process( "Park&Hold
EXPORTING im_po = ch_po
im_memory_complete = ch_memory_complete<<<<<<<<<<
im_memory_uncomplete = ch_memory_uncomplete
IMPORTING ex_save = lf_save
ex_memory = lf_memory
ex_memorytype = lf_memorytype
CHANGING ch_park_complete = ch_park_complete
ch_park_uncomplete = ch_park_uncomplete ).
All above is a standard logic, if we maintained a vendor for this purchase order, the order will be held. But if we don't assgin a vendor to this purchase order, when calling the BAPI, an error message will pop-up...
Am i right?
Best regards,
Eason
Yes, your observation is almost correct
But we need to analyze why the BAPI is failing to update when the vendor code is added.
Does it is doing any std validation against vendor master before taking into account.
Does the vendor master is set for deletion flag?
Because as such BAPI cannot create the success PO in held status
Hello Jürgen,
Thanks for your reply~
According to NOTE 354771:
MEMORY_UNCOMPLETE:
You can use this parameter to define whether an INCORRECT or incomplete purchase order is to be held.
If the value of the parameter is 'X', then the purchase order is held.
If the value of the parameter is ' ', then the purchase order NOT is created.
Seems possible to hold an incorrect or incomplete purchase order.
But in our situtaion, both of the parameters MEMORY_COMPLETE and MEMORY_UNCOMPLETE are set to ' '.
That means:
If purchase order is incomplete.
it will NOT be created since the parameter MEMORY_UNCOMPLETE is set to ' ';
Else.
it will BE saved not held since the parameter MEMORY_COMPLETE is set to ' '.
ENDIF.
Actually, the MEMORY_COMPLETE is set to 'X' by a BADI:
INCLUDE 'L2012F47', found a BADI: CL_EXM_IM_ME_BAPI_PO_CUST
Example Implementation for BAdI ME_BAPI_PO_CUST.
IF NOT ch_poheader-vendor IS INITIAL.
* hold PO without error
ch_memory_complete = cl_mmpur_constants=>yes.
* do not perform application authority check
ch_no_authority = cl_mmpur_constants=>yes.
ENDIF.
Could it be other parameters to control the hold status? Please kindly to correct me if i am not right above.
Best regards,
Eason
Actually, our BAPI call is processed successfully with vendor code added but the purchase order is on hold.
Vendor master is ok. We can manually create purchase order with the vendor via ME21N.
And the purchase order is set 'Document saved as complete'.
What we expected is BAPI call with vendor code can be processed successfully and purchase order is created with status 'Document saved as complete'.
Thanks experts~ Issue closed:
The BADI i mentioned before is the pain point.
Sample code is not deleted.
Best regards,
Eason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As per the latest release of BAPI_PO_CREATE1, it will keep on hold the PO rather returning the error message.
Kindly check you are passing the correct values to BAPI, try to check each function with help of ABPAER.
Rgds,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thanks for the reply~
We checked the parameters, all correct.
What's more, the purchase order is created with no errors but just the status is on hold.
Then we enter this purchase order via ME22N, without change anything, just save it again.
The status is changed, and in EKKO the fields MEMORY is set ' ' so the MEMORYTYPE.
you know, in the method IF_EX_ME_BAPI_PO_CREATE_02~INBOUND:
IF NOT ch_poheader-vendor IS INITIAL.* hold PO without error
Obviously, if there are no errors the PO is created on hold. It doesn't make sence to hold a Purchase order without error.....
Do you have any idears?
Look forward your reply~
Best regards,
Eason
User | Count |
---|---|
98 | |
9 | |
8 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.