Subject in the mail sent through Batch Job

Hi,
We have a batch job which is running daily.
Consumer wants the output of the batch job (spool request) in mail. We generally send the mail from batch job by filling the mail id in "Title field".. there is some third party involved in managing spool requests..
But now consumer wants to send the mail with a subject line filled..
I could not find any field or option in SM36 where i can fill in the subject..
Please help. Now we are getting the subject as user id + spool request + system number.

Check the below Code.
DATA: NUMBYTES TYPE TST01-DSIZE,
        PDFSPOOLID TYPE TSP01-RQIDENT.
  DATA: BEGIN OF PDFDATA OCCURS 0.
          INCLUDE STRUCTURE TLINE.
  DATA: END OF PDFDATA.
  DATA: G1_LINES_TXT  TYPE I.
  DATA  : L_DOCUMENT_DATA    TYPE SODOCCHGI1,
          T_PACKING_LIST     TYPE STANDARD TABLE OF SOPCKLSTI1,
          W_OBJHEAD TYPE SOLI_TAB,
          T_OBJBIN TYPE STANDARD TABLE OF SOLISTI1,
          T_OBJTXT  TYPE STANDARD TABLE OF SOLISTI1,
          LW_PACKING_LIST    TYPE SOPCKLSTI1,
          L_LINES            TYPE I,
          W_RECEIVER        TYPE SOMLRECI1,
          T_RECEIVER         TYPE STANDARD TABLE OF SOMLRECI1.
  DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.
  DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.
  DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
  DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
  DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.
  DATA: DOC_CHNG LIKE SODOCCHGI1.
  DATA: TAB_LINES LIKE SY-TABIX.
*...Read the Spool request number generated.
  SELECT MAX( RQIDENT ) INTO G_SPOOL_NUM
                        FROM TSP01
                        WHERE RQCLIENT = SY-MANDT AND
                        RQOWNER = SY-UNAME.
*....Convert Spool to PDF
  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      SRC_SPOOLID              = G_SPOOL_NUM
      NO_DIALOG                = 'X'
      DST_DEVICE               = G_PDEST
    IMPORTING
      PDF_BYTECOUNT            = NUMBYTES
    TABLES
      PDF                      = PDFDATA
    EXCEPTIONS
      ERR_NO_ABAP_SPOOLJOB     = 1
      ERR_NO_SPOOLJOB          = 2
      ERR_NO_PERMISSION        = 3
      ERR_CONV_NOT_POSSIBLE    = 4
      ERR_BAD_DESTDEVICE       = 5
      USER_CANCELLED           = 6
      ERR_SPOOLERROR           = 7
      ERR_TEMSEERROR           = 8
      ERR_BTCJOB_OPEN_FAILED   = 9
      ERR_BTCJOB_SUBMIT_FAILED = 10
      ERR_BTCJOB_CLOSE_FAILED  = 11
      OTHERS                   = 12.
*...Convert 132 char to 255 char
  LOOP AT PDFDATA.
    TRANSLATE PDFDATA USING ' ~'.
    CONCATENATE GD_BUFFER PDFDATA INTO GD_BUFFER.
  ENDLOOP.
  TRANSLATE GD_BUFFER USING '~ '.
  DO.
    IT_MESS_ATT = GD_BUFFER.
    APPEND IT_MESS_ATT.
    SHIFT GD_BUFFER LEFT BY 255 PLACES.
    IF GD_BUFFER IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.
Creating the document attachment
  LOOP AT IT_MESS_ATT.
    OBJBIN = IT_MESS_ATT.
    APPEND OBJBIN.
    CLEAR: OBJBIN,
           IT_MESS_ATT.
  ENDLOOP.
Creating the document to be sent
  DOC_CHNG-OBJ_NAME = 'IG Balance'.
*.....Subject of the email.
  CONCATENATE 'Intragroup Confirmation from AoO: ' P_ZAOO INTO DOC_CHNG-OBJ_DESCR.
DOC_CHNG-OBJ_DESCR = 'Intragroup Confirmation from AoO '.
*...Body of the email
  OBJTXT = 'Please find attached a summary and details '.
  APPEND OBJTXT.
  OBJTXT = 'Any queries regarding the attached should be addressed to the contact names on the Report.'.
  APPEND OBJTXT.
  DESCRIBE TABLE OBJTXT LINES TAB_LINES.
  READ TABLE OBJTXT INDEX TAB_LINES.
  DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creating the entry for the compressed document
  CLEAR OBJPACK-TRANSF_BIN.
  OBJPACK-HEAD_START = 1.
  OBJPACK-HEAD_NUM   = 0.
  OBJPACK-BODY_START = 1.
  OBJPACK-BODY_NUM   = TAB_LINES.
  OBJPACK-DOC_TYPE   = 'RAW'.
  APPEND OBJPACK.
  DESCRIBE TABLE OBJBIN LINES TAB_LINES.
  OBJHEAD = 'Balace.PDF'. APPEND OBJHEAD.
Creating the entry for the compressed attachment
  OBJPACK-TRANSF_BIN = 'X'.
  OBJPACK-HEAD_START = 1.
  OBJPACK-HEAD_NUM   = 1.
  OBJPACK-BODY_START = 1.
  OBJPACK-BODY_NUM   = TAB_LINES.
  OBJPACK-DOC_TYPE   = 'PDF'.
  OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
  OBJPACK-OBJ_DESCR = 'Balance Report'.
  OBJPACK-DOC_SIZE   = TAB_LINES * 255.
  APPEND OBJPACK..
Entering names in the distribution list
  DATA: L_CNT TYPE I.
  LOOP AT T_EMAIL INTO W_EMAIL.
    IF W_EMAIL-ZCONTACT1 IS NOT INITIAL.
      RECLIST-RECEIVER = W_EMAIL-ZCONTACT1.
      RECLIST-REC_TYPE = 'U'.
      L_CNT = L_CNT + 1.
    ELSEIF W_EMAIL-ZCONTACT2 IS NOT INITIAL.
      RECLIST-RECEIVER = W_EMAIL-ZCONTACT2.
      RECLIST-REC_TYPE = 'U'.
      L_CNT = L_CNT + 1.
    ENDIF.
    APPEND RECLIST.
    CLEAR: RECLIST,
           W_EMAIL.
  ENDLOOP.
  SELECT SINGLE ZAOO
                 ZCONTACT1
                 ZCONTACT2 FROM ZFI_MT_RPTRMAP INTO W_EMAIL
                 WHERE ZAOO EQ P_ZAOO.
  IF W_EMAIL-ZCONTACT1 IS NOT INITIAL.
    RECLIST-RECEIVER = W_EMAIL-ZCONTACT1.
    RECLIST-REC_TYPE = 'U'.
    L_CNT = L_CNT + 1.
    APPEND RECLIST.
  ELSEIF W_EMAIL-ZCONTACT2 IS NOT INITIAL.
    RECLIST-RECEIVER = W_EMAIL-ZCONTACT2.
    RECLIST-REC_TYPE = 'U'.
    L_CNT = L_CNT + 1.
    APPEND RECLIST.
  ENDIF.
Sending the document
  IF L_CNT > 0.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = OBJPACK
        OBJECT_HEADER              = OBJHEAD
        CONTENTS_BIN               = OBJBIN
        CONTENTS_TXT               = OBJTXT
        RECEIVERS                  = RECLIST
      EXCEPTIONS
        TOO_MANY_RECEIVERS         = 1
        DOCUMENT_NOT_SENT          = 2
        OPERATION_NO_AUTHORIZATION = 4
        OTHERS                     = 99.
    CASE SY-SUBRC.
      WHEN 0.
        WRITE 'Email sent successfully'.
      WHEN 1.
        WRITE: / 'no authorization to send to the specified number of recipients!'.
      WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
      WHEN 4.
        WRITE: / 'no authorization to send !'.
      WHEN OTHERS.
        WRITE: / 'error occurred during sending !'.
    ENDCASE.
  ELSE.
    MESSAGE S000 WITH TEXT-018.
    STOP.
  ENDIF.
*...Delete Spool Request.
  DATA: SPOOLID TYPE TSP01_SP0R-RQID_CHAR.
  SPOOLID = G_SPOOL_NUM.
  CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
    EXPORTING
      SPOOLID             = SPOOLID
  IMPORTING
    RC                  =
    STATUS              =
    ERROR_MESSAGE       =

Similar Messages

  • Invoice not generated through Batch Job

    Hello
    I am facing a Problem in Batch Job. When the delivery is created through VL01n transaction manually, the Invoice for this delivery is created automatically. However for one of the delivery the Invoice was not created automatically through Batch Job.
    Can some one help me how to go further on this problem? I have checked the Batch Job and found that it is schedule daily, However the Delviery was created after this schedule time. So ideally this delivery should have been considered for automatic generation of Invoice in the next schedule run of the Batch Job. However this has not happened.
    Any views on this
    Regards
    Screams

    Hello,
    Please check the billing date and the billing date which is in the variant. in the variant there could be that the billing date might have been specified from and to, in any case billing date for the document is not past the variant billing date it will pick up.

  • Yahoo mail sent through Mail app do not appear when login into Yahoo mail

    Hi everybody,
    I have a problem that annoying me very much. I've used Yahoomail for very long before I bought a MBA. For the first time I use Mac OSX, I try to use Mac mail combine with my old Yahoo mail. Actually, I have done the config. But anything I do with my Yahoo mail through Mail app can't appear when I login into original Yahoo mail. For example: I sent a Yahoo mail through Mac mail, it's shown that the mail was sent sucessfully, but when I try to login into Yahoo mail on Web, the sent mail doesn't exist. And the same happen when I do the opposite: the mail I sent on Yahoo mail doesn't exist on Mac mail. It's a big trouble if I use other lap and try to contact with someone. So is there any solution can fix it?
    Many thanks

    I'm having the same problem, and the only help I ever seem to find suggested anywhere is "make sure its set up as an IMAP account"
    BUT it is! Mail automaticly sets all yahoo accounts up as IMAP. So is this just a yahoo problem? Is there anyway to fix this?
    For me the bigger issue isnt that I need to be able to check my e-mail through a web browser regulerly, but on my Iphone and Ipad the account, which is through the mail app, also dosnt show sent mail sent through the mac app.
    I agree this makes mail on my mac totally usless.

  • ACH RUN F110 THROUGH BATCH JOB

    Hello,
    Is there a way, we can run the ACH Incoming Payment (Customers) through a scheduled batch job for the TCode F110?
    I've configured the Incoming and Outgoing Payments successfully and I've been struggling with automating the Payment Run for the Incoming Payment(Customers). We're planning to keep running the Payable (Vendors) manually through F110.
    Thanks in advance
    Salman

    Hello Nitin,
    It is working but now I am able to either create proposal through batch job or I can do payment run through the job.
    Is there a way I could do a payment proposal and payment run through same job or through two jobs?
    Thank You
    Salman

  • ABAP query to schedule through batch job

    Hi
    i have requirement to schedule batch job for ABAP query report and download the report data to local drive throuh batch job.
    we have created ABAP query report, and this report should run through batch job and download the report data to local drive,,
    please help, how we can solve this.
    Regards
    Vanraj

    Hi Vanraj,
    I have two topics to talk about:
    1st: in order to schedule a background job, try to do the following:
      - Go to transaction SQ01 and select your query
      - Check that you've already created a variant, containing the required selection data.
      - Instead of running in online, go to "Query > Execute > Exec.in background"
      - This will allow you to schedule the background job.
    2nd: it is NOT possible for a background job to download a file to a local PC.
    I hope it helps.
    Kind regards,
    Alvaro

  • Smartform Printing through Batch Job

    Hi
    Please help in the following issue :
    We have a report thourgh which say 10 pages needs to be printed.
    On eachpage we have page numbers like 1 of 10, 2 of 10 etc. and on the last page 10 of 10 will be printed.
    when the report is executed in foreground, the rints are perfect s expected. But when the same report is executed through Batch Job, the pages are being printed as 1 of &&, 2 of && etc, when it come to last page the print is 10 of 10.
    So, thr Batch job the last page of the print is OK, except all other pages, the issue is only printing this page nos.
    Please advise.
    Regards
    Shankar

    hi ,
    make sure that u declared that page no printing window as final window.try it.
    Regards,
    karthikeyan k s,

  • How to add subject in the mail while choosing option i.e. "Send a copy of the entire PDF file as an

    I need to update the subject in the mail while choosing option i.e. "Send a copy of the entire PDF file as an attachment"?
    How I can add my own subject in the mail while attaching pdf file, currently it shows as "do" subject name which is default every time?

    the normal FILE FTP adapter will do or do we have to use any special Adapter
    File adapter with a bit of modification will do. See this
    XI: Read data from PDF file in Sender Adapter
    Once ur pdf is converted to xml, u can use the java or xsl mapping to map the comlpete xml structure into one field
    The specified item was not found.
    Regards,
    Prateek

  • How to get subject of the Mail greator than 50 characters length

    Hi Friends,
    I am sending a mail by using the Class Interface cl_document_bcs and method create_document
    there the Parameter i_subject is of 50 characters length
    but the client need the subject of the mail nearly 100 chars lenght
    Please guide me how to go furthur
    are there any other Methods to go furthur to have subject of the mail greator than 50 characters lenght
    Thanks in Advance
    Ganesh

    Hi Ravi,
    could you plz help me how to set that subject... (len > 50 char )
    my previous code is
    TRY.
        gwa_sendreq = cl_bcs=>create_persistent( ).
        gwa_document = cl_document_bcs=>create_document(  i_type    = gc_htm
                                                          i_text    = gt_mail
                                                          i_subject = gwa_subject ).
       gwa_subject1  = 'Material Arrival (GIN No:12566) notification Against PO 26735 (To be Inspected)'.
       gwa_sendreq = cl_bcs=>set_message_subject( ip_subject = gwa_subject1 ).
        CALL method GWA_SENDREQ->SET_DOCUMENT( gwa_document ).
        gwa_sender = cl_sapuser_bcs=>create( sy-uname ).
        CALL METHOD gwa_sendreq->set_sender
          EXPORTING
            i_sender = gwa_sender.
        gwa_recipient = cl_cam_address_bcs=>create_internet_address( gv_mail_id ).
        CALL METHOD gwa_sendreq->add_recipient
          EXPORTING
            i_recipient = gwa_recipient
            i_express   = ' '.
        gwa_sendreq->set_send_immediately( gc_x ).
        CALL METHOD gwa_sendreq->send(
          EXPORTING
            i_with_error_screen = 'X'
          RECEIVING
            result              = gwa_sent_status ).
        IF gwa_sent_status <> 'X'.
        ENDIF.
      CATCH cx_bcs INTO gwa_bcs_exception.
    ENDTRY.
    COMMIT WORK.

  • Report to be sent to a list of recipients in an e:mail (part of batch job)

    Hi,
    I need to generate a report using ALV functionality.
    Currently my report requirement is to sent to a list of recipients in an e:mail (part of the batch job set-up) and the recipients just download the report in a spreadsheet format. 
    Could you please give me the suggestions the way which I need to follow and how I will be able to set this report as a part of batch job which will send the report details to the users in the form of Email.
    Points will be rewarded for the answers.
    Regards,
    Ravi Ganji

    Hi,
    IN SM36..You will see a button for "Spool list recipient" which is next to the target server button..
    press that button..
    Give the email address in the recipient field..
    GIve the steps and start condition and then release the job..
    THanks,
    Naren

  • Change subject line of Email sent through "spool recipient functionality".

    A batch job creates a spool, which is send through Email using spool recipient functionality. The subject line of the Email is as follows
    "Job<job name>, Step <step no.>".
    Is it possible to change the subject line of the Email?
    Any pointers on this would be highly appreciated.

    check the program name for job.
    If the program is Custom program(starting with Z or Y)  then you can easily change subject line of email.
    If it is standard program then we have to look for alter path.
    Edited by: subas  Bose on Feb 18, 2010 6:54 PM
    Edited by: subas  Bose on Feb 18, 2010 6:55 PM

  • Alter subject line in mail sent to candidate.

    Hi all,
      i have a requirement in sap e-recruitment to customise the  smartform  for acknowledging candidate application.
    i am using HRRCF_CS_IT_APPL_INVITATION as the reference  for my custom form.
    This smartform is sent to the candidate via email. The subject line is automatically picked up from the Smartform ->formattribute-> meaning field.   teh problem is that this  field is restricted to 30 characters only.
    Is there an enhancement or a note available through which i can alter the subject line(have a longer subject line)  of the mail?
    my system details are : sap ECC 6.0   E-recruit release 604   level 004  highest support SAPK-60404INERECRUIT
    Thanks.

    Hi,
    many customers want to change the standard subject creation. The implemented logic to get the email subject from the smartform is just not practical as it is not only too short but also smartforms are described in a way the recruiters and devlopers like for easy handling e.g. "rejection - candidate blacklisted" and you probably do not want this to be the mailheader the candidate reads :o).
    The easiest way to change the subject is enhancing the method set_subject of class CL_HRRCF_CS_DOC_CAT_SF_SUPER. I usually place an implicit enhancement at the methods end and add the coding I need, so it overwrites the standard processings. In simple cases customers use a fixed but language dependent subject like "Your application at company xyz". But you can also put more complex stuff there by using the activity member attribute to get activity types or navigate to read requisition data.
    Kind regards
    Roman

  • Two Deliveries did not go through Batch Job Runing

    Hi,
    In this company every evening the automatic batch Job for Billing due list is run but on Nov 23 one Deliver and on Nov 30 another delivery has not gone through i.e. the invoices were not created for these two deliveries.
    I checked in VF01, the individual invoice is being created. The user is asking the reason for this and how to prevent this type of situation in future.
    I don't know the Batch Job number and I think it has been done in VF06.
    Please guide me how I can solve this issue.
    Thanks,
    Jans

    Hello Tushar,
    Thank you for your reply. I don't know the Variant name also and I don't know the Batch Job number eirther. The user is not aware of these things. I tried to find out from VF06 but I could not figure out anything.
    Please explain me your sentece "Execute billing program in foreground and check". you mean to say after creating the same scenario in the quality, I will run the Billing program ( I will take the Billing program from the VF01). If I am correct please let me know.
    Regarding debugging,  if I have to do how I can do it. I know to go to Debuggiing mode if I put in the command field  "/h" , I will be in the debugging mode. But my question is which transaction Should I use VL02N or VF01 to find out the Problem
    I have mentioned earlier that I went to VF01 and these deliveries are fine to create invoices but the User is interested to know the Problem and to find out the cause so that they can prevent it occuring in future.
    Thanks,
    Jans

  • Reg: Error in Mail sending through background job in SCOT

    Hello experts,
    I am trying to schedule a background job through SCOT so as to send the mails present in SOST.
    The job is running but it is giving error as "Invalid status  for recipient" in SOST.
    But when I am sending it directly from SOST it is delivered without any errors. The email address is maintained correctly and SMTP settings are also correct as while sending it directly from SOST it reaches the required recipient without any error.
    This error is observed only through background job. I am using program RSCONN01 with variant SAP&CONNECTINT in background job.
    Kindly suggest why I am getting the error "Invalid status  for recipient" in background job.
    Thanks & Regards
    Meraz
    +91 8894522860

    I am getting the exact same issue.
    were you able to fix this in the last 3 weeks?
    thanks.

  • Email Address not visible for output device MAIL in created batch job

    Issue in ECC6.0: Email Address not visible to display/change for output device MAIL in print parameter of each step in the created batch job.
    User wants to periodically receive report file via send to his email, so I create the batch job running report and send the report in pdf file to his email.
    Detail in the batch job
    1) In print parameter screen of the step in the batch job
       -Using output device MAIL (output type ZPDF1)
       -inputting email address of receiver in the EMAIL ADDRESS field
    2) After the batch job was saved, I tried to display/change the field EMAIL ADDRESS via Tx. SM37, but this field is invisible. The field can not be displayed or changed anymore. I also tried in SM36, but it is for creating new batch job, not changing the existing batch job.
    4) User receives email with pdf file from the batch job.
    How to change/display the email address of the receiver in the created batch job?
    Note that we just changed to use SAP ECC6 from SAP 4.6c. In SAP 4.6c, we can change/display the
    Email Address Field via Tx. SM37.
    Pls kindly suggest, thank you very much in advance.

    Hi Srirompoti,
    After saving the job if the job has not started then you can follow the below steps to change the Email address.
    1. View the job from Txn SM37.
    2. check the check box for your job that you want to change and goto menu path "Job->change
    3. in the next screen goto "Edit->steps." or press "F6" key
    4. place the coursor on the job and goto menu path "Step->change->print specifications.
    5. here you can change the email address.
    If you are not able change the data then you might not have authorization.

  • How to trigger the mail sent notification back to the sender

    Hi Gurus,
    At present in our system  we are sending the PO through email to the vendor using std output type  NEU. This is being done using the FM CONVERT_OTF_AND_MAIL, this functionality workes fine.
    along with this mail the sender or the PO owner will get a mail to his outlook or any internet email address saying 'Your message was successfully relayed ' and that will be sent by the mail id Postmaster_at the rate of_ mail.relay-company.com.
    Our requirement is to send  the above success mail to the PO owner SAP inbox and not to the internet address.
    basically we are not able to track how this success mail is geting triggered and also how or where the email address Postmaster-_at the rate of_mail.relay-company.com.is maintained.
    can any one help in this,
    Thanks in advance for your inputs.
    Venkatesh.

    Hi,
    canany one give me some inputs on this.
    venkatesh.

Maybe you are looking for

  • How to set the screen size with nested Iview screen

    Can someone show me how to set the screen size with nested IView  screen. at the moment i only try it with trial and error untill it looks somewhat close. Is there a property in VC to set the size for Height and width. The same question is for the fo

  • How can i edit function of function keys ?

    I just want to assign a function to my function key. For Eg:  by default f6- is assign to mute audio,  f3-is assign to increase screen brightness but f5 doesn't have any function , so i would like to assign a funtion to it, like when i press f5 my sc

  • Reg: lot size and replenishment lead time

    1. please explain about lot size and replenishment lead time. 2. please also explain about consumption based planing and in steps explain how to perform manual and automatic reorder point(transc code please)

  • BTCare or BTCouldNotCareLess?

    Hello All I arranged a home move last year for a move in date of 20th Dec 2013. Still waiting for a working line to be installed in my new house which is only 50 metres from my old house. I, like many, have had an absolute nightmare of endless delays

  • Change my Last name

    I need to change my last name on my account to my married last name. Is there a way to do this online? Help!