Skip to Content
0
Former Member
Dec 12, 2007 at 11:02 AM

Bapi BAPI_PO_RELEASE doesn't release PO

2438 Views

Hi Everyone,

I have a custom Bor object for BUS2012 , for PO approval through workflow.

I have checked the parameters and binding all are in place , sometimes it doesn't release the PO when it calls BAPI_PO_RELEASE.

the code is like this.

WAIT UP TO '0.5' SECONDS.

CALL FUNCTION 'BAPI_PO_RELEASE'

EXPORTING

USE_EXCEPTIONS = USEEXCEPTIONS

PO_REL_CODE = RELCODE

PURCHASEORDER = OBJECT-KEY-PURCHASEORDE

IMPORTING

REL_STATUS_NEW = RELSTATUSNEW

REL_INDICATOR_NEW = RELINDICATORNEW

TABLES

RETURN = RETURN

EXCEPTIONS

AUTHORITY_CHECK_FAIL = 1001

DOCUMENT_NOT_FOUND = 1002

ENQUEUE_FAIL = 1003

PREREQUISITE_FAIL = 1004

RELEASE_ALREADY_POSTED = 1005

RESPONSIBILITY_FAIL = 1006

OTHERS = 01.

CASE SY-SUBRC.

WHEN 0. " OK

WHEN 1001. " AUTHORITY_CHECK_FAIL

EXIT_RETURN 1001 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WHEN 1002. " DOCUMENT_NOT_FOUND

EXIT_RETURN 1002 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WHEN 1003. " ENQUEUE_FAIL

EXIT_RETURN 1003 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WHEN 1004. " PREREQUISITE_FAIL

EXIT_RETURN 1004 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WHEN 1005. " RELEASE_ALREADY_POSTED

EXIT_RETURN 1005 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WHEN 1006. " RESPONSIBILITY_FAIL

EXIT_RETURN 1006 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WHEN OTHERS. " to be implemented

ENDCASE.

SWC_SET_ELEMENT CONTAINER 'RelStatusNew' RELSTATUSNEW.

SWC_SET_ELEMENT CONTAINER 'RelIndicatorNew' RELINDICATORNEW.

In Successful case RELSTATUSNEW is set to X and RELINDICATORNEW is set to C.

But in other cases it is not set...

this is making the PO to end up in error.

I suppose why is the wait for 0.5 seconds required just before the BAPI_PO_RELEASE... or if I increase this wait to say 2 seconds.. this will work..

Regards,

RAJ