Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI for PR?

former_member202957
Contributor
0 Kudos
606

Hi Experts,

I have one requirement in ME51 i ll give document type and create a new PR as ref to existing PR of differnt document type so all the details are copied to given document type where i can edit purchase group, company code, document type and quantity...but Plant is in display mode....i am unable to change the plant so is there any bapi to do that?

Requiremet is copy PR details of one document type of a paticular plant to differnt document type of a differnt plant.

i.e copy PR details of Document type :SEZD Plant: 4000 TO Document type : SEZU Plant: 6000. it will generate the PR no of number range of document type ZSEU.

So Any body have idea regarding this.... Is there any BAPI to do this??

its an urgent....

<b>points will be rewarded for useful answers</b>

Regards,

sunil kairam.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
156

You may use the following BAPI in sequence to get information of the original PR and then create a new PR using the values just read

BAPI_REQUISITION_GETDETAIL

Adjust the data (change plant, type, etc.) and perform some MOVE-CORRESPONDING

BAPI_REQUISITION_CREATE

BAPI_TRANSACTION_COMMIT

Regards

5 REPLIES 5

raymond_giuseppi
Active Contributor
0 Kudos
157

You may use the following BAPI in sequence to get information of the original PR and then create a new PR using the values just read

BAPI_REQUISITION_GETDETAIL

Adjust the data (change plant, type, etc.) and perform some MOVE-CORRESPONDING

BAPI_REQUISITION_CREATE

BAPI_TRANSACTION_COMMIT

Regards

0 Kudos
156

Hi Raymond,

Thanx for your quick reply...do u have any sample code for this...

Regards,

Sunil kairam.

0 Kudos
156

Little sample for BAPI_REQUISITION_CREATE

report z_req_create.

DATA : T_REQUISITION_ITEMS LIKE BAPIEBANC OCCURS 0 WITH HEADER LINE,

T_RETURN LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE .

DATA : E_NUMBER LIKE BAPIEBANC-PREQ_NO.

T_REQUISITION_ITEMS-DOC_TYPE = 'NB'.
T_REQUISITION_ITEMS-DEL_DATCAT = '1'.
T_REQUISITION_ITEMS-DELIV_DATE = '20020626'.
T_REQUISITION_ITEMS-PLANT = 'P1'.
T_REQUISITION_ITEMS-STORE_LOC = '01'.
T_REQUISITION_ITEMS-PUR_GROUP = 'P01'.
T_REQUISITION_ITEMS-MAT_GRP = '01'.
T_REQUISITION_ITEMS-PREQ_ITEM = 1.
T_REQUISITION_ITEMS-MATERIAL = '1MAT1'.
T_REQUISITION_ITEMS-QUANTITY = 10.
T_REQUISITION_ITEMS-PREQ_NAME = '123456'.
T_REQUISITION_ITEMS-PURCH_ORG = '1000'.
T_REQUISITION_ITEMS-ACCTASSCAT = 'U' .
T_REQUISITION_ITEMS-VEND_MAT = 'G'.
APPEND T_REQUISITION_ITEMS.

CALL FUNCTION 'BAPI_REQUISITION_CREATE'
* EXPORTING
* SKIP_ITEMS_WITH_ERROR =
IMPORTING
NUMBER = E_NUMBER
TABLES
REQUISITION_ITEMS = T_REQUISITION_ITEMS
REQUISITION_ACCOUNT_ASSIGNMENT = T_REQ_ACCOUNT_ASSIGNMENT
* REQUISITION_ITEM_TEXT =
* REQUISITION_LIMITS =
* REQUISITION_CONTRACT_LIMITS =
* REQUISITION_SERVICES =
* REQUISITION_SRV_ACCASS_VALUES =
RETURN = T_RETURN
* REQUISITION_SERVICES_TEXT =
* EXTENSIONIN =
* REQUISITION_ADDRDELIVERY =
.

IF NOT E_NUMBER IS INITIAL .
WRITE:/ 'REQ NO:' , E_NUMBER , 'CREATED'.
ELSE.
LOOP AT T_RETURN.
WRITE T_RETURN-MESSAGE.
ENDLOOP.
ENDIF.

There are [some samples at sdn|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=bapi_requisition_create&cat=sdn_all]

For your requirement, you should try to matches the result of GETDETAIL BAPI with the parameter of CREATE BAPI. Some move-corresponding should do the job.

Regards

0 Kudos
156

Thankx Raymond.

Any body have any sample codes plz let me know...

Thanks & Regards,

Sunil kairam.

Former Member
0 Kudos
156

Hi,

BAPI_REQUISITION_CHANGE Change Purchase Requisition

BAPI_REQUISITION_CREATE Create Purchase Requisition

BAPI_REQUISITION_DELETE Delete/Close Purchase Requisition

BAPI_REQUISITION_GETDETAIL Display Purchase Requisition Details

BAPI_REQUISITION_GETITEMS Read Purchase Requisition Item

BAPI_REQUISITION_GETITEMSREL List Purchase Requisitions Awaiting Release

BAPI_REQUISITION_GETRELINFO Display Detailed Release (Approval) Information on Purchase Requisitio