cancel
Showing results for 
Search instead for 
Did you mean: 

Email Output in Invoices Acting Randomly

Former Member
0 Kudos


Hi Guys,

We have an Output type that triggers Emails to our customers on Invoice Creation. Config: Transmission Medium - 7, Dispatch Time- 4 (Send Immediately on saving)

We use a Custom copy of SDBILLDL which runs as a batch job to create these invoices. The invoices are generated correctly with Accounting Document posting as well.

Problem starts in the Mail Output: It is very random, Output is created and triggered for certain invoices and for others its not even created. This occurence is observed even for the same BillTo Partner within a batch run - Output is created for one invoice and for other document it will not be created.

We have checked all Master data and everything is correct: Output determination procedure, Access Sequences and Output condition records.

This intermittent behaviour of Output creation is causing Invoices not eing sent to customers and huge financial loss.We can use the help of experts out here. Please post here incase more details are required.

Thanks in Advance.

Regards

Rahul

Accepted Solutions (0)

Answers (3)

Answers (3)

manlujan
Explorer
0 Kudos

Did you get any feedback for this issue? We have exactly the same.

Thanks

Manuel Lujan

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Check transaction SOST. Maybe the issue could be caused by your SMTP.

Regards

Eduardo

PD: maybe note 1639935 - How to capture the SAPconnect trace will help you

Former Member
0 Kudos

Hi Eduardo

Thanks for the help.

My problem is Output is not even created in the document (no 'not Processed' status even), so checking in SOST is the secondary step, first it should be created in document right?

Thanks

Rahul

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

My apologies for my misunderstanding. Check in NACE the procedures for the message and check the procedures in your settings (or tcode NACZ), check possible requirements

I hope this helps you

Regards

Eduardo

Former Member
0 Kudos

Hi Eduardo

We do have a requirement for this output (Custom) and it is fulfilled for most of the documents. One more thing I noticed is, thsi output (ZRD6 in our case) whether it is created or not in document, determination analysis in document always says - 'Output Ignored as Requirement is not met'. And as I said this is the message even when output is created.

Thanks for all the help

Regards

Rahul

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Surely it is a customer VOFM requirement. Go to the former transaction and check the coding. If you can, copy and we could help you, maybe there is any verification about information about an email address (so, sy-subrc <> 0)

Regards

Eduardo

Former Member
0 Kudos

Hi Eduardo

Below is the code, we do check Customer email from a custom table

ZTPSAM_TA_MAILID, but for all customers we are having an issue, data is present in the table (email data)

(Output condition in question is ZRD6)

 

*} INSERT

 

FORM KOBED_962.

 

*{ INSERT DE1K907706 1

 

SY-SUBRC = 4.

CHECK : KOMKBV3-UVALL CA ' C'.

CHECK : KOMKBV3-UVPRS CA ' C'.

CHECK : KOMKBV3-UVALS CA ' C'.

CHECK : KOMKBV3-RFBSK EQ 'C'.

CHECK : komkbv3-spe_billing_ind = ' '.

SY-SUBRC = 0.

 

*Code added by naresh-1 on 19.02.2010

 

CONSTANTS: k_zhup TYPE vbrp-pstyv VALUE 'ZHUP',

k_x TYPE char1 VALUE 'X'.

DATA: l_vbrp TYPE char30 VALUE '(SAPMV60A)XVBRP[]',

l_flag TYPE char1,

lwa_vbrp TYPE vbrp.

DATA : L_VBKD TYPE CHAR30 VALUE '(SAPLV60A)XVBRP[]'.

FIELD-SYMBOLS: <li_vbrp> TYPE STANDARD TABLE .

 

 

CLEAR: l_flag.

 

 

*For getting the value of VBRP table during runtime

 

if sy-tcode = 'ZTPSAM_U_TR_COLBIL'.

ASSIGN (l_vbkd) TO <li_vbrp>.

else.

ASSIGN (l_vbrp) TO <li_vbrp>.

endif.

 

*start of change by nemalipu-1 for CHG002859

 

IF <li_vbrp> IS NOT ASSIGNED.

ASSIGN (l_vbkd) TO <li_vbrp>.

 

* IF <li_vbrp> IS ASSIGNED.

* LOOP AT <li_vbrp> INTO lwa_vbrp.

* MESSAGE lwa_vbrp-pstyv TYPE 'S'.

* ENDLOOP.

* ENDIF.

 

endif.

IF <li_vbrp> IS NOT ASSIGNED.

sy-subrc = 4.

EXIT.

ENDIF.

 

*end of change by nemalipu-1 for CHG002859

 

 

 

*IF sy-subrc IS INITIAL. "Commented for CHG002859

 

IF NOT <li_vbrp> IS INITIAL.

sy-subrc = 4.

l_flag = k_x.

 

*For checking whether any item without ZHUP item category exist or not

 

LOOP AT <li_vbrp> INTO lwa_vbrp.

IF lwa_vbrp-pstyv NE k_zhup.

sy-subrc = 0.

clear: l_flag.

EXIT.

ENDIF.

ENDLOOP.

IF NOT l_flag is INITIAL.

sy-subrc = 4.

EXIT.

ENDIF.

ELSE.

sy-subrc = 4.

exit.

ENDIF.

 

*End of code added by naresh-1 on 19.02.2010

*} INSERT

 

ENDFORM.

FORM KOBEV_962.

 

*{ INSERT DE1K907706 1

 

SY-SUBRC = 4.

CHECK : KOMKBV3-UVALL CA ' C'.

CHECK : KOMKBV3-UVPRS CA ' C'.

CHECK : KOMKBV3-UVALS CA ' C'.

CHECK : KOMKBV3-RFBSK EQ 'C'.

CHECK : komkbv3-spe_billing_ind = ' '.

SY-SUBRC = 0.

 

*Code added by naresh-1 on 19.02.2010

 

CONSTANTS: k_zhup TYPE vbrp-pstyv VALUE 'ZHUP',

k_x TYPE char1 VALUE 'X'.

DATA: l_vbrp TYPE char30 VALUE '(SAPMV60A)XVBRP[]',

l_flag TYPE char1,

lwa_vbrp TYPE vbrp.

DATA : L_VBKD TYPE CHAR30 VALUE '(SAPLV60A)XVBRP[]'.

FIELD-SYMBOLS: <li_vbrp> TYPE STANDARD TABLE .

if sy-tcode = 'ZTPSAM_U_TR_COLBIL'.

ASSIGN (l_vbkd) TO <li_vbrp>.

else.

ASSIGN (l_vbrp) TO <li_vbrp>.

endif.

CLEAR: l_flag.

 

*For getting the value of VBRP table during runtime

*start of change by nemalipu-1 for CHG002859

 

IF <li_vbrp> IS NOT ASSIGNED.

ASSIGN (l_vbkd) TO <li_vbrp>.

 

* IF <li_vbrp> IS ASSIGNED.

* LOOP AT <li_vbrp> INTO lwa_vbrp.

* MESSAGE lwa_vbrp-pstyv TYPE 'S'.

* ENDLOOP.

* ENDIF.

 

endif.

 

*IF sy-subrc IS INITIAL.

 

IF <li_vbrp> IS NOT ASSIGNED.

sy-subrc = 4.

EXIT.

ENDIF.

 

*end of change by nemalipu-1 for CHG002859

 

IF NOT <li_vbrp> IS INITIAL.

sy-subrc = 4.

l_flag = k_x.

 

*For checking whether any item without ZHUP item category exist or not

 

LOOP AT <li_vbrp> INTO lwa_vbrp.

IF lwa_vbrp-pstyv NE k_zhup.

sy-subrc = 0.

clear: l_flag.

EXIT.

ENDIF.

ENDLOOP.

IF NOT l_flag is INITIAL.

sy-subrc = 4.

EXIT.

ENDIF.

ELSE.

sy-subrc = 4.

EXIT.

ENDIF.

 

*End of code added by naresh-1 on 19.02.2010

 

 

 

******Start Change by tang-56 for CHG006424*****************

*Check Sender/Receiver Email address from custom table for ZRD2

 

TYPES:BEGIN OF t_emailids,

smtp_sender TYPE zsmtp_sender,

smtp_receiver TYPE zsmtp_receiver,

END OF t_emailids.

CONSTANTS zrd2 TYPE char4 VALUE 'ZRD2'.

 

***** 2013/12/12 CHG012590 Raul.Yao add start *****

 

CONSTANTS zrd4 TYPE char4 VALUE 'ZRD4'.

CONSTANTS zrd6 TYPE char4 VALUE 'ZRD6'.

DATA: w_zrdx TYPE char4.

 

***** 2013/12/12 CHG012590 Raul.Yao add end *****

 

DATA: ls_xnast LIKE vnast,

li_emailids TYPE STANDARD TABLE OF t_emailids,

lwa_emailids TYPE t_emailids,

lv_customer TYPE kunnr,

ls_b604 LIKE b604,

ls_b601 LIKE b601,

ls_b011 LIKE b011,

ls_b602 LIKE b602,

lv_flag TYPE flag.

data:ls_msg type balmi,

ls_text type trtext.

data:lv_text2 type char40 value 'No mail address maintained for customer'.

data:lv_text3 type char8 value 'Sale Org'.

data:lv_text4 type char7 value 'channel'.

data:lv_text5 type char12 value 'billing type'.

data:lv_text6 type char28 value ' in table ZTPSAM_TA_MAILID,'.

data:lv_text7 type char1 VALUE ','.

data:lv_text8 type char25 value 'contact local Power User'.

 

*data:lv_text8 type char8 value ' local '.

 

data:lv_space type char2.

 

***** 2013/12/12 CHG012590 Raul.Yao change start *****

 

"Only for ZRD2.

 

*CHECK t683s-kschl = zrd2.

* for ZRD2 ZRD4 ZRD6

 

CHECK t683s-kschl = zrd2

or t683s-kschl = zrd4

or t683s-kschl = zrd6.

CLEAR w_zrdx.

w_zrdx = t683s-kschl.

 

***** 2013/12/12 CHG012590 Raul.Yao change end *****

 

CHECK NOT komkbv3 IS INITIAL.

IF xnast[] IS INITIAL.

lv_flag = 'X'.

SELECT SINGLE * FROM b604 INTO ls_b604 WHERE kappl = 'V3' AND

 

***** 2013/12/12 CHG012590 Raul.Yao change start *****

* kschl = zrd2 AND

 

kschl = w_zrdx AND

 

***** 2013/12/12 CHG012590 Raul.Yao change end *****

 

vkorg = komkbv3-vkorg AND

kunre = komkbv3-kunre AND

fkart = komkbv3-fkart.

IF sy-subrc <> 0.

SELECT SINGLE * FROM b601 INTO ls_b601 WHERE kappl = 'V3' AND

 

***** 2013/12/12 CHG012590 Raul.Yao change start *****

* kschl = zrd2 AND

 

kschl = w_zrdx AND

 

***** 2013/12/12 CHG012590 Raul.Yao change end *****

 

vkorg = komkbv3-vkorg AND

kunre = komkbv3-kunre .

IF sy-subrc <> 0.

SELECT SINGLE * FROM b011 INTO ls_b011 WHERE kappl = 'V3' AND

 

***** 2013/12/12 CHG012590 Raul.Yao change start *****

* kschl = zrd2 AND

 

kschl = w_zrdx AND

 

***** 2013/12/12 CHG012590 Raul.Yao change end *****

 

vkorg = komkbv3-vkorg AND

fkart = komkbv3-fkart.

IF sy-subrc <> 0.

SELECT SINGLE * FROM b602 INTO ls_b602 WHERE kappl = 'V3' AND

 

***** 2013/12/12 CHG012590 Raul.Yao change start *****

* kschl = zrd2 AND

 

kschl = w_zrdx AND

 

***** 2013/12/12 CHG012590 Raul.Yao change end *****

 

vkorg = komkbv3-vkorg.

IF sy-subrc = 0.

CLEAR lv_flag.

ENDIF.

ELSE.

CLEAR lv_flag.

ENDIF.

ELSE.

CLEAR lv_flag.

ENDIF.

ELSE.

CLEAR lv_flag.

ENDIF.

 

IF lv_flag IS INITIAL.

REFRESH: li_emailids. CLEAR: lwa_emailids, lv_customer.

lv_customer = komkbv3-kunre.

SELECT smtp_sender smtp_receiver FROM ztpsam_ta_mailid INTO TABLE li_emailids

WHERE vkorg = komkbv3-vkorg AND

vtweg = komkbv3-vtweg AND

fkart = komkbv3-fkart AND

kunnr = lv_customer AND

inactive = space.

"if there is no email address maintained with respect to customer, select without customer number

IF li_emailids[] IS INITIAL.

SELECT smtp_sender smtp_receiver FROM ztpsam_ta_mailid INTO TABLE li_emailids

WHERE vkorg = komkbv3-vkorg AND

vtweg = komkbv3-vtweg AND

fkart = komkbv3-fkart AND

kunnr = space AND

inactive = space.

ENDIF.

 

* READ TABLE li_emailids[] INTO lwa_emailids WITH KEY smtp_receiver = space. " commented by purkayas-1 for CHG007648 TR: DE1K919409

* IF sy-subrc = 0. " commented by purkayas-1 for CHG007648 TR: DE1K919409

* MESSAGE e016(z_sam). "commented by purkayas-1 for CHG007648 TR: DE1K919409

* sy-subrc = 4. " commented by purkayas-1 for CHG007648 TR: DE1K919409

* EXIT.

* ENDIF.

 

* start of code by purkayas-1 for CHG007648 TR: DE1K919409

 

LOOP AT li_emailids[] INTO lwa_emailids WHERE smtp_receiver NE space.

ENDLOOP.

IF sy-subrc <> 0.

 

***********start change pendyala-1 CHG008480....

****This is to display error output log in in ZRD2 when email id is not present

*******wehave to handle error msg in output program only..not in requirement routine.hence changed the message to information

 

clear ls_text.

concatenate lv_text2 lv_space into ls_text.

CONCATENATE ls_text lv_customer lv_text7 INTO ls_text SEPARATED BY space.

ls_msg-msgv1 = ls_text.

clear ls_text.

CONCATENATE lv_text3 komkbv3-vkorg lv_text4 komkbv3-vtweg INTO ls_text SEPARATED BY space.

ls_msg-msgv2 = ls_text.

CLEAR ls_text.

CONCATENATE lv_text7 lv_text5 komkbv3-fkart lv_text6 INTO ls_text SEPARATED BY space.

ls_msg-msgv3 = ls_text.

ls_msg-msgv4 = lv_text8.

"CHG012590 - start change

"CHG010092 - start change

MESSAGE i000(z_scm) with ls_msg-msgv1 ls_msg-msgv2 ls_msg-msgv3 ls_msg-msgv4.

"CHG010092 - end change

"CHG012590 - end change

 

************End change pendyala-1

* MESSAGE i016(z_sam).

 

sy-subrc = 0.

EXIT.

ENDIF.

 

* end of code by purkayas-1 for CHG007648 TR:DE1K919409

 

 

ENDIF.

ELSE.

"New Enter Output Type Check

 

***** 2013/12/12 CHG012590 Raul.Yao change start *****

* LOOP AT xnast INTO ls_xnast WHERE kschl = zrd2 AND dbase = space.

 

LOOP AT xnast INTO ls_xnast WHERE kschl = w_zrdx AND dbase = space.

 

***** 2013/12/12 CHG012590 Raul.Yao change end *****

 

REFRESH: li_emailids. CLEAR: lwa_emailids, lv_customer.

lv_customer = ls_xnast-parnr.

SELECT smtp_sender smtp_receiver FROM ztpsam_ta_mailid INTO TABLE li_emailids

WHERE vkorg = komkbv3-vkorg AND

vtweg = komkbv3-vtweg AND

fkart = komkbv3-fkart AND

kunnr = lv_customer AND

inactive = space.

"if there is no email address maintained with respect to customer, select without customer number

IF li_emailids[] IS INITIAL.

SELECT smtp_sender smtp_receiver FROM ztpsam_ta_mailid INTO TABLE li_emailids

WHERE vkorg = komkbv3-vkorg AND

vtweg = komkbv3-vtweg AND

fkart = komkbv3-fkart AND

kunnr = space AND

inactive = space.

ENDIF.

 

* READ TABLE li_emailids[] INTO lwa_emailids WITH KEY smtp_receiver = space. " commented by purkayas-1 for CHG007648 TR: DE1K919409

* IF sy-subrc = 0. " commented by purkayas-1 for CHG007648 TR: DE1K919409

* DELETE xnast. "Remove the current line item. " commented by purkayas-1 for CHG007648 TR: DE1K919409

* MESSAGE e016(z_sam). " commented by purkayas-1 for CHG007648 TR: DE1K919409

* sy-subrc = 4. " commented by purkayas-1 for CHG007648 TR: DE1K919409

* EXIT.

* ENDIF.

 

* start of code by purkayas-1 for CHG007648 TR: DE1K919409

 

LOOP AT li_emailids[] INTO lwa_emailids WHERE smtp_receiver NE space.

ENDLOOP.

IF sy-subrc <> 0.

 

* DELETE xnast. "Remove the current line item.

***********start change pendyala-1 CHG008480....

 

clear ls_text.

concatenate lv_text2 lv_space into ls_text.

CONCATENATE ls_text lv_customer lv_text7 INTO ls_text SEPARATED BY space.

ls_msg-msgv1 = ls_text.

clear ls_text.

CONCATENATE lv_text3 komkbv3-vkorg lv_text4 komkbv3-vtweg INTO ls_text SEPARATED BY space.

ls_msg-msgv2 = ls_text.

CLEAR ls_text.

CONCATENATE lv_text7 lv_text5 komkbv3-fkart lv_text6 INTO ls_text SEPARATED BY space.

ls_msg-msgv3 = ls_text.

ls_msg-msgv4 = lv_text8.

MESSAGE i000(z_scm) with ls_msg-msgv1 ls_msg-msgv2 ls_msg-msgv3 ls_msg-msgv4.

 

*end change pendyala-1

* MESSAGE i016(z_sam).

 

sy-subrc = 0.

EXIT.

ENDIF.

 

* end of code by purkayas-1 for CHG007648 TR:DE1K919409

 

 

ENDLOOP.

ENDIF.

 

********End Change by tang-56 for CHG006424*****************

 

*} INSERT

 

ENDFORM.

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Yes, you have a customer VOFM requirement. First, take in account SAP Note 156230 - Requirements: What is permitted, what is not?.

The coding is so complex, so I suggest you to debug it. It contains a lot of clauses type

sy-subrc = 4.

EXIT.

So, when something happens, the output isn't made. But the most surprising for me is the select on table ztpsam_ta_mailid. Look for this table, check it in SE16 and if it is possible to mantain data with SM30,. maybe there aren't records for this customers.

Check also the messages type z_sam in tcode SE91. If the select on ztpsam_ta_mailid (a customer table) is empty (sy-subrc <> 0), write other message, so, in the future you won't have this kind of problems.

Moreover, you are now with this issue, check this subroutine and try to set a documentation about it (if it is possible add as a comment in a request in the long text, so, it will never be lost)

I hope this helps you

Regards

Eduardo

Former Member
0 Kudos

Eduardo

Thanks for the reply, we did debug this requirement and invoices having issue pass all the requirements, we suspect when invoiving is happening in batch some variable is not getting cleared, but how to catch that is the problem (if that is the cause), we are pretty sure its not data issue.

Thanks

Rahul

former_member186385
Active Contributor
0 Kudos

Hi,

Can you check whether your customer master is updated with Email ID or not?

probably you can also check ADR6 table with customer address number

you can also check SCOT transaction , if any Fail logs available for Mail

regards,

santosh

Former Member
0 Kudos

Hi Santosh,

As I said All master data is correct and for some other documents (invoices) for this customer output is triggered also, its just random, triggeres for some, not even created for others.

My problem is Output is not even created in the document (no 'not Processed' status even), so checking in SOST is the secondary step, first it should be created in document right?

Thanks

Rahul