10-07-2010 2:10 PM
Hello,
for Idoc traitement I'm using standard MF IDOC_INPUT_ORDERS .
To do some modification I opened an exit ( EXIT_SAPLVEDA_002 ).
Question:
When I raise an error inside this exit, that status message is Error, status = 51 but the document (sales order)
is created !! Why ??
10-07-2010 2:23 PM
do you add the error/status to the structure for BDIDOCSTAT and return to calling program?
10-07-2010 2:47 PM
in exit EXIT_SAPLVEDA_004 there's the table DIDOC_STATUS[] with 2 lines:
0000000001740982 51 E PG 158 000000
0000000001740982 51 E PG 158 000000
But the sales order is created !!!!!!
10-07-2010 2:51 PM
this is the code i have utilised within my exit and it works fine for me...
so if the processing fails... it returns the error on lv_return[].
IF NOT lv_return IS INITIAL.
DESCRIBE TABLE lt_return LINES lw_lines.
*-- Process idoc message
LOOP AT lt_return INTO lw_return.
IF lw_return-type = 'S'.
idoc_status-status = '53'.
ELSEIF lw_return-type = 'E'.
idoc_status-status = '51'.
ENDIF.
idoc_status-msgty = lw_return-type.
idoc_status-msgid = lw_return-id.
idoc_status-msgno = lw_return-number.
idoc_status-msgv1 = lw_return-message_v1.
idoc_status-msgv2 = lw_return-message_v2.
idoc_status-msgv3 = lw_return-message_v3.
idoc_status-msgv4 = lw_return-message_v4.
idoc_status-docnum = lv_idocnum.
IF sy-tabix = lw_lines.
APPEND idoc_status.
ENDIF.
IF l_appl_log IS BOUND.
l_appl_log->add_message( idoc_status ).
ENDIF.
CLEAR idoc_status.
ENDLOOP.
ENDIF.
*-----------------------------------------------------------------------
* Link the application log to IDoc status
*-----------------------------------------------------------------------
IF l_appl_log IS BOUND.
* Populate IDOC_STATUS with application log number to link them
lw_idoc_status-appl_log = l_appl_log->get_appl_log_no( ).
IF lw_idoc_status-appl_log IS NOT INITIAL.
MODIFY idoc_status FROM lw_idoc_status
TRANSPORTING appl_log
WHERE docnum = lv_idocnum.
ENDIF.
ENDIF.
then the IDOC_STATUS is passed back and in BD87 it shows as failed with the error.
10-07-2010 3:08 PM
10-07-2010 3:34 PM
Hi,
Use EXIT_SAPLVEDA_01.
To update into the status record, EXIT_SAPLVEDA_010.
Hope it helps.
Sujay
10-07-2010 3:03 PM
Set the parameter USER_ERROR to equal '1'.
If you look at the SAP code that calls this user exit you will see that the following code appears.
IF SY-SUBRC <> 0.
IDOC_STATUS-STATUS = BELEG_NICHT_GEBUCHT.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-MSGTY = SY-MSGTY.
IDOC_STATUS-MSGID = SY-MSGID.
IDOC_STATUS-MSGNO = SY-MSGNO.
IDOC_STATUS-MSGV1 = SY-MSGV1.
IDOC_STATUS-MSGV2 = SY-MSGV2.
IDOC_STATUS-MSGV3 = SY-MSGV3.
IDOC_STATUS-MSGV4 = SY-MSGV4.
APPEND IDOC_STATUS.
ENDIF.
10-07-2010 3:48 PM
Hi
cancel the order with a message Type 'E' in Exit
EXIT_SAPLVEDA_001
ZXVEDU03.
example
Kunde/Bestellnummer schon als Auftrag angelegt ?
SELECT SINGLE * FROM vbak INTO wa_xvbak2
WHERE bstnk = wa_xvbak1-bstkd
AND kunnr = wa_xvbak-kunnr.
IF sy-subrc = 0.
Auftragsanlage ablehnen, da schon vorhanden
Empfänger ermitteln
lv_email = 'SD_IDOCZ002'.
CONCATENATE 'EDI-Bestellung:'(002) wa_xvbak1-bstkd
'bereits als Kundenauftrag:'(003) wa_xvbak2-vbeln ' angelegt.'(004)
INTO wa_body SEPARATED BY space.
APPEND wa_body TO gt_body.
lv_subject = 'China: EDI-Kundenauftragsanlage abgelehnt'(005).
CALL FUNCTION 'Z_SENDMAIL_EXTERN'
EXPORTING
psubject = lv_subject
p_email = lv_email
p_rec_typ = 'C'
TABLES
it_body = gt_body.
CONCATENATE 'Bestellnummer' 'schon vorhanden' INTO lv_text1
SEPARATED BY space.
MESSAGE lv_text1 TYPE 'E'.
ELSE.
...
11-15-2010 8:18 AM
Tks for reply.
I used EXIT_SAPLVEDA_011 and I replicated the test.