2015 Nov 04 2:20 PM
I am getting an error returned from this BAPI : IWO_BAPI 123 -
Error reading the standard sequence from the document tables. I am passing details to create an order with notification and it is in the routine to create the notification that the error is being returned.
I don't know whether I have not passed enough data to the BAPI or whether it is something else.
If anyone could please advise me on what I should be passing to the BAPI I would be very grateful.
I am getting an error returned from this BAPI : IWO_BAPI 123 -
Error reading the standard sequence from the document tables. I am passing details to create an order with notification and it is in the routine to create the notification that the error is being returned.
I don't know whether I have not passed enough data to the BAPI or whether it is something else.
If anyone could please advise me on what I should be passing to the BAPI I would be very grateful.
2015 Nov 05 3:33 PM
Hi,
maybe this example for the BAPI will help you:
DATA: createdorder TYPE aufk-aufnr,
orderid TYPE aufnr VALUE '%00000000001'.
*-- General Mapping
DATA:
it_methods TYPE STANDARD TABLE OF bapi_alm_order_method,
wa_methods LIKE LINE OF it_methods,
it_header TYPE STANDARD TABLE OF bapi_alm_order_headers_i,
wa_header LIKE LINE OF it_header,
it_header_up TYPE STANDARD TABLE OF bapi_alm_order_headers_up,
it_header_srv TYPE STANDARD TABLE OF bapi_alm_order_srvdat_e,
it_header_srv_up TYPE STANDARD TABLE OF bapi_alm_order_srvdat_up,
it_userstatus TYPE STANDARD TABLE OF bapi_alm_order_usrstat,
it_partner TYPE STANDARD TABLE OF bapi_alm_order_partn_mul,
wa_partner LIKE LINE OF it_partner,
it_partner_up TYPE STANDARD TABLE OF bapi_alm_order_partn_mul_up,
it_operation TYPE STANDARD TABLE OF bapi_alm_order_operation,
wa_operation LIKE LINE OF it_operation,
it_operation_up TYPE STANDARD TABLE OF bapi_alm_order_operation_up,
it_relation TYPE STANDARD TABLE OF bapi_alm_order_relation ,
it_relation_up TYPE STANDARD TABLE OF bapi_alm_order_relation_up ,
it_component TYPE STANDARD TABLE OF bapi_alm_order_component,
it_component_up TYPE STANDARD TABLE OF bapi_alm_order_component_up,
it_text TYPE STANDARD TABLE OF bapi_alm_text,
it_text_lines TYPE STANDARD TABLE OF bapi_alm_text_lines,
extension_in TYPE STANDARD TABLE OF bapiparex,
return TYPE STANDARD TABLE OF bapiret2,
wa_return LIKE LINE OF return,
et_numbers TYPE STANDARD TABLE OF bapi_alm_numbers,
wa_numbers LIKE LINE OF et_numbers.
DATA: w_atinn(30),
w_atinn_number LIKE ausp-atinn.
CLEAR wa_methods.
wa_methods-refnumber = '000001'.
wa_methods-objecttype = 'HEADER'.
wa_methods-method = 'CREATE'.
wa_methods-objectkey = orderid.
APPEND wa_methods TO it_methods. CLEAR wa_methods.
wa_methods-refnumber = '000001'.
wa_methods-objecttype = ''.
wa_methods-method = 'SAVE'.
wa_methods-objectkey = orderid.
APPEND wa_methods TO it_methods. CLEAR wa_methods.
*-- Header Mapping
CLEAR wa_header.
wa_header-material = '000000000001279622'.
"wa_header-orderid = 'ZSUV'.
wa_header-order_type = 'ZSUV'.
wa_header-planplant = '1500'.
wa_header-start_date = sy-datum.
wa_header-basicstart = sy-uzeit.
APPEND wa_header TO it_header. CLEAR wa_header.
REFRESH return.
break ex00018.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = it_methods
it_header = it_header
it_header_up = it_header_up
return = return
et_numbers = et_numbers.
*
*CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
* TABLES
* it_methods = it_methods
* it_header = it_header
* it_header_up = it_header_up
* it_header_srv = it_header_srv
* it_header_srv_up = it_header_srv_up
* it_userstatus = it_userstatus
* it_partner = it_partner
* it_partner_up = it_partner_up
* it_operation = it_operation
* it_operation_up = it_operation_up
* it_relation = it_relation
* it_relation_up = it_relation_up
* it_component = it_component
* it_component_up = it_component_up
* it_text = it_text
* it_text_lines = it_text_lines
* extension_in = extension_in
* return = return
* et_numbers = et_numbers.
*
LOOP AT return INTO wa_return.
ENDLOOP.
SKIP.
LOOP AT et_numbers INTO wa_numbers.
createdorder = wa_numbers-aufnr_new.
EXIT.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_synchron = 'X'.
COMMIT WORK AND WAIT.
* Contains number of created order
SHIFT createdorder LEFT DELETING LEADING '0'.
WRITE:/ 'Works Order:', createdorder.
regards Joerg
2015 Nov 06 8:33 AM
Thanks, Jeorg, this looks like what I have already except my refnumber is %000001 - my order number is supplied by the idoc that I am reading to fill the fields.
2015 Nov 05 4:19 PM
2015 Nov 05 4:32 PM
Before call of BAPI insert code as below:
CALL FUNCTION 'CO_ZF_DATA_RESET_COMPLETE'
EXPORTING
I_NO_OCM_RESET = ' '
I_STATUS_RESET = 'X'.
2015 Nov 06 8:29 AM
Thanks, Michael, I've tried this and it hasn't made any difference. I have used the BAPI before and created orders with it but this particular time the order type is one that is configured to create a notification automatically - and this is where the error message is being generated.
2015 Nov 06 9:22 AM
please check also note 1826605 http://service.sap.com/sap/support/notes/1826605
2015 Nov 16 10:42 AM
Hello, all.
I have got past my original error message by calling BAPI_ALM_NOTIF_CREATE and BAPI_ALM_NOTIF_SAVE before calling BAPI_ALM_ORDER_MAINTAIN. However I am still getting error messages when trying to create the order - at the moment to do with execution date and priority.
De-bugging the program leads me to think that I have either missed passing some data that is required or I should have some preceding step to fill the internal tables used throughout the BAPI.
Any thoughts?
Julie
2015 Nov 16 12:29 PM
Hi Juile,
Can you pelase check with the below code. I hope it will resolve your problem.
gt_methods TYPE TABLE OF bapi_alm_order_method, " II_METHODS structure for BAPI
gt_header TYPE TABLE OF bapi_alm_order_headers_i, " IT_HEADER structure for BAPI
gt_headerup TYPE TABLE OF bapi_alm_order_headers_up," IT_HEADER_UP structure for BAPi
gt_operation TYPE TABLE OF bapi_alm_order_operation, " IT_OPERATION structure for BAPI
gt_operationup TYPE TABLE OF bapi_alm_order_operation_up, " IT_OPERATION_UP structure for BAPI
* This constant is for concatenating the object key of operation as it is 16 characters.
READ TABLE gt_aufk INTO gs_aufk WITH KEY aufnr = gs_modified-aufnr.
CONSTANTS : lc_0010(4) TYPE c VALUE '0010'.
CONCATENATE gs_modified-aufnr lc_0010 INTO lv_objkey.
CLEAR : gs_methods.
gs_methods-refnumber = '000001',.
gs_methods-objecttype = 'HEADER'.
gs_methods-method = 'CHANGE'.
gs_methods-objectkey = 'ORDERNUMBER'."provide the gs_modified-aufnr
APPEND gs_methods TO gt_methods.
* Passing the operation object key with object method as 'CHANGE'.
CLEAR : gs_methods.
gs_methods-refnumber = '000001'.
gs_methods-objecttype = 'OPERATION'.
gs_methods-method = 'CHANGE'.
gs_methods-objectkey = lv_objkey.
APPEND gs_methods TO gt_methods.
* passing the header object key with the object method as 'SAVE'.
gs_methods-refnumber = '000001'.
gs_methods-objecttype = ' '.
gs_methods-method = 'SAVE'.
gs_methods-objectkey = gs_modified-aufnr.
APPEND gs_methods TO gt_methods.
**-- Fill header table
CLEAR gs_header.
gs_header-orderid = gs_modified-aufnr.
gs_header-ordplanid = '1'.
gs_header-start_date = gs_modified-gstrp. "provide the start Date
gs_header-finish_date = gs_modified-gltrp. "provide the finish Date
gs_header-basicstart = gs_modified-gsuzp. "provide the start Time
gs_header-basic_fin = gs_modified-gluzp. "provide the End Time
APPEND gs_header TO gt_header.
**-- Fill headerup table
CLEAR gs_headerup.
gs_headerup-orderid = 'X'.
gs_headerup-ordplanid = 'X'.
gs_headerup-start_date = 'X'.
gs_headerup-finish_date = 'X'.
gs_headerup-basicstart = 'X'.
gs_headerup-basic_fin = 'X'.
APPEND gs_headerup TO gt_headerup.
**-- Fill operation table
CLEAR gs_operation.
gs_operation-pers_no = gs_modified-pernr. " if you have Enginner numper pass in this field
APPEND gs_operation TO gt_operation.
**-- Fill operationup table
CLEAR gs_operation.
gs_operationup-pers_no = 'X'.
APPEND gs_operationup TO gt_operationup.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = gt_methods
it_header = gt_header
it_header_up = gt_headerup
it_operation = gt_operation
it_operation_up = gt_operationup
extension_in = gt_bapiparex
return = gt_return.
READ TABLE gt_return INTO gs_return WITH KEY type = gc_e.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ENDIF.
Regards,
Srini.
2015 Nov 16 12:38 PM
HI Julie,
This is for Notification creation.
Data: IT_RETURN STRUCTURE BAPIRET2 OPTIONAL,
gt_return TYPE STANDARD TABLE OF bapiret2,
Step 1.Get the Required Notification Type from AUFK table against the AUART type.
Step 2: gs_notifheader-short_text = 'Notification Creation'.
Step 3:pass the Order Number.
Step 4:pass the all notif related Stuff as mentioned below.
IF it_notitem[] IS NOT INITIAL AND it_notifactv[] IS NOT INITIAL.
CLEAR it_return.
*-- Call Create BAPI for Secondary notification creation at superior order
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
notif_type = gv_notif_type
notifheader = gs_notifheader
orderid = gv_maufnr
IMPORTING
notifheader_export = gs_notifheader_export
TABLES
notitem = it_notitem
notifactv = it_notifactv
longtexts = it_notfulltxt
return = it_return.
CLEAR ep_notifheader_export.
MOVE gs_notifheader_export TO ep_notifheader_export.
ENDIF.
ELSE.
APPEND LINES OF gt_return TO it_return.
RETURN.
ENDIF.
* Check for EAI fatal errors
CALL FUNCTION 'IQS4_CHECK_ERROR_SEVERE'
TABLES
return = it_return
EXCEPTIONS
severe_error = 1
OTHERS = 2.
* if errors exists.
IF NOT sy-subrc IS INITIAL.
* Roll back the changes,
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' .
RETURN.
ENDIF.
* Save the notificaiton number
CLEAR gt_return[].
CALL FUNCTION 'BAPI_ALM_NOTIF_SAVE'
EXPORTING
number = gs_notifheader_export-notif_no
TABLES
return = gt_return.
APPEND LINES OF gt_return TO it_return.
* Check for fatal errors
CALL FUNCTION 'IQS4_CHECK_ERROR_SEVERE'
TABLES
return = it_return
EXCEPTIONS
severe_error = 1
OTHERS = 2.
* if errors exists.
IF NOT sy-subrc IS INITIAL.
* Roll back the changes,
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' .
RETURN.
ENDIF.
Regards,
Srini.
2015 Nov 16 4:21 PM
Hi Julie,
After creating the Notification, try adding a wait of 5. Here are a few things which you should try.
1. Check whether the Notification is getting created in the system or not (after the BAPI_ALM_NOTIF_CREATE and save).
2. Make sure you follow the correct sequence (refer to the help documentation on BAPI_ALM_ORDER_MAINTAIN) eg: Header, Operation, Sub operation etc...
3. If the above the 2 things doesn't work. Create the Work order first using BAPI_ALM_ORDER_MAINTAIN, do a commit ...then update the work order to link the Notificaiton to it by using the FM...
Hope this helps..
Cheers
Naavy
2015 Nov 17 9:17 AM
Hello Julie,
this BAPI is little bit tricky!
1. call BAPI_ALM_NOTIF_CREATE
2. call BAPI_ALM_NOTIF_SAVE
3. call BAPI_TRANSACTION_COMMIT
After that you are able to call BAPI_ALM_ORDER_MAINTAIN.
Regards Stefan
2015 Nov 25 3:48 PM
Just for information - I have had to have SAP note 1999358 implemented and this has resolved this particular problem! Thanks anyway to all.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |