2011 May 24 12:21 PM
Hi guys.
I am using SAP R/3 4.7.
I tried to use BAPI_PR_CHANGE to change PR quantity and text.
For this,I populated the structure BAPIMEREQITEMIMP with PREQ_ITEM,QUANTITY and SHORT_TEXT individually (since BAPI_PR_GETDETAIL is not available in R/3 4.7).Correspondingly I filled the structure BAPIMEREQITEMX correspondingly with PR no and 'X'.
First I got the error : Enter Plant.
Then I gave plant details to the structure.
Now I didn't get the error but got the message Purchase Requisition xxxxxxxx changed.
Actually the PR didn't change.
Hi guys.
I am using SAP R/3 4.7.
I tried to use BAPI_PR_CHANGE to change PR quantity and text.
For this,I populated the structure BAPIMEREQITEMIMP with PREQ_ITEM,QUANTITY and SHORT_TEXT individually (since BAPI_PR_GETDETAIL is not available in R/3 4.7).Correspondingly I filled the structure BAPIMEREQITEMX correspondingly with PR no and 'X'.
First I got the error : Enter Plant.
Then I gave plant details to the structure.
Now I didn't get the error but got the message Purchase Requisition xxxxxxxx changed.
Actually the PR didn't change.
2011 May 24 12:28 PM
Hi,
Did you called "BAPI_TRANSACTION_COMMIT" after calling your BAPI.
Regards,
Harish
2011 May 24 12:28 PM
Hi,
Did you use 'BAPI_TRANSACTION_COMMIT' after the BAPI success.
Regards,
Dhina..
2011 May 24 12:34 PM
Hi,
You need to call, Bapi Transaction Commit after you bapi, to complete databse commit.
2011 May 24 12:38 PM
2011 May 24 12:53 PM
2011 May 24 1:57 PM
HI,
Did you pass ' ' ( space ) to tetrun parameter in FM : BAPI_PR_CHANGE and then BAPI_TRANSACTION_COMMIT.
If you pass Testrun = X then the The values will not be changed.
Srikanth
2011 May 25 5:21 AM
Hi Kap,
If all parameters you passed aand there is no change in Pr. Please paster your code here.
Regards,
Madhu.
2011 May 25 6:02 AM
iBAPIMEREQITEMIMP-PREQ_ITEM = itab-bnfpo.
iBAPIMEREQITEMIMP-PLANT = itab-werks.
iBAPIMEREQITEMIMP-QUANTITY = itab-clqty.
iBAPIMEREQITEMIMP-short_text = itab-txz01.
append iBAPIMEREQITEMIMP.
iBAPIMEREQITEMX-preq_item = itab-bnfpo.
iBAPIMEREQITEMX-plant = 'X'.
iBAPIMEREQITEMX-QUANTITY = 'X'.
iBAPIMEREQITEMX-short_text = 'X'.
append iBAPIMEREQITEMX.
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
PRNUMBER = prno
TABLES
RETURN = ibapireturn
PRITEM = iBAPIMEREQITEMIMP
PRITEMX = iBAPIMEREQITEMX.
LOOP AT ibapireturn.
error-type = ibapireturn-type.
error-banfn = prno.
error-bnfpo = itab-bnfpo.
error-message = ibapireturn-message.
APPEND error.
CLEAR error.
ENDLOOP.
READ TABLE ibapireturn WITH KEY type = 'E'.
CASE sy-subrc.
WHEN 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WHEN OTHERS.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WAIT UP TO 1 SECONDS.
ENDCASE.
The Message I am getting is "S : Purchase Requisition xxxxxxxx changed".
But it is not getting changed.
2011 May 25 6:08 AM
HI ,
EPORT ZBAPI_PR_CHANGE .
DATA:
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
PRITEM LIKE BAPIMEREQITEMIMP OCCURS 0 WITH HEADER LINE,
PRITEMX LIKE BAPIMEREQITEMX OCCURS 0 WITH HEADER LINE.
PARAMETERS: P_REQUI LIKE BAPIMEREQHEADER-PREQ_NO,
P_ITEM LIKE BAPIMEREQITEMIMP-PREQ_ITEM,
P_QTY LIKE BAPIMEREQITEMIMP-QUANTITY,
P_PLANT LIKE BAPIMEREQITEMIMP-PLANT,
P_TEXT LIKE BAPIMEREQITEMIMP-SHORT_TEXT.
START-OF-SELECTION.
PRITEM-PREQ_ITEM = P_ITEM.
PRITEM-QUANTITY = P_QTY.
PRITEM-SHORT_TEXT = P_TEXT.
PRITEM-PLANT = P_PLANT.
APPEND PRITEM .
PRITEMX-PREQ_ITEM = P_ITEM.
IF NOT P_QTY IS INITIAL.
PRITEMX-QUANTITY = 'X'.
ENDIF.
IF NOT P_TEXT IS INITIAL.
PRITEMX-SHORT_TEXT = 'X'.
ENDIF.
IF NOT P_PLANT IS INITIAL.
PRITEM-PLANT = 'X'.
ENDIF.
APPEND PRITEMX .
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
PRNUMBER = P_REQUI
VERSIONS =
SKIP_ITEMS_WITH_ERROR =
TESTRUN =
TABLES
RETURN = RETURN
PRITEM = PRITEM
PRITEMX = PRITEMX
PRITEMEXP =
PRITEMSOURCE =
PRACCOUNT =
PRACCOUNTPROITSEGMENT =
PRACCOUNTX =
PRADDRDELIVERY =
PRITEMTEXT =
PRHEADERTEXT =
PRLIMITS =
PRCONTRACTLIMITS =
PRSERVICES =
PRSRVACCESSVALUES =
PRSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
ALLVERSIONS =
CHANGING
PRHEADER =
PRHEADERX =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
.
END-OF-SELECTION.
LOOP AT RETURN.
WRITE:/ RETURN-MESSAGE.
ENDLOOP.
Check with this and change your fields what you need.
Regards,
Madhu.
2011 May 25 9:24 AM
The code is similar to mine.Still not able to find out why the BAPI is not working.
2011 May 25 9:55 AM
HI,
Are you giving the leading zeros in item no.Post all the return messages from return table.
Regards,
Madhu.
2011 May 25 10:08 AM
Yes,Leading zeroes are added to the item number.
The return messages are:
S:Purchase requisition 0016676771 changed
W:Delivery date is in the past
W:Requisition date is in the past
2011 May 25 12:24 PM
Hi,
Are you able to change the PR manually. I mean did you try from SE37. If not, do the follow steps...
You have to run both BAPIs BAPI_PR_CHANGE & BAPI_TRANSACTION_COMMIT IN test sequence.( SE37 + (Shift+F8)).
give the input what your passing in your program.
If it is working fine here means,it should work in the program also.
Regards,
Dhina..
2011 May 26 5:30 AM
I even tried out using SE37 + Shift-F8. Same info I am getting "Purchase Requisition xxxx changed".But no use.
And I found out one thing,
I tried BAPI_REQUISITION_CHANGE for a PR,it works and the return type is 'I' with message "Purchase Requisiton xxxx successfully changed'.
But in this case, the return type is 'S' and the message is only 'Purchase Requisition xxxx changed'.
Why such misleading output occurs with return type as 'S-SUCCESS'????
2011 May 26 5:42 AM
Hi,
Instead of this field check with any other field to change.Did you tried like that.
Regards,
Madhu.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |