[Series] ABAP SAP ABAP BAPI_REQUISITION_CREATE Create Purchase Requisition

No public: SAP Technical
Author: Matinal
 

 

The preface

We can focus on my public number, the number public in the layout better, read more comfortable.

Body part

A recent development in the field added eban years,

Fu always call bapi assignment does not go

Later found not find the name of the structure,

They are: BAPI_TE_REQUISITION_ITEM not BAPI_TE_MEREQITEM

Example code:

REPORT zlm_pr_create.

DATA: pr_item LIKE TABLE OF bapiebanc WITH HEADER LINE,
pr_account LIKE TABLE OF bapiebkn WITH HEADER LINE,
pr_item_id LIKE TABLE OF bapiebantx WITH HEADER LINE,
pr_return LIKE TABLE OF bapireturn WITH HEADER LINE.
DATA: l_return LIKE pr_return.
DATA: extensionin TYPE TABLE OF bapiparex WITH HEADER LINE .
DATA: lw_itm TYPE bapi_te_requisition_item.
DATA: matnr TYPE matnr.
DATA: pr_no TYPE bapiebanc-preq_no.

START-OF-SELECTION.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = '500000004'
IMPORTING
output = matnr.

pr_item-doc_type = 'NB'. " Document Type
pr_item-preq_item = '00010'. " Project
pr_item-material = matnr. "commodity code
pr_item-quantity = 1." Number
pr_item-deliv_date = '20130819'. " Delivery Date
pr_item-plant = 'BA01'. " plant
pr_item-pur_group = 'B02'. " purchasing group
pr_item-c_amt_bapi = 100. "price evaluation

APPEND pr_item.
CLEAR pr_item.

 

lw_itm-csid = '991'.
lw_itm-preq_item = '00010'.
extensionin-structure = 'BAPI_TE_REQUISITION_ITEM'.
extensionin-valuepart1 = lw_itm.

APPEND extensionin.

CALL FUNCTION 'BAPI_REQUISITION_CREATE'
IMPORTING
number = pr_no
TABLES
requisition_items = pr_item
requisition_account_assignment = pr_account
requisition_item_text = pr_item_id
return = pr_return
extensionin = extensionin[].

LOOP AT pr_return WHERE type = 'E' OR type = 'A'.
ENDLOOP.

Free Pr_aitm.
Free Pr_akount.
Free Pr_aitm_id.
Free Pr_return.

Guess you like

Origin www.cnblogs.com/SAPmatinal/p/11941405.html