11-14-2011 12:39 PM
Hi,
i use the BAdI HRBAS00INFTY~IN_UPDATE to send Mails when a training has changed.
To send a Mail i use the class CL_BCS.
After calling CL_BCS->send ( ) i'm using commit work.
When the BAdi is called by the transaction lso_psv1 or lso_psv2 all works fine.
If i change a Infotype in transaction PP01 the BAdI is also called and the class CL_BCS is called with the same paramerters.
After commit work the mail appears in the queue (TA SOST) with the same Massage-ID, but the status is 'still no entry in queue' .
I hope somebody knows a solution!
Regards
Reinhard
Here the test-coding:
DATA:
mail_lr TYPE REF TO cl_bcs,
mail_body_lr TYPE REF TO cl_document_bcs,
mail_sender_lr TYPE REF TO if_sender_bcs,
mail_receiver_lr TYPE REF TO if_recipient_bcs,
exeption_bcs_lr TYPE REF TO cx_bcs, "#EX NEEDED
exeption_lr TYPE REF TO cx_root,
err_text_lv TYPE string,
subject_lv TYPE so_obj_des,
line_la type soli,
text_lt type soli_tab,
bool_lv Type os_boolean.
line_la = 'TestMail'.
append line_la to text_lt.
subject_lv = 'Test-Mail-Subject'.
TRY.
mail_lr = cl_bcs=>create_persistent( ).
mail_body_lr = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text_lt
i_subject = subject_lv ).
mail_lr->set_document( mail_body_lr ).
mail_receiver_lr = cl_cam_address_bcs=>create_internet_address( 'here is the receiver mail' ).
mail_lr->add_recipient(
i_recipient = mail_receiver_lr
i_express = 'X'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '
).
mail_sender_lr = cl_cam_address_bcs=>create_internet_address( 'here is the sendermail' ).
mail_lr->set_sender(
i_sender = mail_sender_lr ).
mail_lr->set_send_immediately( abap_false ).
call METHOD mail_lr->send(
EXPORTING i_with_error_screen = 'X'
RECEIVING result = bool_lv ).
COMMIT WORK.
CATCH cx_bcs INTO exeption_bcs_lr.
ENDTRY.
IF exeption_bcs_lr IS INITIAL.
ENDIF.
11-15-2011 8:53 AM
As per SAP documentation this is an interim status, (provided it stays only for a short period)
MSG 672:
*A message was sent from the application. The current status of the message is 'Waiting'. However, no entry exist (yet) in the queue.*
*Use*
*This can be a normal interim status of a sent message. Preparations for entering the message in the queue for the SAPconnect send process are complete. As soon as the Persistence Service has put the message into the corresponding database table for the queue, the status changes to 'Waiting'.*
*If this status stays the same for too long, an inconsistent state exists. In many cases, the cause of this lies with the sending application. The Persistence Service first writes the data to the database when the application has set an explicit Commit Work. If this is missing, then the message is not put into the queue and is not recorded by the SAPconnect send process. On the send request overview, you can put the message in the queue again using retry, but you must look for the cause of the problem in the sending application itself.*
*Another cause of the problem may be that the corresponding entry in the queue was deleted manually before the send process recorded the message.*
so the question is, whether the message remains there for ever or only for a short period?
Regards,
Gokul
11-15-2011 9:21 AM
Hi,
for this example i've used a function wich includes the sending prozes. (conding like above).
In the test example the functions sends a static mail with exactly the same parameters by using cl_bcs.
The function is working fine (test SE37).
The example function also includes a commit work.
If the BAdi and the funktion is called by transaction LSO_PSV1 it works also fine. Calling the BAdI by transaktion PP01 the sending prozess doesn't work! The mail is listet in SOST but the status is 'still no entry in queue'
I've tried a lot of things and found a solution.
The problems seems to be, when the class cl_bcs is called in the same instance it will not work.
So i wrote a report wich calls the function in a new instance.
In the BAdi i call the report with
submit z_sendmail and return.
So it works fine. Even calling the BAdI with transaction PP01.
Last Problem: for the real programm i need the tables from the BAdI.
To use this in the programm i had to write them into the Memory.
I know this is not the best way but it works.
I think the Problem with cl_bcs is a SAP error and i'll make a call to SAP.
Regards,
Reinhard
11-15-2011 9:46 AM
Hello Reinhard,
The problems seems to be, when the class cl_bcs is called in the same instance it will not work.
How did you conclude this? What are the tests you've performed?
Anyway i don't think it is appropriate to issue a COMMIT WORK inside the BAdI, unless you want to interfere with the LUW
Last Problem: for the real programm i need the tables from the BAdI.
To use this in the programm i had to write them into the Memory.
Why don't you create an asynchronous RFC & wrap it around the CL_BCS framework? You can then export the BAdI tables via the RFM interface params & issue the COMMIT WORK in a separate session as well
Let mw know your thoughts.
BR,
Suhas
07-22-2013 5:10 AM
Hi,
We had encountered similar issue. When the BADI gets triggered within the transaction PP01, we had called the method of our custom class which implements the mail-trigger logic using cl_bcs. We got a mail in SOST with the status 'still no entry in queue' .
Had to resolve the issue by using SUBMIT REPORT as suggested by Reinhard.
Its really surprising that the same code works perfectly fine for some transactions while malfunctions for others.
Really appreciate any clarifications regarding the same.
Regards,
Satish