CLEAR:OUT_MSG. IF IN_FLAG = ‘Y‘. CALL FUNCTION ‘BAPI_PO_RELEASE‘ EXPORTING PURCHASEORDER = IN_EBELN PO_REL_CODE = IN_FRGCO EXCEPTIONS AUTHORITY_CHECK_FAIL = 1 DOCUMENT_NOT_FOUND = 2 ENQUEUE_FAIL = 3 PREREQUISITE_FAIL = 4 RELEASE_ALREADY_POSTED = 5 RESPONSIBILITY_FAIL = 6 OTHERS = 7. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE. OUT_MSG = ‘S‘. ENDIF. ELSEIF IN_FLAG = ‘N‘. CALL FUNCTION ‘BAPI_PO_RESET_RELEASE‘ EXPORTING PURCHASEORDER = IN_EBELN PO_REL_CODE = IN_FRGCO EXCEPTIONS AUTHORITY_CHECK_FAIL = 1 DOCUMENT_NOT_FOUND = 2 ENQUEUE_FAIL = 3 PREREQUISITE_FAIL = 4 RELEASE_ALREADY_POSTED = 5 RESPONSIBILITY_FAIL = 6 NO_RELEASE_ALREADY = 7 NO_NEW_RELEASE_INDICATOR = 8 OTHERS = 9. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE. OUT_MSG = ‘S‘. ENDIF. ENDIF.