Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Batch Job Error Messages

Former Member
0 Likes
2,273

Hi Gurus,

I have a program with rounddown quantities in deliveries notes. This program is run in background with all other programs. When we checked the batch job error log, we found out that when it gets to this Rounddown program, there are some SAP generated errors messages (examples are listed below).

This issue is there is no way to know exactly which deliveries the error is generated from and if the program actually rounddown the quantities of all the deliveries passed to it and so on, because this error messages are not specific enough (like we can see below).

This program passed this new rounddown quantity number from the internal table using a BAPI.

Is there a way to change this SAP generated error messages to be specific enough like stating which actual delivery number is been affected or even stop at the error and send an email to the user to change the delivery or something in that manner, OR is there a way we can replace this SAP generated error messages with our own messages and send email out to the user.

Error Messages:-

01/16/2008 01:40:40 Step 005 started (program ZSDSO_DELIVERY_QTY_ROUNDDOWN, variant , user ID AUTOSYSUSER

01/16/2008 01:51:35 Item 000020 belongs to delivery group 001

01/16/2008 01:52:13 Item 000020 belongs to delivery group 001

01/16/2008 01:52:15 Item 000030 belongs to delivery group 001

01/16/2008 01:52:19 Item 000020 belongs to delivery group 001

01/16/2008 01:52:29 Dynamic credit check has been exceeded 23,984.52 USD

01/16/2008 01:52:30 Item 000020 (change quantity manually to 400 PC because of complex struct

01/16/2008 01:52:30 Item 000030 (change quantity manually to 400 PC because of complex struct

01/16/2008 01:52:30 Quantity correlation for dependent items has been carried out

01/16/2008 01:52:30 Item 000020 belongs to delivery group 008

01/16/2008 01:52:30 Item 000030 belongs to delivery group 008

01/16/2008 01:52:31 Dynamic credit check has been exceeded 23,984.52 USD

01/16/2008 01:52:32 Delivery quantity must be entered for the item

01/16/2008 01:52:34 Dynamic credit check has been exceeded 23,984.52 USD

01/16/2008 01:53:05 Item 000020 belongs to delivery group 001

01/16/2008 01:54:40 Dynamic credit check has been exceeded 15,501.88 USD

01/16/2008 01:55:53 Item 000020 belongs to delivery group 001

Thanks.

Points will be awarded.

6 REPLIES 6
Read only

Former Member
0 Likes
842

Hi,

This all seems to be controled by your own Z-program. Is the BAPI called once for each delivery, or does your program pass a group of deliveries? If the BAPI is called once for each delivery you can issue a message in your Z-program before you call the BAPI.

For example something like;

LOOP AT del_table.

message i001 with del_table-delivery.

call BAPI.

ENDLOOP.

Where the message text is something like "Processing delivery number &1", if any errors are issued by the BAPI you will know they relate to the delivery in the provious line of the job log.

Regards,

Nick

Read only

0 Likes
842

Thanks Nick,

Yes, the internal table that holds all the deliveries is passed once into the BAPI. This is the code that does that below:

IF i_lips_final IS NOT INITIAL.

PERFORM call_bapi_delivery_change TABLES i_lips_final.

ELSE.

w_zbdcopendn-otce706 = 'X'.

Read only

0 Likes
842

Hi,

The table is passed to the subroutine call_bapi_delivery_change, but what happens in there? Does this include a loop calling the BAPI for each row in the table, or does the BAPI get called once using the whole table?

Regards,

Nick

Read only

0 Likes
842

This is the Subrouting Form code.

FORM call_bapi_delivery_change TABLES p_i_lips LIKE i_lips.

DATA: w_header_data TYPE bapiobdlvhdrchg,

w_header_control TYPE bapiobdlvhdrctrlchg,

w_delivery TYPE bapiobdlvhdrchg-deliv_numb.

DATA: i_item_data TYPE STANDARD TABLE OF bapiobdlvitemchg,

w_item_data TYPE bapiobdlvitemchg,

i_item_control TYPE STANDARD TABLE OF bapiobdlvitemctrlchg,

w_item_control TYPE bapiobdlvitemctrlchg,

i_return TYPE STANDARD TABLE OF bapiret2,

w_return TYPE bapiret2.

LOOP AT p_i_lips INTO w_lips.

w_item_data-deliv_numb = w_lips-vbeln.

w_item_data-deliv_item = w_lips-posnr.

w_item_data-material = w_lips-matnr.

w_item_data-batch = w_lips-charg.

w_item_data-dlv_qty = w_lips-lfimg.

w_item_data-dlv_qty_imunit = w_lips-lfimg.

w_item_data-fact_unit_nom = 1.

w_item_data-fact_unit_denom = 1.

APPEND w_item_data TO i_item_data.

CLEAR w_item_control.

w_item_control-deliv_numb = w_lips-vbeln.

w_item_control-deliv_item = w_lips-posnr.

IF w_lips-delete NE 'X'.

w_item_control-chg_delqty = 'X'.

ELSEIF w_lips-delete EQ 'X'.

w_item_control-del_item = 'X'.

ENDIF.

APPEND w_item_control TO i_item_control.

ENDLOOP.

w_header_data-deliv_numb = w_lips-vbeln.

w_header_control-deliv_numb = w_lips-vbeln.

w_delivery = w_lips-vbeln.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'

EXPORTING

header_data = w_header_data

header_control = w_header_control

delivery = w_delivery

    • TECHN_CONTROL =*

TABLES

    • HEADER_PARTNER =*

    • HEADER_PARTNER_ADDR =*

    • HEADER_DEADLINES =*

item_data = i_item_data

item_control = i_item_control

    • ITEM_SERIAL_NO =*

    • SUPPLIER_CONS_DATA =*

    • EXTENSION1 =*

    • EXTENSION2 =*

return = i_return

    • TOKENREFERENCE =*

.

IF sy-subrc EQ 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

w_zbdcopendn-otce706 = 'X'.

MODIFY i_zbdcopendn FROM w_zbdcopendn TRANSPORTING otce706

WHERE delivery EQ w_deliveries-vbeln.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

DELETE i_zbdcopendn WHERE delivery EQ w_deliveries-vbeln.

    • DELETE i_deliveries WHERE vbeln EQ w_lips-vbeln.*

w_bad_delv-vbeln = w_deliveries-vbeln.

APPEND w_bad_delv TO i_bad_delv.

ENDIF.

ENDFORM. " call_bapi_delivery_change

Thanks again.

Read only

0 Likes
842

Hi,

I think something like this might work;


ENDLOOP.

w_header_data-deliv_numb = w_lips-vbeln.
w_header_control-deliv_numb = w_lips-vbeln.
w_delivery = w_lips-vbeln.

MESSAGE I001 WITH w_lips-vbeln.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
header_data = w_header_data
header_control = w_header_control
delivery = w_delivery

With whatever message number you've created with the text 'Processing delivery number &1'. Also there is a variable w_deliveries-vbeln used after the BAPI call when the return code is checked, you may also be able to include this is the message instead of w_lips-vbeln.

Regards,

Nick

Read only

Former Member
0 Likes
842

There is no need for this requirement anymore.