DATA number LIKE bapieban-preq_no.
DATA: requisition_items LIKE bapiebanc OCCURS 0 WITH HEADER LINE,
requisition_account_assignment LIKE bapiebkn OCCURS 0 WITH HEADER LINE,
requisition_text LIKE bapiebantx OCCURS 0 WITH HEADER LINE,
requisition_limits LIKE bapiesuhc OCCURS 0 WITH HEADER LINE,
requisition_contract_limits LIKE bapiesucc OCCURS 0 WITH HEADER LINE,
requisition_services LIKE bapiesllc OCCURS 0 WITH HEADER LINE,
requisition_services_texts LIKE bapieslltx OCCURS 0 WITH HEADER LINE,
requisition_srv_accass_values LIKE bapiesklc OCCURS 0 WITH HEADER LINE,
return LIKE bapireturn OCCURS 0 WITH HEADER LINE.
requisition_items-preq_item = '00010'.
requisition_items-doc_type = 'NB'.
requisition_items-pur_group = 'F3C'.
requisition_items-created_by = ''.
requisition_items-preq_name = ''.
requisition_items-preq_date = ''.
requisition_items-short_text = 'TESTING SERVICE ITEM'.
...
requisition_items-plant = '7600'.
...
requisition_items-mat_grp = '097'.
...
requisition_items-del_datcat = '1'.
requisition_items-deliv_date = '20110930'.
requisition_items-preq_date = sy-datum.
...
requisition_items-item_cat = '9'.
requisition_items-po_unit = 'CS'.
requisition_items-acctasscat = 'K'.
requisition_items-quantity = '12.000'.
requisition_items-unit = 'CS'.
...
requisition_items-purch_org = '103C'.
...
requisition_items-pckg_no = '0000000001'.
APPEND requisition_items.
*REQUISITION_ACCOUNT_ASSIGNMENT-PREQ_NO = ''.
requisition_account_assignment-preq_item = '00010'.
requisition_account_assignment-serial_no = '01'.
...
requisition_account_assignment-preq_qty = '0.000'.
requisition_account_assignment-preq_unit = 'CS'.
requisition_account_assignment-distr_perc = '0.0'.
requisition_account_assignment-g_l_acct = '0006240005'.
requisition_account_assignment-bus_area = ''.
requisition_account_assignment-co_area = '8008'.
requisition_account_assignment-cost_ctr = '8088001777'.
requisition_account_assignment-funds_ctr = '0000000099999999'.
...
APPEND requisition_account_assignment.
*1.3.1. First line: Header line for service specifications
requisition_services-pckg_no = '0000000001'.
requisition_services-line_no = '0000000001'.
requisition_services-ext_line = '0000000000'.
...
requisition_services-subpckg_no = '0000000002'.
requisition_services-service = ''.
...
requisition_services-quantity = '0.000'.
requisition_services-base_uom = ''.
...
requisition_services-short_text = 'REQ_SERVICES SHORT_TEXT'.
...
APPEND requisition_services.
CLEAR requisition_services.
*1.3.2. Second line: Service with master
requisition_services-pckg_no = '0000000002'.
requisition_services-line_no = '0000000002'.
requisition_services-ext_line = '0000000010'.
...
requisition_services-subpckg_no = '0000000000'.
*requisition_services-service = '100290'.
...
requisition_services-quantity = '220.000'.
requisition_services-base_uom = 'CS'.
requisition_services-gr_price = '1'.
...
requisition_services-short_text = 'DDDDDDDDD'.
...
APPEND requisition_services.
CLEAR requisition_services.
*1.3.3. Third line: Service without master
*requisition_services-pckg_no = '0000000002'.
*requisition_services-line_no = '0000000003'.
*requisition_services-ext_line = '0000000020'.
*...
*requisition_services-subpckg_no = '0000000000'.
*requisition_services-service = ''.
*...
*requisition_services-quantity = '8.000'.
*requisition_services-base_uom = 'CS'.
*requisition_services-gr_price = '12.0000'.
*...
*requisition_services-short_text = 'SERVICE WITHOUT MASTER'.
*...
*APPEND requisition_services.
*CLEAR requisition_services.
*1.4.
*1.4.1. Account assignment for the first service (with master)
requisition_srv_accass_values-pckg_no = '0000000002'.
requisition_srv_accass_values-line_no = '0000000002'.
requisition_srv_accass_values-serno_line = '01'.
requisition_srv_accass_values-percentage = '100.0'.
requisition_srv_accass_values-serial_no = '01'.
APPEND requisition_srv_accass_values.
CLEAR requisition_srv_accass_values.
*1.4.2. Account assignment for the second service (without master)
requisition_srv_accass_values-pckg_no = '0000000002'.
requisition_srv_accass_values-line_no = '0000000003'.
requisition_srv_accass_values-serno_line = '01'.
requisition_srv_accass_values-percentage = ' 100.0'.
requisition_srv_accass_values-serial_no = '01'.
APPEND requisition_srv_accass_values.
CLEAR requisition_srv_accass_values.
BREAK-POINT.
*2. Purchase requisition for services with limit -
* - single account assignment
*
*2.1. REQUISITION_ITEMS as 1.1. (see above)
*In the place of ITEM_CAT = 9, for a pure limit purchase requisition, you can also use ITEM_CAT = 1. Select DOC_TYPE = FO (framework purchase requisition) as document type in this case.
*
*2.2. REQUISITION_ACCOUNT_ASSIGNMENT as 1.2. (see above)
*
*2.3. REQUISITION_LIMITS
* PCKG_NO 0000000001
* LIMIT 1000
* NO_LIMIT
* EXP_VALUE 1000
* ...
* NO_FRLIMIT X
* ...
*
*2.4. REQUISITION_SRV_ACCASS_VALUES
* PCKG_NO 0000000001
* LINE_NO 0000000000
* SERNO_LINE 01
* PERCENTAGE 100,0
* SERIAL_NO 01
*
*
*BREAK-POINT.
*REFRESH return.
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
* EXPORTING
* SKIP_ITEMS_WITH_ERROR =
* AUTOMATIC_SOURCE = 'X'
IMPORTING
number = number
TABLES
requisition_items = requisition_items
requisition_account_assignment = requisition_account_assignment
requisition_item_text = requisition_text
requisition_limits = requisition_limits
requisition_contract_limits = requisition_contract_limits
requisition_services = requisition_services
requisition_srv_accass_values = requisition_srv_accass_values
return = return
* requisition_services_text = requisition_services_text
* requisition_addrdelivery = requisition_addrdelivery
* extensionin = extensionin
.
COMMIT WORK.