How to send an ALV to Spool

Dear all,
Could you please help, my requirement is to send an ALV report as a PDF attachement to a list of email address. My plan is to send the ALV to spool and read it from there and email it. However I have a problem in as much as the ALV is not being sent to spool, furthermore I also get print dialog popup when running the report. Can you please help, i am using CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY and  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' I have browsed here and there are several questions on this topic but they do not address the issue of sending the file to the spool. The partial code is below
DATA:i_t001 TYPE t001 OCCURS 0,
     pdf    LIKE tline OCCURS 0,
     g_spool   TYPE tsp01-rqident,
     g_program TYPE sy-repid VALUE sy-repid.
TYPE-POOLS:slis.
DATA: w_print TYPE slis_print_alv,
      w_print_ctrl TYPE alv_s_pctl.
PARAMETERS: p_file TYPE string.
INITIALIZATION.
  p_file = 'H:\TEST_gh.pdf'.
START-OF-SELECTION.
  rp-def-time-period.
  help1 = behrs DIV 24.
  bdate = ldate - help1.
  help1 = behrs MOD 24.
  help2 = ltime(2) - help1.
  IF help2 LT 0.
    bdate = bdate - 1.
    btime = ltime.
    btime(2) = 24 + help2.
  ELSE.
    btime = ltime.
    btime(2) = help2.
  ENDIF.
  pn-begps = ldate - 1.
  pn-endps = ldate.
GET pernr.
  loop at p0007 where begda le ldate and endda ge ldate.  "
  endloop.                                              
* überprüft Arbeitszeitplanregel
* CHECK schkz.
  CHECK p0007-schkz IN schkz.
  CHECK p0007-zterf IN zterf.        
  CALL FUNCTION 'HR_SEL_STAT_CHECK'
       EXPORTING
            get_pernr    =  pernr-pernr
            get_ldate    =  ldate
            get_bdate    =  bdate
            get_btime    =  btime
            get_psp_flag =  psp_flag
            get_ltime    =  ltime
*    IMPORTING
*         NO_PERMIT    =
       TABLES
            get_p0000    =  p0000
            get_p0001    =  p0001
            get_p0002    =  p0002
            get_p0050    =  p0050
            get_p0007    =  p0007
            data_tab     =  data_tab.
*   End-of-Selection                                                   *
END-OF-SELECTION.
  loop at data_tab into ls_data_tab.
    ls_data_tab-total_records = '1'.
    ls_data_tab-kostl = p0001-kostl.
    Append ls_data_tab to lt_data_tab.
  endloop.
  DESCRIBE TABLE data_tab LINES lines.
  CALL FUNCTION 'HR_GET_ERROR_LIST'
    TABLES
      error      = errors
      errortexts = errortexts
    EXCEPTIONS
      no_errors  = 1
      OTHERS     = 2.
  IF lines EQ 0 AND sy-subrc EQ 1.
    MESSAGE i050.
    STOP.
  ENDIF.
  LOOP AT errors.
    READ TABLE data_tab WITH KEY errors-pernr.
    IF sy-subrc EQ 0.
      DELETE data_tab INDEX sy-tabix.
    ENDIF.
  ENDLOOP.
  g_repid = sy-repid.
* fill field catalog for output
  PERFORM fill_fcat USING  fcat
                           g_repid.
* Listheader
  PERFORM fill_header USING header_alv_wa
                            header_alv.
  FIELD-SYMBOLS <lwa_fcat> like line of fcat.
  LOOP AT fcat ASSIGNING <lwa_fcat>.
    IF <lwa_fcat>-fieldname = 'TOTAL_RECORDS'.
      <lwa_fcat>-do_sum    = 'X'.
    ENDIF.
  ENDLOOP.
*Right, sort the table and produce sub totals
  wa_sort-spos      = 18.
  wa_sort-fieldname = 'KOSTL'.
  wa_sort-up        = 'X'.
  wa_sort-subtot    = 'X'.
  append wa_sort to it_sort.
* Layout for REUSE_ALV_GRID_DISPLAY
  s_layout-colwidth_optimize = 'X'.
  s_layout-zebra             = 'X'.
  s_layout-no_author         = 'X'.
w_print-print = 'X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = g_repid
    "      i_callback_pf_status_set = 'SET_PF_STATUS'
      i_callback_user_command = 'USER_COMMAND'  
      i_callback_top_of_page  = 'TOP_OF_PAGE'
      is_layout               = s_layout           
      it_fieldcat             = fcat
      it_sort                 = it_sort
      i_save                  = 'A'                       
      i_structure_name        = MY_STRUCTURE'
      is_print                = w_print
    TABLES
      t_outtab                = lt_data_tab
    EXCEPTIONS
      program_error           = 1
      OTHERS                  = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
***=====================================================================*
    g_spool = sy-spono.
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid = g_spool
      TABLES
        pdf         = pdf.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = p_file
          filetype = 'BIN'
        TABLES
          data_tab = pdf.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program      = g_repid
          "      i_callback_pf_status_set = 'SET_PF_STATUS'
            i_callback_user_command = 'USER_COMMAND'  
            i_callback_top_of_page  = 'TOP_OF_PAGE'
            is_layout               = s_layout           
            it_fieldcat             = fcat
            it_sort                 = it_sort
            i_save                  = 'A'                 
            i_structure_name        = MY_STRUCTURE'
          TABLES
            t_outtab                = lt_data_tab
          EXCEPTIONS
            program_error           = 1.
            ENDIF.
      endif.
    endif.

Hi Andy ,
write this code before calling "CONVERT_ABAPSPOOLJOB_2_PDF"
CALL FUNCTION 'SET_PRINT_PARAMETERS'
     EXPORTING
       destination = 'LOCL' " Printer
       layout      = 'X_65_512/2' "Format "X_65_255
       line_count  = '65' "Line Count
       line_size   = '1024'. "Line Size
Regards ,
Yogendra Bhaskar

Similar Messages

  • How to send the ALV GRID output to spool by using the print button in std t

    How to send the ALV GRID output to spool by using the print button in standard tool bar.
    We have created a button in the va02 transaction.  If user click on the button the new screen will be display on that screen we are populating the alv grid output using the oops concept.  But i am unable to send the output to spool using the print button in the standard tool bar.
    I am able to display the Print parameter dialog box but i am not able to send it to spool.
    Kindly help.
    Thanks In Advance.
    G.V.Ramana

    Hi Shaik,
    There is not properties button in my print screen.
    MODULE user_command_0900 INPUT.
        WHEN 'EXCEL'.
          PERFORM excel_download.                              
        WHEN 'PRI'.
          PERFORM print_output.
    form Print_output.
    CALL FUNCTION 'RSPO_LIST_LAYOUT_FITS'
               EXPORTING
                    columns        = 80
                    device         = 'ANY '
                    lines          = 65
                    maxpenality    = 1999
               TABLES
                    layouts        = lt_layouts1
               EXCEPTIONS
                    unknown_device = 1
                    OTHERS         = 2.
          IF sy-subrc = 0.
            LOOP AT lt_layouts1.
              IF lt_layouts1-penality < 1000        AND
                 lt_layouts1-penality < l_min_penality.
                l_layout       = lt_layouts1-layout.
                l_min_penality = lt_layouts1-penality.
              ENDIF.
            ENDLOOP.
            IF NOT l_layout IS INITIAL.
              CALL FUNCTION 'GET_PRINT_PARAMETERS'
                   EXPORTING
                        mode                   = 'CURRENT'
                        line_size              = 80             "#EC *
                new_list_id            = l_new_list_id
                        no_dialog              = l_no_dialog
                        layout                 = l_layout
                   IMPORTING
                        out_archive_parameters = rs_arc_params
                        out_parameters         = rs_pri_params
                        valid                  = l_valid
                   EXCEPTIONS
                        archive_info_not_found = 1
                        invalid_print_params   = 2
                        invalid_archive_params = 3
                        OTHERS                 = 4.
              IF sy-subrc NE 0.                                 " INS SLIN
              ENDIF.                                            " INS SLIN
              IF rs_pri_params-linsz LT 80 OR
                 rs_pri_params-linsz LT gt_stack-s_lprint-width.
                gt_stack-print_line_break = 'X'.
              ELSE.
                CLEAR gt_stack-print_line_break.
              ENDIF.
              IF l_valid NE 'X'.
                rs_pri_params = ls_pri_params_sav.
                rs_arc_params = ls_arc_params_sav.
              ENDIF.
            ENDIF.
          ENDIF.
    endform.                    " Print_output
        CALL METHOD gv_cost_tot_alv_grand->set_table_for_first_display
                EXPORTING
                   is_layout         = gs_layout_cost_tot_grand
                CHANGING
                   it_fieldcatalog   = gt_fcat_cost_tot_grand[]
                   it_outtab         = gt_cost_tot_grand[].
    Please check my code

  • How to send a job log/Spool once the job completed?

    Could you please help me how to send a job log/Spool once the job completed.
    There was an option is available System Send mail to send a mail once the job completed . So could you please help me how we can send a job log using this option .
    I have tried the below but i didn't get any mail . Could some one help this please !
    For example :
    Job chain name : Test_spool
                    Step1 : Reportstep
                                    Job definition u2013 XXX_YYY
                    Step2:  Mailstep
                                    Job definition: system_mail_send
    Expression :  Reportstep,job<(what i need to mention here )>:reportstep/log.txt
    Check the ablove mentioned is correct and correct me , still i didnu2019t get the log in the mail please .
    Thanks
    Ramkumar

    Hi Ram,
    I need your help on getting mail alert with  log file.
    here is how i have provide the parameter valure for job definition: system_mail_sent.
    Step1 with one job1 and step2 with one job1
    In step2 , i have included the job definition to send mail. with below parameter.
    Relative Job: Step 1, Job 1
    Job File: step 1, job 1: step 1/log.txt
    Please let me  know if the above method is correct or not.
    NOTE: mail server and from address are configured.
    Thanks,
    Karthik

  • How to send a ALV report as a workitem

    Hi All,
    How to send a ALV report to the SAP Inbox for approval.
    Requirement: When the reviewer executes the report and click on send button.
    It will go to the approver for report approval.
    How to send a report when reviewer click on the send button.
    I am unable to find a solution when the user click on the send button the report will go to the approver.
    Please help me out on this...
    Regards,
    Siraj,
    +918008322278.

    Hi Siraj
    I do not have a ready sample with me; however, here can be a logical sequencing of steps which you can follow to achieve this:
    1) Define a custom PF STATUS in the ALV with the SEND Button
    2) In the User Command routine for ALV, code for SEND
    3) See how standard ALV - EXPORT to EXCEL Works - Debug and find the steps to generate an EXCEL - in the SEND Functionality
    4) Once Excel is downloaded, create a SOFM document for the same - Check the method CREATE of object SOFM on the coding required to do it
    5) Generate the SOFM Object Instance using the document created and calling FM SWO_INVOKE
    6) Now you have the run time instance of the report output as a document
    7) Define a custom Business object and a custom workflow based on that object
    8) Define a custom event with the event parameter of type SOFM
    9) From your SEND routine of the report -> trigger the event and pass the SOFM Instance of the excel as event parameter
    10) Workflow will have this object via binding from event to workflow container
    11) In the decision step to approver, bind this to _ATTACH_OBJECTS
    For each of these, you will find some  link already on SCN.
    Hope this helps.
    Once you have the solution, by the above steps or a better one, do remember to create a document on SCN in order to help others - this is a valid requirement and it would be good to have a ready reckoner :-)
    regards,
    Modak

  • How to send a ALV graphic through SBWP

    Hi,
    I am new to SAP and newly started SAP PP. We are sending a Z report through SBWP to senior team of the organization. But now new requirement generated to send the ALV graphic instead of detail report.
    Is it possible to send through standard?.
    If possible, can you please explains the steps.
    Thanks;
    Malka

    Hi Siraj
    I do not have a ready sample with me; however, here can be a logical sequencing of steps which you can follow to achieve this:
    1) Define a custom PF STATUS in the ALV with the SEND Button
    2) In the User Command routine for ALV, code for SEND
    3) See how standard ALV - EXPORT to EXCEL Works - Debug and find the steps to generate an EXCEL - in the SEND Functionality
    4) Once Excel is downloaded, create a SOFM document for the same - Check the method CREATE of object SOFM on the coding required to do it
    5) Generate the SOFM Object Instance using the document created and calling FM SWO_INVOKE
    6) Now you have the run time instance of the report output as a document
    7) Define a custom Business object and a custom workflow based on that object
    8) Define a custom event with the event parameter of type SOFM
    9) From your SEND routine of the report -> trigger the event and pass the SOFM Instance of the excel as event parameter
    10) Workflow will have this object via binding from event to workflow container
    11) In the decision step to approver, bind this to _ATTACH_OBJECTS
    For each of these, you will find some  link already on SCN.
    Hope this helps.
    Once you have the solution, by the above steps or a better one, do remember to create a document on SCN in order to help others - this is a valid requirement and it would be good to have a ready reckoner :-)
    regards,
    Modak

  • How to send the ALV report output by automated email.

    Hi All,
    Can any one advice how to send ALV report output by automated email.
    Thanks in advance.
    Vikram.
    Edited by: vikram mallavaram. on Oct 13, 2011 3:26 PM
    Moderator message: FAQ, please search for previous discussions of this topic.
    Edited by: Thomas Zloch on Oct 13, 2011 3:27 PM

    Hi Ramya,
    Check the links below :
    http://wiki.sdn.sap.com/wiki/display/Snippets/Sending+Mail
    http://wiki.sdn.sap.com/wiki/display/Snippets/AbapEMAILProgram
    http://wiki.sdn.sap.com/wiki/display/ABAP/SendMessagetoExternalemailidandSAPUseridvia+ABAP
    They will explain you to send an email.
    Regards,
    Kittu

  • How to send the alv list display to spool

    Hi all,
    I am executing a program in foreground. My requirement is sending alv list output to spool. When i execute the smae program in background mode the SAP is handling the spool output in hierarchial list display. How to get the same output in foreground also.
    Thanks and Regards,
    Vijay.

    Hi max,
    I think my question is not clear.
    when I execute my report in background mode, I can able to see the output in the spool.
    But when I execute the same report in foreground no spool output is getting generated.
    To handle this I am calling some function modules like RSPO_OPEN_SPOOLREQUEST , RSPO_WRITE_SPOOLREQUEST,  RSPO_WRITE_SPOOLREQUEST. But by using this i cannot able to get the desired output in alv list display format. what to do to get my desired output.
    Thanks and Regards,
    Vijay.

  • How to send a list to spool?

    Dear Friend,
    I made a banking payment system program,right now i have to send directly a list of document to spool,how can I do it?
    I got one function module also,but i don't knoe the number of parameters should be pass...........
    so pleases suggest me best way to ccomlish my Requirment
    Thanks & Regards
    Ricky

    Hi Ricky,
    Check the below code.It creates spool on execution.
    Go through this piece of code and try to implement it for your requirement.
    REPORT  ZTEST.                              .
    tables: usr01.
    perform send_report_to_spool.
    form send_report_to_spool.
      data: loc_dest like pri_params-pdest,
            wf_listname type char12,
            wf_listtext like PRI_PARAMS-PRTXT,
            wf_copies type i,
            wf_days type i,
            wf_PARAMS LIKE PRI_PARAMS,     " achieving file PRI_PARAMS.
            wf_valid type c.
      clear : wf_listname , loc_dest , wf_listtext .
      move: 'AP interface' to   wf_listname .
      move: 'AP interface' to   wf_listtext .
    select single spld into usr01-spld from usr01 where bname eq sy-uname .
      if sy-subrc eq 0 .
        move: usr01-spld to loc_dest .
      endif .
      call function 'GET_PRINT_PARAMETERS'
        EXPORTING
          destination    = loc_dest
          copies         = 1
          list_name      = wf_listname
          list_text      = wf_listtext
          immediately    = ' '
          release        = ' '
          new_list_id    = 'X'
          expiration     = 1
          line_size      = 200
          line_count     = 65
          layout         = 'X_65_200'
          sap_cover_page = 'X'
          receiver       = 'SAP*'
          department     = ''
          no_dialog      = 'X'
        IMPORTING
          out_parameters = wf_params
          valid          = wf_valid.
      if wf_valid <> space.
        new-page print on parameters wf_params no dialog.
        perform write_summary .
        new-page print off.
      endif .
    endform.                    "send_report_to_spool
    FORM write_summary .
    data: begin of itab occurs 0,
          matnr type matnr,
          end of itab.
    select matnr
           from mara
           into table itab
           up to 10 rows.
    loop at itab.
    write: / itab-matnr.
    endloop.
    ENDFORM.                    " write_summary

  • How to send the ALV report output in mail

    Dear all,
                        I have developed an ALV report.I need to send this output in the mail.Can anyone help me with the sample code of how to do this.

    Hi Ramya,
    Check the links below :
    http://wiki.sdn.sap.com/wiki/display/Snippets/Sending+Mail
    http://wiki.sdn.sap.com/wiki/display/Snippets/AbapEMAILProgram
    http://wiki.sdn.sap.com/wiki/display/ABAP/SendMessagetoExternalemailidandSAPUseridvia+ABAP
    They will explain you to send an email.
    Regards,
    Kittu

  • How to send a job log/Spool once the job completed in an other Jobchain

    I have a Jobchain which raises events when Job goes to status error.
    After that a job starts which sends a mail. In this Job I have the parameter:
    raising_job_id:
    =waitEvents.NSN_JOB_ON_ERRORO.raiserJobId so I can pass the Job ID and send it in the mail.
    But how can I also pass the Joblog of the errorjob to the sending mailjob ?
    relative_job_id and loblog parameters from system_mail_send job does not work because it's not in the sam Jobchain.
    Do I have to use some pre/post running actions ?
    I'm not familiar with Java programming
    Br
    Uwe

    Hello,
    Then this is your lucky day! Since you already have enough knowledge to get the job id from the raiser event you are already half way there! This is because the System_Mail_Send job also understands an arbitrary job id as a RelativeJob. So if you pass the found job id into the RelativeJob parameter and * into the JobFile parameter all output files from the failed job will be send out.
    Regards Gerben

  • How to Send SAP User to Spool Job instead of SAPService SID

    Dear Gurus,
    I have to print data using access method C (or L) via print server that runs on win 2008.
    SAP AS runs on win 2003.
    It works fine, but user which appears in print job is SAPService<SID>. We need here sap user who actually initiated printing. It can be obtained easily by chaning access method to G. However, this solution is not acceptable.
    Thank you in advance,
    Nenad

    Problem solved on OS level by introducing anonymous log on.
    Cheers.

  • Sending an ALV List screen output to SPOOL

    Hi Guru's,
         I am working with a standard transaction FBWE. In this transaction we are displaying a remittance list
    using ALV LIST.  Now the requirement is I need to send this ALV List output to SPOOL.
                   1. Please tell me how to send an ALV List output to Spool.
                   2. This transaction is having only one user exit, as per my investigation I can not use
                       this user exit. Can anybody tell me the alternative way for this.
    Thanks,
    Ravi

    You can using the SUBMIT along with spool options
    Read the SUBMIT help.

  • How to send a mail more than 255 characters in PDF format

    Hi Experts
    I am facing a problem sending an ALV list spool as an email attachment in PDF format. Here my problem is spool has morethan 255 characters, so the contents are trukated after 255.
    I am using the FM "SO_NEW_DOCUMENT_ATT_SEND_API1" to send the email. Please give any good suggestion.
    Thanks in advance
    Praveen

    Hi,
    <li>After converting spool to PDF using CONVERT_ABAPSPOOLJOB_2_PDF, need to use below function module
    <li>Use SX_TABLE_LINE_WIDTH_CHANGE to convert line width to 255 chars.
       CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
          EXPORTING
            line_width_src              = 134
            line_width_dst              = 255
          TABLES
            content_in                  = i_pdf
            content_out                 = l_attachment
          EXCEPTIONS
            err_line_width_src_too_long = 1
            err_line_width_dst_too_long = 2
            err_conv_failed             = 3
            OTHERS                      = 4.
        IF sy-subrc NE 0.
          MESSAGE s000(0k) WITH 'Conversion Failed'.
          EXIT.
        ENDIF.
    Thanks
    Venkat.O

  • Send bdc messages to spool

    Hi all,
    i am using call transaction in my program and collectiong messages into megtab(of type bdcmsgcoll)..
    1)can anyone please tel me how to process the messages and
    2) how to send the messages to spool
    SAI

    Sai Ram,
    after you getting the messages
    loop at it_msg.
    call function 'MESSAGE_PREPARE'
    endloop.
    pass appropriate params to the above FM.
    now you have the messages , using NEW-PAGE PRINT ON.
    you can trigger the spool job.
          DATA: L_PARAMS TYPE PRI_PARAMS,
                L_VALID TYPE C.
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              IMMEDIATELY            = ' '
              LINE_SIZE                =  220
              LAYOUT                 = 'X_65_255'
              RELEASE                = ' '
              MODE                   = 'CURRENT'
              NO_DIALOG              = ' '
            IMPORTING
              OUT_PARAMETERS         = L_PARAMS
              VALID                  = L_VALID
            EXCEPTIONS
              ARCHIVE_INFO_NOT_FOUND = 1
              INVALID_PRINT_PARAMS   = 2
              INVALID_ARCHIVE_PARAMS = 3
              OTHERS                 = 4.
          NEW-PAGE PRINT ON   PARAMETERS L_PARAMS NO DIALOG.
          PERFORM DISPLAY_REPORT.  "here you call your write statements.
          NEW-PAGE PRINT OFF.
    Regards
    Vijay

  • How to send result of a report as an email

    hi experts,
    how to send the result of a report as an email to the user.
    plz help
    regards,
    malleswari.

    Hi,
    Check this Weblog:
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    Check these link as well..
    http://www.sap-img.com/abap/sending-email-with-attachment.htm
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    I did a search in the forum, an di found lot of threads to send mail from ALV ....
    Look at the below threads
    How to send ALV list report as html attachment in a mail??
    https://www.sdn.sap.com/irj/sdn/forumsearch
    How to send ALV report by mail
    Re: How to send an ALV Grid Report to SAP user mail ?
    Re: How to send an ALV Grid Report to SAP user mail ?
    Have a look at below code:
    REPORT ZSENDEXTERNAL.
    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.
    Creation of the document to be sent
    File Name
    DOC_CHNG-OBJ_NAME = 'SENDFILE'.
    Mail Subject
    DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
    Mail Contents
    OBJTXT = 'Minimum bid : $250000'.
    APPEND OBJTXT.
    OBJTXT = 'A representation of the pictures up for auction'.
    APPEND OBJTXT.
    OBJTXT = 'was included as attachment.'.
    APPEND OBJTXT.
    DESCRIBE TABLE OBJTXT LINES TAB_LINES.
    READ TABLE OBJTXT INDEX TAB_LINES.
    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of 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.
    Creation of the document attachment
    (Assume that the data in OBJBIN is in BMP format)
    *OBJBIN = ' O/ '. APPEND OBJBIN.
    *OBJBIN = ' | '. APPEND OBJBIN.
    *OBJBIN = ' /  '. APPEND OBJBIN.
    *DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    *OBJHEAD = 'PICTURE.BMP'.
    *APPEND OBJHEAD.
    Creation of 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 = 'BMP'.
    *OBJPACK-OBJ_NAME = 'PICTURE'.
    *OBJPACK-OBJ_DESCR = 'Representation of object 138'.
    *OBJPACK-DOC_SIZE = TAB_LINES * 255.
    *APPEND OBJPACK.
    Completing the recipient list
    RECLIST-RECEIVER = '[email protected]'.
    RECLIST-REC_TYPE = 'U'.
    APPEND RECLIST.
    *RECLIST-RECEIVER = 'SAPUSERNAME'.
    *RECLIST-REC_TYPE = 'P'.
    *APPEND RECLIST.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = DOC_CHNG
    PUT_IN_OUTBOX = '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: / 'Result of the send process:'.
    LOOP AT RECLIST.
    WRITE: / RECLIST-RECEIVER(48), ':'.
    IF RECLIST-RETRN_CODE = 0.
    WRITE 'The document was sent'.
    ELSE.
    WRITE 'The document could not be sent'.
    ENDIF.
    ENDLOOP.
    WHEN 1.
    WRITE: / 'No authorization for sending to the specified number',
    'of recipients'.
    WHEN 2.
    WRITE: / 'Document could not be sent to any recipient'.
    WHEN 4.
    WRITE: / 'No send authorization'.
    WHEN OTHERS.
    WRITE: / 'Error occurred while sending'.
    ENDCASE.
    Reward points if this helps.
    Manish
    Message was edited by:
            Manish Kumar
    Message was edited by:
            Manish Kumar

Maybe you are looking for

  • Production Order in In-Active Version

    Hi All, Need your expert help... I have a production order for Assembly product (say A1). In this order, under component view, we have component (say C1). in MD04 for C1.., a) I see the dependent requirement I created a simulated version such that it

  • My iphone 4 after update ios wont turn on and stuck in restore with apple logo and loading bar not move

    When I update the ios on my Iphone 4 it wont turn on and I tried to restore it, but it stuck in restore with apple logo and loading bar not move at all, I contact apple support and they tried to help me but nothing work, then they told me to send it

  • Strange mapping debbug error!

    I'm debugging a mapping and I have problem : parent constraint not found, it's strange because I defined other tables the same and it's ok. but this table have a Date format, so I think this is the problem. I know that Oracle format is dd-mon-yy, and

  • Sharing Contacts with Ipad

    My brother just purchased an iPad and I would like to send him some of the contacts from my contact book. When I click "Share" on a desired contact to send to him, the email that he receives on his iPad is all just HTML text and there is no attachmen

  • How to execute report RLBEST00

    Hi All, Can anyone please help me to execute the standard report RLBEST00. It is very urgent.... Thanks in advance. Regards, Akanksha