Trigger Mail on Assigned JOB in Workflow

Hi,
I have to send mail to specified JOB (option in drop down of Recipient Type) in Workflow, but its not working though WF is not showing any error (showing success)  but user is not getting mail. I have changed it to Hard-Code user Name then user is receiving mail.. Please assist how I can send mail to assigned JOB defined...
I have check in Table HRP1001 - w.r.t to JOB - ID, I can see record with SUBTY - 007 & user name in field - UNAME
Thanks & Regards,
Rajesh

Hi,
I think it should work, because a job as recipient type should somewhere in the background select all of the possible agents.
Check OSS to see if this is acknowledged by SAP.
If it is not possible at all, I would create a simple custom method which uses a function module to retrieve the agents.
I think RH_STRUC_GET can be used along with an appropriate evaluation path (check transaction PPSS to find usefull evalution paths or create your own in OOAW)
Kind regards, Rob Dielemans

Similar Messages

  • Trigger mail when backgroung job is cancel

    Hi,
    I want to trigger a mail to outlook when background job in sap gets cancel
    Regards
    Gopal

    Hi Gopal
    Have u read through [This|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/97d2e8b3-0b01-0010-b787-b8ce558a51c2] document?

  • How to trigger a mail once BG job finished.

    Hi,
    Could anyone please let me know how to trigger a mail once Background job finished. I let you give one scenario where exactly I require this concept. Say, I execute t.code MB52 with particular variants in background to find stuck qty(s) of material(s) in given site(s).Now I want that system will trigger a mail to concern team once job finished.
    Thanks,
    AK

    You can try using workflow transaction SBWP.
    you need to create a distibution list in the above transaction and add the requested mail ids to it.
    then when you create a jon using transaction SM37 you have the option SPOOL LIST RECIPIENT where you can add the created distibution list
    so when ever the job has run sucessfully then a mail is sent to all the mail id's in the list.
    hope this helps.
    cheers
    sundeep

  • Trigger mail for cancelled background jobs scheduled using SM37

    Dear Experts,
    My requirement is to trigger email whenever a job gets cancelled in background.
    For this I have already tried creating a workflow using BO BPJOB for event ABORTED.
    But for some reason the event is never getting triggered.
    I tested executing the workflow from tcode SWDD, it was running successfully, which means that there is no issue with my workflow.
    Now I want to resolve the above issue   OR
    I want to raise the event manually from the program through some BADI or Exit.
    But I didn't find any BADI or Exit for tcode SM37. Can anybody let me know if any.

    Hi,
    Please refer the below links.
    Workflow- Background job fail
    Re: Send mail when job fails
    Regards
    GK.
    Moderator message: please do not post just links without any further explanations.
    Edited by: Thomas Zloch on Sep 20, 2010 11:53 AM

  • Mail trigger for Task assigned in collaboration room

    Hi,
    When a task is assigned to an user, mail does not get triggered to the assignee, but triggers to only tracker.
    Is it possible to trigger mail for the assignee to?. Also is there any way to set alert mail for the tasks both for assignee and tracker?
    Regards,
    Sasikala

    Hi,
    I have similar requirement like this,
    In Restricted Room, User A request membership, After this owner get the notification mail for that request.
    is possible to send notification to User A by mail or in UWL notification?. how can we achieve this?
    Request Membership for Restricted Room is calling the below mentioned class,
    Name : RoomRequestMembershipCommand
    Value : com.sap.netweaver.coll.roomui.api.uicommands.UIRequestMembershipCommand (Class)
    From this class, i didnt understand how the mail (where the action is occuring) sends to the Room Owner.
    Room Owner getting the member request notification through mail, but Owner have to get the notification in Collaboration My tasks instead of getting notification through mail.  how can i achieve this?
    Thanks and Regards,
    Senthil

  • Trigger mail(sending mail to respective person)when budget is release in PS

    Dear Sir,
    I want to trigger mail ( sending mail to respective person ) when budget is release in PS.
    Please help for following :
    Option 1 : User exit
    Option 2: Workflow.
    Regards
    Vinu

    Hi Vinod,
    You can acheive this using a Workflow. What you need to do is set an user status as Rbud-release budget, and when ever you project is set to this status a workflow will trigger to the concerned aggest assigned to workflow task. Here you can provide a user decision as 1. Approve 2. Reject. When ever workflow triggers, approver can see in his inbox the project budget in Cj30 by clicking object link to cj30 and if he feels it is ok then he can click Approve button this will take him to CJ32 screen where he can release the budget. IF the user feels Budget need to be revised then he will click reject this will send an email to the person responsible to revise the budget and at the same time user status will be reset back to previous user status.
    The above  method we have adapted for one of our client. This is done by a workflow consultant.
    Thanks
    regards
    kishore

  • How to send mail to external email within workflow

    Hi Expert,
    I know this question has been questioned before in the forum but that is quite different from what i want. After researching in this forum i found out that forwarding was the way to move the inbox into the external mail (using scheduled job) but what i want is to include send mail activity within the workflow that directly send email into the external email ( so no scheduled job). The logic is perhaps:
    1. get the email address
    2. use send mail activity
    3. Assign the element defined to E-Mail Address.
    4. send the email.
    But I'm unable to retrieve the email address, store it and pass it into the email (as element). Can somebody help me with this?
    Many Thanks.

    Use the below code(rule(fm)), hope it works for you.
    I have placed the SAP user id's in custom table & inserted e-mailid's to them in su01.
    FUNCTION ZMANI_GET_PLANNER.
    *"*"Local Interface:
    *"  TABLES
    *"      AC_CONTAINER STRUCTURE  SWCONT OPTIONAL
    *"      ACTOR_TAB STRUCTURE  SWHACTOR
    *"  EXCEPTIONS
    *"      NOBODY_FOUND
      INCLUDE <cntn01>.
      TYPES : BEGIN OF ty_users.
              INCLUDE STRUCTURE ZMANI_AGENT_MAST.
      TYPES : END OF ty_users.
      DATA: org_agent LIKE wfsyst-agent,
            lt_holders TYPE STANDARD TABLE OF swhactor,
            lwa_holders TYPE swhactor,
    *        lt_users TYPE STANDARD TABLE OF ty_users,
            lwa_users TYPE ty_users,
            v_len TYPE i,
    *        v_bname LIKE ztest_users-bname,
            num_lines TYPE i.
    ** Read values assigned to the rule criteria
      swc_get_element ac_container 'org_agent' org_agent.
    * Get the superior
      SELECT SINGLE *
        FROM ZMANI_AGENT_MAST
        INTO CORRESPONDING FIELDS OF lwa_users
       WHERE MMC = 'Y'.
      IF NOT lwa_users IS INITIAL.
        REFRESH lt_holders[].
        lwa_holders-otype = 'US'.
        lwa_holders-objid = lwa_users-BNAME.
        APPEND lwa_holders TO lt_holders.
        APPEND LINES OF lt_holders TO actor_tab.
      ENDIF.
      DESCRIBE TABLE actor_tab LINES num_lines.
      IF num_lines IS INITIAL.
        RAISE nobody_found.
      ENDIF.
    ENDFUNCTION.

  • Added custom date fields at contract;need to trigger mail using those dates

    Hi,
    II have added 14 custom fields in the service order quotation for handling waranty start date and end dates capturing for the maximum of 7 years contract.
    Then its usual yearly action of the waranty team to put the dates in those fields.
    The first set of 2 input fields will be filled at the quotation creation itself; rest the set of 12 fields will be updated in this 7 years time.
    My requirement is such that to the capture all the waranty end dates filled in the input fields and trigger a mail 30 days prior to that days.
    Example : I have contract from 01/08/2004 to 31/07/2010.
    Then my waranty startdate / end date can be filled by waranty team as 01/08/2004 to 31/07/2005 in the waranty first year.the i need to trigger a mail to waranty team on 01/07/2005.
    For the second year if we have dates filled as 01/08/2005 to 31/07/2006; then to trigger mail on 01/07/2006.
    I have tried using ACTIONS but couldn't get much help.
    As a work around thinking for a report to fetch the contract for that Trans.type and check the dates with the present date + 30 and collect those to perfrom the respective actions.This is workaround.
    Tried using the DATE TYPES creating 7 different DATE TYPES and assigning the ( end dates - 30 ) to that manually upon save.
    and using this DATE TYPE along with the action definition can we acheive ?  but it too will be work around.
    How to acheive this one. It became critical now in the project. 
    Thanks and Regards,
    Satish Akkina

    Hi,
    In your scenario, you don't need synchronous email facility.
    Probably you can create a z table and maintain all required dates in this table (before saving your transaction somewhere you would have to read your custom fields and save them in this table along with object ID/GUID). Then create a report that would read dates from z table and then send emails to your warranty team. Schedule this report in background with frequency of once day.
    Hope that helps.
    Regards,
    BJ

  • E-Mail for background Job

    Hi All,
    We need to schedule a Job in background in every 30 min or 1 hr, which will monitor all the other Jobs running in background.
    If any job is running more than 30000 sec, it should trigger an email.
    Please guide me how to achieve this( i'm ABAPer).
    Regards
    VEnk@

    see the following t.code may be it will use
    SWWCLEAR_INSERT
    Workflow: Background Job 'SWWCLEAR';
    Workflow: Hintergrundjob 'SWWCLEAR';
    Workflow : job arr.-plan 'SWWCLEAR';
    Workflow: achtergrondjob 'SWWCLEAR'
    Workflow: Background Job 'SWWCLEAR'
    SWWCOND_INSERT
    Workflow: Background Job 'SWWCOND';
    Workflow: Batchjob 'SWWCOND';
    Workflow : job batch 'SWWCOND';
    Workflow: achtergrondjob 'SWWCOND'
    Workflow: Background Job 'SWWCOND'
    SWWD
    Maintain Work Item Error Monitoring;
    Workitem-Fehlerüberwachung pflegen;
    Gérer surveillance erreurs WI;
    Workitem-foutbewaking verzorgen
    Maintain Work Item Error Monitoring
    Edited by: Krupaji on Feb 17, 2010 12:45 PM

  • How to use RCIEV feature to trigger mail to a particular mail id in M0001

    Hi,
    I'm trying to trigger mail for any marital status change in personal data infotype for employee through dynamic action. Kindly help me in using RCIEV feature in M001 feature in detail for triggering mail to a manager other than administrator.
    Thanks,
    Kalai.

    Check this documentation.
    RCIEV  Defining a Distribution List or Mail Address
       you can define a feature that sets the parameters for a
        mail to be sent when changes are made to an infotype record. In the
        standard system, this involves feature M0001. You can also specify a
        feature within this feature to determine possible recipients of the mail
        according to the control values in the organizational assignment.
      Use
        Mail connection for master data infotype changes for employees and
        applicants.
      Procedure
        The return matrix of the feature has the following structure: X-VVVVVVVV
        with the following meanings:
        o   X - Indicator 'M' for mail or 'V' for distribution lists
        o   VVVVVVVV - Valid mailing name or distribution list, which is stored
                       in a shared folder in SAPoffice (transaction so04).
      See also
        Feature TEXT1

  • Trigger mail

    Hello experts,
    i want to trigger mail with the output of the report, means as the report gets executed i want to trigger mail with the displayed output....
    sample code highly appreciated...............

    Hello,
    Check this sample report.This report will be very useful for your requirement
    REPORT ZV_JOB_READ NO STANDARD PAGE HEADING LINE-SIZE 255..
    TABLES: TSP01.
    DATA: SV_ADR TYPE SOMLRECI1-RECEIVER.
    SELECT-OPTIONS : P_EMAIL1 FOR SV_ADR NO INTERVALS.
    *DEFAULT '[email protected]',
    PARAMETERS: P_SENDER LIKE SOMLRECI1-RECEIVER,
    *DEFAULT '[email protected]',
                P_REPID LIKE SY-REPID, " Report to execute
                P_LINSZ LIKE SY-LINSZ DEFAULT 132, " Line size
                P_PAART LIKE SY-PAART DEFAULT 'X_65_132', " Paper Format
                P_SLSET LIKE SY-SLSET, "Variant name
                P_ODESCR LIKE SODOCCHGI1-OBJ_DESCR,
                P_ADESCR TYPE SO_OBJ_NAM,
                P_DELSPL AS CHECKBOX.
    *DATA DECLARATION
    DATA: GD_RECSIZE TYPE I.
    * Spool IDs
    TYPES: BEGIN OF T_TBTCP.
            INCLUDE STRUCTURE TBTCP.
    TYPES: END OF T_TBTCP.
    DATA: IT_TBTCP TYPE STANDARD TABLE OF T_TBTCP INITIAL SIZE 0,
          WA_TBTCP TYPE T_TBTCP.
    * Job Runtime Parameters
    DATA: GD_EVENTID LIKE TBTCM-EVENTID,
          GD_EVENTPARM LIKE TBTCM-EVENTPARM,
          GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
          GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
          GD_JOBNAME LIKE TBTCM-JOBNAME,
          GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
          GD_ERROR TYPE SY-SUBRC,
          GD_RECIEVER TYPE SY-SUBRC.
    DATA: W_RECSIZE TYPE I,
          MC_VALID(1) TYPE C.
    DATA: GD_SUBJECT LIKE SODOCCHGI1-OBJ_DESCR,
          IT_MESS_BOD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
          IT_MESS_ATT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
          GD_SENDER_TYPE LIKE SOEXTRECI1-ADR_TYP,
          GD_ATTACHMENT_DESC TYPE SO_OBJ_NAM,
          GD_ATTACHMENT_NAME TYPE SO_OBJ_DES,
          MI_RQIDENT LIKE TSP01-RQIDENT.
    * Spool to PDF conversions
    DATA: GD_SPOOL_NR LIKE TSP01-RQIDENT,
          W_SPOOL_NR LIKE TSP01-RQIDENT,
          GD_DESTINATION LIKE RLGRAP-FILENAME,
          GD_BYTECOUNT LIKE TST01-DSIZE,
          GD_BUFFER TYPE STRING.
    DATA: MSTR_PRINT_PARMS LIKE PRI_PARAMS.
    * Binary store for PDF
    DATA: BEGIN OF IT_PDF_OUTPUT OCCURS 0.
            INCLUDE STRUCTURE TLINE.
    DATA: END OF IT_PDF_OUTPUT.
    CONSTANTS: C_DEV LIKE SY-SYSID VALUE 'DEV',
               C_NO(1) TYPE C VALUE ' ',
               C_DEVICE(4) TYPE C VALUE 'LOCL'.
    START-OF-SELECTION.
    * Write statement to represent report output. Spool request is created
    * if write statement is executed in background. This could also be an
    * ALV grid which would be converted to PDF without any extra effort
    *** Alternative way could be to submit another program and store spool
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
            AUTHORITY = SPACE
            COPIES = '1'
            COVER_PAGE = SPACE
            DATA_SET = SPACE
            DEPARTMENT = SPACE
            DESTINATION = SPACE
            EXPIRATION = '1'
            IMMEDIATELY = SPACE
    *       in_archive_parameters = space
    *       in_parameters = space
            LAYOUT = SPACE
            MODE = SPACE
            NEW_LIST_ID = 'X'
            NO_DIALOG = 'X'
            USER = SY-UNAME
      IMPORTING
            OUT_PARAMETERS = MSTR_PRINT_PARMS
            VALID = MC_VALID
      EXCEPTIONS
            ARCHIVE_INFO_NOT_FOUND = 1
            INVALID_PRINT_PARAMS = 2
            INVALID_ARCHIVE_PARAMS = 3
            OTHERS = 4.
      IF MSTR_PRINT_PARMS-PDEST = SPACE.
        MSTR_PRINT_PARMS-PDEST = 'LOCL'.
      ENDIF.
      MSTR_PRINT_PARMS-LINSZ = P_LINSZ.
      MSTR_PRINT_PARMS-PAART = P_PAART.
      SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                          SPOOL PARAMETERS MSTR_PRINT_PARMS
                          USING SELECTION-SET P_SLSET
                          AND RETURN.
    * Get spool id from program called above
      PERFORM GET_SPOOL_NUMBER USING SY-REPID SY-UNAME CHANGING MI_RQIDENT.
    * IMPORT w_spool_nr FROM MEMORY ID SY-REPID.
      PERFORM CONVERT_SPOOL_TO_PDF.
      PERFORM PROCESS_EMAIL.
      IF P_DELSPL EQ 'X'.
        PERFORM DELETE_SPOOL.
      ENDIF.
      IF SY-SYSID = C_DEV.
        WAIT UP TO 5 SECONDS.
        SUBMIT RSCONN01 WITH MODE = 'INT'
        WITH OUTPUT = 'X'
        AND RETURN.
      ENDIF.
    * FORM obtain_spool_id *
    FORM OBTAIN_SPOOL_ID.
      CHECK NOT ( GD_JOBNAME IS INITIAL ).
      CHECK NOT ( GD_JOBCOUNT IS INITIAL ).
      SELECT * FROM TBTCP INTO TABLE IT_TBTCP
                                  WHERE JOBNAME = GD_JOBNAME
                                  AND JOBCOUNT = GD_JOBCOUNT
                                  AND STEPCOUNT = GD_STEPCOUNT
                                  AND LISTIDENT <> '0000000000'
                                  ORDER BY JOBNAME
                                  JOBCOUNT
                                  STEPCOUNT.
      READ TABLE IT_TBTCP INTO WA_TBTCP INDEX 1.
      IF SY-SUBRC = 0.
        MESSAGE S004(ZDD) WITH GD_SPOOL_NR.
        GD_SPOOL_NR = WA_TBTCP-LISTIDENT.
        MESSAGE S004(ZDD) WITH GD_SPOOL_NR.
      ELSE.
        MESSAGE S005(ZDD).
      ENDIF.
    ENDFORM. "OBTAIN_SPOOL_ID
    * FORM get_job_details *
    FORM GET_JOB_DETAILS.
    * Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                EVENTID                 = GD_EVENTID
                EVENTPARM               = GD_EVENTPARM
                EXTERNAL_PROGRAM_ACTIVE = GD_EXTERNAL_PROGRAM_ACTIVE
                JOBCOUNT                = GD_JOBCOUNT
                JOBNAME                 = GD_JOBNAME
                STEPCOUNT               = GD_STEPCOUNT
           EXCEPTIONS
                NO_RUNTIME_INFO         = 1
                OTHERS                  = 2.
    ENDFORM. "GET_JOB_DETAILS
    * FORM convert_spool_to_pdf *
    FORM CONVERT_SPOOL_TO_PDF.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                SRC_SPOOLID              = MI_RQIDENT
                NO_DIALOG                = C_NO
                DST_DEVICE               = C_DEVICE
           IMPORTING
                PDF_BYTECOUNT            = GD_BYTECOUNT
           TABLES
                PDF                      = IT_PDF_OUTPUT
           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.
      CHECK SY-SUBRC = 0.
    * Transfer the 132-long strings to 255-long strings
      LOOP AT IT_PDF_OUTPUT.
        TRANSLATE IT_PDF_OUTPUT USING ' ~'.
        CONCATENATE GD_BUFFER IT_PDF_OUTPUT 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.
    ENDFORM. "CONVERT_SPOOL_TO_PDF
    * FORM process_email *
    FORM PROCESS_EMAIL.
      DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
      CHECK GD_RECSIZE > 0.
      LOOP AT P_EMAIL1.
        PERFORM SEND_EMAIL USING P_EMAIL1-LOW.
      ENDLOOP.
    * perform send_email using p_email2.
    ENDFORM. "PROCESS_EMAIL
    * FORM send_email *
    * --> p_email *
    FORM SEND_EMAIL USING P_EMAIL.
      CHECK NOT ( P_EMAIL IS INITIAL ).
      REFRESH IT_MESS_BOD.
    * Default subject matter
      GD_SUBJECT = P_ODESCR.
      GD_ATTACHMENT_DESC = P_ADESCR.
    * CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      IT_MESS_BOD = TEXT-001." 'This is an automated report from SAP.'.
      APPEND IT_MESS_BOD.
      IT_MESS_BOD = TEXT-002. " 'Please do not reply to this mail id.'.
      APPEND IT_MESS_BOD.
      IF P_SENDER EQ SPACE.
        GD_SENDER_TYPE = SPACE.
      ELSE.
        GD_SENDER_TYPE = 'INT'.
      ENDIF.
    * Send file by email as .xls speadsheet
      PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
                                    TABLES IT_MESS_BOD
                                    IT_MESS_ATT
                                    USING P_EMAIL
                                    P_ODESCR
                                    'PDF'
                                    GD_ATTACHMENT_NAME
                                    GD_ATTACHMENT_DESC
                                    P_SENDER
                                    GD_SENDER_TYPE
                                    CHANGING GD_ERROR
                                    GD_RECIEVER.
    ENDFORM. "SEND_EMAIL
    * FORM delete_spool *
    FORM DELETE_SPOOL.
      DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
      LD_SPOOL_NR = GD_SPOOL_NR.
      CHECK P_DELSPL <> C_NO.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                SPOOLID = LD_SPOOL_NR.
    ENDFORM. "DELETE_SPOOL
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    * Send email
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES IT_MESSAGE
                                              IT_ATTACH
                                              USING P_EMAIL
                                              P_MTITLE
                                              P_FORMAT
                                              P_FILENAME
                                              P_ATTDESCRIPTION
                                              P_SENDER_ADDRESS
                                              P_SENDER_ADDRES_TYPE
                                              CHANGING P_ERROR
                                              P_RECIEVER.
      DATA: LD_ERROR TYPE SY-SUBRC,
      LD_RECIEVER TYPE SY-SUBRC,
      LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
      LD_EMAIL LIKE SOMLRECI1-RECEIVER,
      LD_FORMAT TYPE SO_OBJ_TP ,
      LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
      LD_ATTFILENAME TYPE SO_OBJ_DES ,
      LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
      LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
      LD_RECEIVER LIKE SY-SUBRC.
      DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
      T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
      T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
      T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
      T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
      W_CNT TYPE I,
      W_SENT_ALL(1) TYPE C,
      W_DOC_DATA LIKE SODOCCHGI1.
      LD_EMAIL = P_EMAIL.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT = P_FORMAT.
      LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
      LD_ATTFILENAME = P_FILENAME.
      LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    * Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    * Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    * Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
      ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = IT_ATTACH[].
    * Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    * Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    * Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      T_RECEIVERS-RECEIVER = LD_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
      T_RECEIVERS-NOTIF_DEL = 'X'.
      T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = W_DOC_DATA
                PUT_IN_OUTBOX              = 'X'
                SENDER_ADDRESS             = LD_SENDER_ADDRESS
                SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
                COMMIT_WORK                = 'X'
           IMPORTING
                SENT_TO_ALL                = W_SENT_ALL
           TABLES
                PACKING_LIST               = T_PACKING_LIST
                CONTENTS_BIN               = T_ATTACHMENT
                CONTENTS_TXT               = IT_MESSAGE
                RECEIVERS                  = T_RECEIVERS
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                DOCUMENT_TYPE_NOT_EXIST    = 3
                OPERATION_NO_AUTHORIZATION = 4
                PARAMETER_ERROR            = 5
                X_ERROR                    = 6
                ENQUEUE_ERROR              = 7
                OTHERS                     = 8.
    * Populate zerror return code
      LD_ERROR = SY-SUBRC.
    * Populate zreceiver return code
      LOOP AT T_RECEIVERS.
        LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
      ENDLOOP.
    ENDFORM. "SEND_FILE_AS_EMAIL_ATTACHMENT
    *& Form GET_SPOOL_NUMBER
    * text
    * -->P_SY_REPID text
    * -->P_SY_UNAME text
    * <--P_MI_RQIDENT text
    FORM GET_SPOOL_NUMBER USING F_REPID
                                F_UNAME
                                CHANGING F_RQIDENT.
      DATA:
      LC_RQ2NAME LIKE TSP01-RQ2NAME.
      CONCATENATE F_REPID+0(9)
      F_UNAME+0(3)
      INTO LC_RQ2NAME.
      SELECT * FROM TSP01 WHERE RQ2NAME = LC_RQ2NAME
                          ORDER BY RQCRETIME DESCENDING.
        F_RQIDENT = TSP01-RQIDENT.
        EXIT.
      ENDSELECT.
      IF SY-SUBRC NE 0.
        CLEAR F_RQIDENT.
      ENDIF.
    ENDFORM. " GET_SPOOL_NUMBER
    Regards,
    Vasanth

  • Trigger mail to dynamic Agents

    Hi Experts,
    My requirement is to trigger a email to user based on document type.
    Lets say my doc. type is     DOC1 then Approver will be USER1
                                                DOC2 then  Approver will be USER2.
    and mail should be triggered to this agents dynamically based on document type.
    I have created one z table and maintained this entries.
    created one Rule .
    If I pass my document type to rule, it fetches USER correctly.
    Now how to use this Rule in work flow to trigger mail to fetched User ??
    Please give me a step by step guide to do it.

    Hi Sunil,
    Probably you need to go through some basic material related to Business object and workflow.
    Go through the below link.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/c5/e4ac12453d11d189430000e829fbbd/frameset.htm
    http://wiki.sdn.sap.com/wiki/display/ABAP/SAPBusinessWorkflow
    Regards
    Kedar

  • Trigger mail after UD

    Hi Experts,
    Can anyone please tell me how to configure for trigger mail in workplace once UD takes place.
    System should send mail once I save the UD & its should show pop up message of mail.
    Regards,

    There is concept of followup action in Usage decision code.Explre QS51 where against UD code there is followup action.
    Where you can get facility to trigger the mail.
    What you can do is ->In QCC3->Inspect lot completion>define followup action>here create a Z-function module & assign against the followup action......
    Take help of Abaper
    Also refer recent thread Follow-up Action at UD-QM

  • Cannot start up background job in WOrkflow

    Dear Sir,
    I have the workflow in CRM  and there is some trigger to run background job. but not the background job in the workflow is not run. How to start the trigger?
    Please kindly advis.e
    Thanks and best regards,
    VImol

    Hi
              can you send the stack trace after "Caused By" part of exception.

  • Assigning jobs to a position

    Hello!
    My problem is this:
    when i assign jobs to a position in PPOME, the position shuold keep the descriptions of job when i confirm my entry (by pressing Enter) , but when the name of job is too large, this ones isn't assigned to position.
    What can i resolve it?
    thanks

    in PPOME select the root Orgunit then click the dropdown Goto (First Button).
    Then Choose Task Assignment.
    Then U'll be in Task assignment screen.Then Choose the Concerned Position right click the choose Assign.
    Then Choose Task.
    Hope U'll be clear.
    Award Points if Help Ful.
    ~BiSu

Maybe you are looking for