Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BAPI Purchase Requisition create for ASSET

Hi expert ,

I want to create Purchase Requisition using BAPI_REQUISITION_CREATE ,

this is working fine for single PR create ,but for more than one items, asset numbers not updating correctly.

for eg- if item no 10 having asset no 106000000187 and

item no 20 having asset no 106000000188.

but in my program only last asset i.e.106000000188 is updated for both 10 and 20 item.

program code is as follow.

&----


*& Form FILL_BAPI

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_DATA.

LOOP AT IT_DATA.

*TRANSLATE IT_DATA-PR_VLTYP TO UPPER CASE.

T_REQUISITION_ITEMS-DOC_TYPE = IT_DATA-PR_TYPE.

T_REQUISITION_ITEMS-DELIV_DATE = IT_DATA-PR_DATE.

T_REQUISITION_ITEMS-PLANT = IT_DATA-PR_PLANT.

T_REQUISITION_ITEMS-PUR_GROUP = IT_DATA-PR_GROUP.

T_REQUISITION_ITEMS-ACCTASSCAT = IT_DATA-KNTTP.

T_REQUISITION_ITEMS-SHORT_TEXT = IT_DATA-TXZ01.

T_REQUISITION_ITEMS-QUANTITY = IT_DATA-PR_QTY.

T_REQUISITION_ITEMS-UNIT = IT_DATA-MEINS.

T_REQUISITION_ITEMS-C_AMT_BAPI = IT_DATA-price..

T_REQUISITION_ITEMS-MAT_GRP = IT_DATA-matkl. "'1001'.

APPEND T_REQUISITION_ITEMS.

REQUISITION_ACCOUNT_ASSIGNMENT-SERIAL_NO = IT_DATA-ZEBKN."1.

REQUISITION_ACCOUNT_ASSIGNMENT-ASSET_NO = IT_DATA-ANLN1. "'106000000187'.

APPEND REQUISITION_ACCOUNT_ASSIGNMENT.

ENDLOOP.

----


  • BAPI TO CREATE PR

----


CALL FUNCTION 'BAPI_REQUISITION_CREATE'

  • EXPORTING

  • SKIP_ITEMS_WITH_ERROR =

IMPORTING

NUMBER = E_NUMBER

TABLES

REQUISITION_ITEMS = T_REQUISITION_ITEMS

REQUISITION_ACCOUNT_ASSIGNMENT = 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.

ENDFORM. " FILL_BAPI

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question