07-22-2009 2:06 PM
Dear Experts,
I have created PO Using BAPI_PO_CREATE then I am trying to create Goods receipt in MIGO Transaction showing following message
The Purchase (XXXXXXXXXXX) order is not yet released
I have used BAPI_PO_RELEASE also for release the PO.
Could you please give me the suggestion to create Goods receipt no in MIGO Transaction for the same PO ?
Thanks in advance.
Warm Regards,
Sivakumar
07-22-2009 2:17 PM
Hi,
In Tcode Me22n there is tab Release Strategy at header level of PO, You will find PO Release Code there, in my case it was 10 and 20.
IF g_count EQ 1.
g_po_rel_code = '10'. " Code For Executive Release
ELSEIF g_count EQ 2.
g_po_rel_code = '20'. " Code For Manager Release
ENDIF.
IF return[] IS INITIAL.
PERFORM bapi_po_release USING po_number.
ENDIF.
return[] = gt_return[].
IF g_count EQ 2 AND return[] IS INITIAL.
return-type = 'S'.
CONCATENATE 'Purchase Order'
po_number
'successfully released.'
INTO return-message
SEPARATED BY space.
APPEND return.
ENDIF.
g_count = g_count + 1.
ENDWHILE.
form bapi_po_release using p_po_number.
CALL FUNCTION 'BAPI_PO_RELEASE'
EXPORTING
purchaseorder = p_po_number
po_rel_code = g_po_rel_code
USE_EXCEPTIONS = 'X'
NO_COMMIT = ' '
IMPORTING
REL_STATUS_NEW = g_rel_status_new
REL_INDICATOR_NEW = g_rel_indicator_new
RET_CODE = g_ret_code
TABLES
RETURN = gt_return
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.
ENDIF.
endform. "
Defaulty this BAPI do Commit work. There is Field Called No_Commit. IF you have marked as X then you have to use BAPI_COMMIT_WORK.
For complete release of PO you have to use all the PO Release Code.
Thanks & regards,
ShreeMohan
Edited by: ShreeMohan Pugalia on Jul 22, 2009 3:17 PM
07-22-2009 2:10 PM
Hi,
Did u commit the BAPI.
Use FM BAPI_TRANSACTION_COMMIT
Regards
Milan
07-22-2009 2:17 PM
Hi,
In Tcode Me22n there is tab Release Strategy at header level of PO, You will find PO Release Code there, in my case it was 10 and 20.
IF g_count EQ 1.
g_po_rel_code = '10'. " Code For Executive Release
ELSEIF g_count EQ 2.
g_po_rel_code = '20'. " Code For Manager Release
ENDIF.
IF return[] IS INITIAL.
PERFORM bapi_po_release USING po_number.
ENDIF.
return[] = gt_return[].
IF g_count EQ 2 AND return[] IS INITIAL.
return-type = 'S'.
CONCATENATE 'Purchase Order'
po_number
'successfully released.'
INTO return-message
SEPARATED BY space.
APPEND return.
ENDIF.
g_count = g_count + 1.
ENDWHILE.
form bapi_po_release using p_po_number.
CALL FUNCTION 'BAPI_PO_RELEASE'
EXPORTING
purchaseorder = p_po_number
po_rel_code = g_po_rel_code
USE_EXCEPTIONS = 'X'
NO_COMMIT = ' '
IMPORTING
REL_STATUS_NEW = g_rel_status_new
REL_INDICATOR_NEW = g_rel_indicator_new
RET_CODE = g_ret_code
TABLES
RETURN = gt_return
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.
ENDIF.
endform. "
Defaulty this BAPI do Commit work. There is Field Called No_Commit. IF you have marked as X then you have to use BAPI_COMMIT_WORK.
For complete release of PO you have to use all the PO Release Code.
Thanks & regards,
ShreeMohan
Edited by: ShreeMohan Pugalia on Jul 22, 2009 3:17 PM
07-22-2009 2:26 PM
Hi,
Where should i give the below variable ?
IF g_count EQ 1.
g_po_rel_code = '10'. " Code For Executive Release
ELSEIF g_count EQ 2.
g_po_rel_code = '20'. " Code For Manager Release
ENDIF.
Could you plese give some more info for the variables ?
Thanks,
Sivakumar
07-22-2009 2:28 PM
Hi,
CALL FUNCTION 'BAPI_PO_RELEASE'
EXPORTING
purchaseorder = p_po_number
po_rel_code = g_po_rel_code <================ Give it here in FM 'BAPI_PO_RELEASE'
USE_EXCEPTIONS = 'X'
NO_COMMIT = ' '
IMPORTING
REL_STATUS_NEW = g_rel_status_new
REL_INDICATOR_NEW = g_rel_indicator_new
RET_CODE = g_ret_code
TABLES
RETURN = gt_return
EXCEPTIONS
AUTHORITY_CHECK_FAIL = 1
DOCUMENT_NOT_FOUND = 2
ENQUEUE_FAIL = 3
PREREQUISITE_FAIL = 4
RELEASE_ALREADY_POSTED = 5
RESPONSIBILITY_FAIL = 6
OTHERS = 7
07-22-2009 2:36 PM
HI
This is giving following exception,
Exception RESPONSIBILITY_FAIL
Message ID: ME Message number: 104
Message:
Release outside field of responsibility
Thanks,
Sivakumar
07-22-2009 2:45 PM
Hi,
What is the value u are passing in po_rel_code?
Is it 10 or 20?
If yes then you are wrong and do below step.
Go to ME22n
Enter PO Number
At header Level of PO, You will find tab called RELEASE STRATEGY.
In that Tab there would be a small ALV Grid. The First Column in the field called Code.
Take that value and pass it po_rel_code in BAPI_PO_RELEASE.
you can test this in SE37
Key in BAPI_PO_RELEASE.
Press F8
then key in PO number in Import Parameter PURCHASEORDER.
PO Release Code in Field PO_REL_CODE.
07-22-2009 2:53 PM
Hi
I have done but there i found 3 code ie., i1 , i2 ,i3.
i1 and i2 are relesed but i3 is showing yellow status ?
Thanks ,
Sivakumar.
07-22-2009 2:55 PM
What is the message you are geting when you are passing i3 in return table.
Could you please let me know
Edited by: ShreeMohan Pugalia on Jul 22, 2009 3:55 PM
07-22-2009 2:59 PM
Hi
I did n't get any message in return table and REL_STATUS_NEW = XXX ,
EL_INDICATOR_NEW = R.
every thing ok but it is showing yellow staus.
I1 Release level1 released
I2 Release level2 released
I3 Release level1 release possible
I am unable to Create Goods recepit in MIGO .
Thanks ,
Sivakumar
Edited by: Sivakumar Arumugam on Jul 22, 2009 7:32 PM
07-22-2009 3:04 PM
IF you are geting value in return table as below
REL_STATUS_NEW = XXX ,
EL_INDICATOR_NEW = R.
It Means PO is released.
Please ask your Function Consultant why are u not able to do MIGO.
07-22-2009 3:07 PM