2008 Jun 17 7:34 AM
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.
2008 Jun 17 8:04 AM
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
2008 Jun 17 8:04 AM
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
2008 Jun 17 8:27 AM
Hi Raymond,
Thanx for your quick reply...do u have any sample code for this...
Regards,
Sunil kairam.
2008 Jun 17 8:30 AM
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
2008 Jun 17 8:40 AM
Thankx Raymond.
Any body have any sample codes plz let me know...
Thanks & Regards,
Sunil kairam.
2008 Jun 17 8:08 AM
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