Problem with the ALV after sending the mail

Good Morning Experts
I have a small issue with the ALV. I have a program, which has to sent email. In My program initially I am displaying basic list in the alv and user can navigate to secondary list also, by clicking on a contract number in the basic list.
I gave a tool button in the tool bar to the user in the basic list, to send the mail. When the user clicks on the I have to send the mail both the lists, basic list and seconday list in the mail as separate attachments.
Mail is going fine and later if the user chooses to see any contract in detail(Secondary List), that time ALV giving dump with message type X. And it is stopping some where in the ALV code
call method cl_gui_cfw=>get_subscriber_by_id
       exporting shellid = p_handle-shellid
       exceptions others = 1.
  if sy-subrc = 0.
    </B>message X007 with p_handle-clsid.<B>
  endif.
If anybody having an Idea, how to resolve it, please tell me.
Thanks in Advance
Praveen

Please find the code for user_command form and sending the mail. Please look into this advice me if anything wrongly I coded.
*&      Form  user_command
FORM user_command USING r_ucomm LIKE sy-ucomm
                              rs_selfield TYPE slis_selfield.
  IF r_ucomm EQ '&IC1' OR r_ucomm EQ 'SHOW'.
    REFRESH: it_all[],
             it_fcat1[],
             it_sort[].
    LOOP AT it_final INTO wa_final WHERE select EQ 'X' OR xblnr EQ rs_selfield-value.
      LOOP AT it_bsid INTO wa_bsid WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
        wa_all = wa_bsid.
        wa_all = wa_bsid.
        wa_all-booked = wa_bsid-dmbtr.
        IF wa_bsid-augdt IS NOT INITIAL AND wa_bsid-augbl IS NOT INITIAL.
          wa_all-paid = wa_bsid-dmbtr.
        ENDIF.
        wa_all-amtr = wa_all-booked - wa_all-paid.
        APPEND wa_all TO it_all.
        CLEAR: wa_all,
               wa_bsid.
      ENDLOOP.
      LOOP AT it_bsad INTO wa_bsad WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
        wa_all = wa_bsad.
        wa_all-booked = wa_bsad-dmbtr.
        IF wa_bsad-augdt IS NOT INITIAL AND wa_bsad-augbl IS NOT INITIAL.
          wa_all-paid = wa_bsad-dmbtr.
        ENDIF.
        wa_all-amtr = wa_all-booked - wa_all-paid.
        APPEND wa_all TO it_all.
        CLEAR: wa_all,
               wa_bsad.
      ENDLOOP.
    ENDLOOP.
    SORT it_all BY xblnr.
    PERFORM fill_fcat2.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
        i_callback_program                = sy-repid
        i_callback_top_of_page            = 'TOP_OF_PAGE'
        i_grid_title                      = 'Report to display selected contracts'
        is_layout                         = wa_layout1
        it_fieldcat                       = it_fcat1[]
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
        IT_SORT                           = it_sort[]
        i_default                         = 'X'
        i_save                            = 'A'
        is_variant                        = wa_variant
      TABLES
        t_outtab                          = it_all[]
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.
    ENDIF.
  ENDIF.
  CASE r_ucomm.
    WHEN 'BACK1' OR 'EXT1'.
      PERFORM exit IN PROGRAM  saplslvc_fullscreen.
    WHEN '&F12' or 'CANCEL'.
      PERFORM exit IN PROGRAM  saplslvc_fullscreen.
    WHEN 'MAIL'.
       PERFORM prepare_mail.
  ENDCASE.
ENDFORM.                    "user_command
*&      Form  prepare_mail
      text
-->  p1        text
<--  p2        text
FORM prepare_mail .
  DATA:
       l_lay    TYPE pri_params-paart,
       l_line  TYPE pri_params-linct,
       l_cols   TYPE pri_params-linsz,
       l_val    TYPE c,
       i_spno   TYPE tsp01-rqident,
       i_lines  TYPE i,
       i_bin    TYPE i,
       i_pack_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
       i_recivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
       i_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
       i_header    LIKE solisti1  OCCURS 0 WITH HEADER LINE,
       i_docdata   LIKE sodocchgi1,
       i_excel     LIKE solisti1 OCCURS 0 WITH HEADER LINE.
  i_pos    type i.
  TYPES:
     t_pripar TYPE pri_params,
     t_arcpar TYPE arc_params.
  "Work areas
  DATA:
     lw_pripar TYPE t_pripar,
     lw_arcpar TYPE t_arcpar,
     w_no_of_bytes TYPE i.
  l_lay   = 'X_65_255'.
  l_line  = 65.
  l_cols  = 255.
  "Read, determine, change spool print parameters and archive parameters
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      in_archive_parameters  = lw_arcpar
      in_parameters          = lw_pripar
      layout                 = l_lay
      line_count             = l_line
      line_size              = l_cols
      no_dialog              = 'X'
    IMPORTING
      out_archive_parameters = lw_arcpar
      out_parameters         = lw_pripar
      valid                  = l_val
    EXCEPTIONS
      archive_info_not_found = 1
      invalid_print_params   = 2
      invalid_archive_params = 3
      OTHERS                 = 4.
*l_val eq space
  IF  sy-subrc = 0.
    lw_pripar-prrel = space.
    lw_pripar-primm = space.
    NEW-PAGE PRINT ON
      NEW-SECTION
      PARAMETERS lw_pripar
      ARCHIVE PARAMETERS lw_arcpar
      NO DIALOG.
  ENDIF.
  DATA: ls_prnt TYPE slis_print_alv.
  ls_prnt-print = ''.
  ls_prnt-prnt_title = 'X'.
  ls_prnt-no_coverpage = 'X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
      i_callback_program                = sy-repid
      i_callback_top_of_page            = 'TOP_OF_PAGE'
      i_grid_title                      = 'Report to display collection pattern on Clearing Date'
      is_layout                         = wa_layout
      it_fieldcat                       = it_fcat[]
      i_callback_user_command           = 'USER_COMMAND'
      i_callback_pf_status_set          = 'PF_STATUS_SET'
   IT_SORT                           = it_sort[]
      i_default                         = 'X'
      i_save                            = 'A'
      is_variant                        = wa_variant
    TABLES
      t_outtab                          = it_final[]
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.
  ENDIF.
WRITE 'Test program to generate and download as PDF'.
  NEW-PAGE PRINT OFF.
  CALL FUNCTION 'ABAP4_COMMIT_WORK'.
  i_spno = sy-spono.
  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid   = i_spno
      no_dialog     = 'X'
    IMPORTING
      pdf_bytecount = w_no_of_bytes
     pdf_spoolid   = w_pdf_spoolid
     btc_jobname   = w_jobname
     btc_jobcount  = w_jobcount
    TABLES
      pdf           = it_pdf.
  LOOP AT it_pdf INTO wa_pdf.
    IF w_pos = 34170.
      PERFORM attach.
    ENDIF.
    w_stuff+w_pos(134) = wa_pdf.
    ADD 134 TO w_pos.
  ENDLOOP.
  IF NOT ( w_stuff IS INITIAL ).
    PERFORM attach.
  ENDIF.
  CLEAR wa_pdf.
  PERFORM fill_receivers TABLES i_recivers.
  PERFORM fill_contents TABLES i_contents.
  DESCRIBE TABLE i_contents LINES i_lines.
  READ TABLE i_contents INDEX i_lines.
  CLEAR i_pack_list-transf_bin.
  i_pack_list-head_start = 1.
  i_pack_list-head_num = 1.
  i_pack_list-body_start = 2.
  i_pack_list-body_num = i_lines.
  i_pack_list-doc_type = 'RAW'.
  APPEND i_pack_list.
  CLEAR i_pack_list.
*u2022  Attachment (pdf-Attachment)
CONCATENATE p_date6(2) p_date4(2) p_date+0(4) INTO w_date1 SEPARATED BY '.'.
  DESCRIBE TABLE it_att LINES i_lines.
  READ TABLE it_att INTO wa_att INDEX i_lines.
  i_pack_list-transf_bin = 'X'.
  i_pack_list-head_start = '1'.
  i_pack_list-head_num = '0'.
  i_pack_list-body_start = '1'.
  i_pack_list-body_num = i_lines.
  i_pack_list-doc_type = 'PDF'.
  i_pack_list-obj_name = 'Renewal List'.
  CONCATENATE 'Report to display outstanding premium' 'Executed on' w_date1 INTO i_pack_list-obj_descr SEPARATED BY space.
i_pack_list-obj_descr = 'Exchange Rates uploaded to the database'.
  i_pack_list-obj_langu = 'E'.
  i_pack_list-doc_size = i_lines * 255.
  APPEND i_pack_list.
  CLEAR i_pack_list.
  REFRESH: it_pdf[].
  CLEAR wa_pdf.
  REFRESH: it_all[],
            it_fcat1[],
            it_sort[].
  LOOP AT it_final INTO wa_final.
    LOOP AT it_bsid INTO wa_bsid WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
      wa_all = wa_bsid.
      wa_all-booked = wa_bsid-dmbtr.
      IF wa_bsid-augdt IS NOT INITIAL AND wa_bsid-augbl IS NOT INITIAL.
        wa_all-paid = wa_bsid-dmbtr.
      ENDIF.
      wa_all-amtr = wa_all-booked - wa_all-paid.
      APPEND wa_all TO it_all.
      CLEAR: wa_all,
             wa_bsid.
    ENDLOOP.
    LOOP AT it_bsad INTO wa_bsad WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
      wa_all = wa_bsad.
      wa_all-booked = wa_bsad-dmbtr.
      IF wa_bsad-augdt IS NOT INITIAL AND wa_bsad-augbl IS NOT INITIAL.
        wa_all-paid = wa_bsad-dmbtr.
      ENDIF.
      wa_all-amtr = wa_all-booked - wa_all-paid.
      APPEND wa_all TO it_all.
      CLEAR: wa_all,
             wa_bsad.
    ENDLOOP.
  ENDLOOP.
   NEW-PAGE PRINT ON
      NEW-SECTION
      PARAMETERS lw_pripar
      ARCHIVE PARAMETERS lw_arcpar
      NO DIALOG.
ENDIF.
  SORT it_all BY xblnr.
  PERFORM fill_fcat2.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
      i_callback_program                = sy-repid
      i_callback_top_of_page            = 'TOP_OF_PAGE'
      i_grid_title                      = 'Report to display selected contracts'
      is_layout                         = wa_layout1
      it_fieldcat                       = it_fcat1[]
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
      it_sort                           = it_sort[]
      i_default                         = 'X'
      i_save                            = 'A'
      is_variant                        = wa_variant
    TABLES
      t_outtab                          = it_all[]
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.
  ENDIF.
  NEW-PAGE PRINT OFF.
  CALL FUNCTION 'ABAP4_COMMIT_WORK'.
  i_spno = sy-spono.
  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid   = i_spno
      no_dialog     = 'X'
    IMPORTING
      pdf_bytecount = w_no_of_bytes
     pdf_spoolid   = w_pdf_spoolid
     btc_jobname   = w_jobname
     btc_jobcount  = w_jobcount
    TABLES
      pdf           = it_pdf.
LOOP AT it_pdf INTO wa_pdf.
    IF w_pos = 34170.
      PERFORM attach1.
    ENDIF.
    w_stuff+w_pos(134) = wa_pdf.
    ADD 134 TO w_pos.
  ENDLOOP.
  IF NOT ( w_stuff IS INITIAL ).
    PERFORM attach1.
  ENDIF.
  CLEAR wa_pdf.
DESCRIBE TABLE it_att LINES i_lines.
  ADD 1 TO i_lines.
  DESCRIBE TABLE it_att1 LINES i_bin.
  READ TABLE it_att1 INTO wa_att INDEX i_bin.
DESCRIBE TABLE it_att LINES i_lines.
READ TABLE it_att INTO wa_att INDEX i_lines.
  i_pack_list-transf_bin = 'X'.
  i_pack_list-head_start = '1'.
  i_pack_list-head_num = '0'.
  i_pack_list-body_start = i_lines.
  i_pack_list-body_num = i_bin.
  i_pack_list-doc_type = 'PDF'.
  i_pack_list-obj_name = 'Renewal List-Details'.
  CONCATENATE 'Outstanding Premium-Details' w_date1 INTO i_pack_list-obj_descr SEPARATED BY space.
i_pack_list-obj_descr = 'Exchange Rates uploaded to the database'.
  i_pack_list-obj_langu = 'E'.
  i_pack_list-doc_size = i_bin * 255.
  APPEND i_pack_list.
  CLEAR i_pack_list.
  APPEND LINES OF it_att1 to it_att.
  i_docdata-obj_name = 'Renewal List'.
  CONCATENATE 'Oustanding Premium' 'as on' w_date1 INTO i_docdata-obj_descr SEPARATED BY space.
  CONDENSE i_docdata-obj_descr.
  i_docdata-obj_langu = 'E'.
  i_docdata-obj_prio = '1'.
  i_docdata-no_change = 'X'.
  i_docdata-sensitivty = 'F'.
  i_docdata-doc_size = ( i_lines - 1 ) * 255 + STRLEN( wa_att ).
***Data for Header
  i_header-line = 'Header'. APPEND i_header.
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = i_docdata
      commit_work                = 'X'
    TABLES
      packing_list               = i_pack_list[]
      object_header              = i_header
      contents_bin               = it_att[]
      contents_txt               = i_contents[]
      receivers                  = i_recivers[]
    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.
  IF sy-subrc <> 0.
  ELSE.
    MESSAGE 'Document Sent' TYPE 'S'.
  ENDIF.
ENDFORM.                    " prepare_mail
Thanks
Praveen

Similar Messages

  • Has anyone out there experienced problems with launching apps after downloading the iOS 5.1?

    Has anyone out there experienced problems with launching apps after downloading the iOS 5.1?

    I tried calling support and they want to sell me $79 worth of support in order to get it straightened out!

  • HT204490 OS X Yosemite v10.10.3 Update - I had problems with my iMac after installing the previous update and I removed that update.  Have there been problems associated with this update ?

    OS X Yosemite v10.10.3 Update - I had problems with my iMac after installing the previous update and I removed that update.  Have there been problems associated with this update ?

    I've been using it on all of my computer without any problems. Remember you won't see any positive comments here. Everyone here is complaining about a problem. If you want a good experience with any upgrade or update first make a backup from which you can boot the computer. If you are installing an update, like 10.10.3 for example, always download and install the Combo Updater - OS X Yosemite 10.10.3 Combo Update. Before you install any update or upgrade over an existing system you should do this:Repair the Hard Drive and Permissions:
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility and press the Continue button. After Disk Utility loads select the Macintosh HD entry from the the left side list.  Click on the First Aid tab, then click on the Repair Disk button. If Disk Utility reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit Disk Utility and return to the main menu. Select Restart from the Apple menu.

  • Strange noise problem with music layer after replacing the music file using script in CS6

    Hey guys,
    I got a strange problem. Sometime when I import a music file, or replace a music footage with another music file using the "replace()" or "importFile()" method, the music layer added one second noise at the beginning. like this,
    Does anyone know what's going on here?
    I'm using After Effects CS6 windows Server 2008 64bit.
    Thanks in advance!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Hi Myleniu,
    Thanks for your replay. Actually, it doesn't matter what makes up my comp, this problem just randomly happen when I render any comp. For example, I have a comp named "noise", I run a script to replace the music then render it, I use a "for" loop to do this 5 times and the music noise problem just happen one time.
    I'm starting to think that win server might be the problem.

  • Problem with BPS Reports after upgarding the system to BI.7

    Dear Experts,
    We are facing problem with the BPS Reports after upgarding the system to BI.7
    In 3.5system the reports are dispalyingthe data.
    we have copied the production system to X system and has migrated the same to BI.7.
    in the X system the reports are not showing the data and even we generated the web interfaces in X system.
    After giving the input to BPS Layout and when we go for output ,we are getting the message No Data has been found.
    when we chekced the corresponding cube data was existing.
    It would be a great help if any valuable suggestions to over come the problem.
    Regards,
    Sunil...

    Dear Andrey,
    i am facing an error while filling the set up table for 2LIS_11_VAITM in the source system.
    The error was "Company code has not been maintained for the sales documnet 1296".
    when i checked the document in the Header table VBAK,company code was blank for the document .
    Company code was there in the selections for the setup table.
    The error means that company code should be maintained for the sales document as per my knolwedge.i think document was not created properly in the source system.
    Could you please help me out to over come the problem.
    Regards,
    Sunil...

  • Problems with iTunes Airplay after pausing the playback

    I have a problem with itunes airplay since I've updated my system to Windows 8.
    I'm able to stream music to my Yamaha receiver once, but when I pause the playback and resume to it after a short while, iTunes always freezes and it is shown as inactive in the Task Manager...
    I hadn't any problems with it on Windows 7.
    Any Solutions?
    btw: I tried installing iTunes 11.0.4 and iTunes 10.7..same issue on both versions.
    And I'm sorry for my bad english ;-)

    The following article(s) may help you.
    Credit card security code or postcode issues.

  • Problem with my Inbox after restoring the backup

    Hi,
    I've bought N73 a few days ago and tried to restore my backup from the old 7610 (Messages and Contacts) with PCSuite 6.84....
    Everything was all right except the Inbox...
    All of the messages have the sender's number instead of their name!!
    This problem is only in my inbox, in the sent section i have the messages with contacts name.
    I tried to sync my phone with PCSuite, wondering, there was the sender's name..!!
    Still in my inbox there is no sender's name for the old messages, but new ones come with their name.
    What can i do to adjust it, having the names instead of the numbers, for my restored messages?
    Thanks a lot!

    Any idea!?

  • Problems with video out after closing the lid.

    I bought a Mini-Display Port to HDMI and connected it to my macbook pro and to my tv....Everything is perfect i close the lid....Now i am pretty sure i read somewhere that you can still use your macbook if you have it connected to an external screen and even if the lid is closed...can anyone tell me if i have to do something in the preferences?or is it just normal...I am new with macs,just bought mine 1 1/2 months ago so please take it easy on me... :P Thanks

    You can use the MacBook Pro after you close the lid it's called 'Clamshell Mode' but for it to work correctly you have to attached a keyboard and mouse as well as the TV, then you can close the lid to put it to sleep then touch a key on the keyboard or move the mouse and it will wake up again and display on the screen.

  • Problem with dragged component after resizing the frame

    My application is simple: I am displaying an image on a panel inside a frame (JFrame). I am able to drag the image inside the panel. My problem is that, after dragging the image around, if I am resizing the frame, the image goes back to its original position.
    Does anyone know a workaround?
    I have been using the sample provided by noah in his answer (reply no. 3) to a previous question on this forum: http://forum.java.sun.com/thread.jsp?forum=57&thread=126148
    Thank you!

    Chek out the visibility of your components. Some operations may render them invisible. Use the setVisible( boolean ) to make them visible.

  • Problem with EXCEL format while sending a mail with excel attachment

    Hi,
    I'm trying to send a report through mail as an excel attchment. But though I get all the details in the attachmnet format in excel is not proper. It's in a very hapazard way. I tried putting control break statements after each record then also though there is slight betterment it's not ok. If I send the same thing as a pdf attachment it's perfect. May I know what else i need to do for excel.....? I tried compressing and then sending no luck......
    I'm in version 4.6c.....
    Thanks in advance....

    Hi,
    Just check out this..
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    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,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
    CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    class cl_abap_char_utilities definition load.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY space.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY space.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_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.
      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[] = pit_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.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'This mail is scheduled automatically and excel file is
                    attached for your reference'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY
    Regards,
    Sriram.
    PS: Reward Points if it is useful.

  • Why won't compressor let me submitt the job after sending the job from Final Cut?

    Having problems with compressor.  Does not let me submitt my job.  I sent the job from Final Cut to Compressor.  I set up destination, settings.  When I hit th submitt button it's grayed out.  Can anybody help.   I'm running compressor 3.5.3.  And Final Cut Pro 7.0.3.

    HI do you have Fcp-x, Compressor 4 and motion 5 on your system as well
    just need to ask to get that out of the way first
    thanks
    g

  • Problem with  fish eye after applyng the video is jumping

    I have hero 4 silver and after applying fish eye settings on goPro 3 black + 2.7K wide my video is jumping, Can you help?
    My video was recorded on 2.7K/24/ wide

    Provide the name of the program you are using so a Moderator may move this message to the correct program forum
    This Cloud forum is not about help with program problems... a program would be Photoshop or Lighroom or Muse or ???

  • HT1766 Has anyone else had a problem with their phone after using the cable to upload photos from Camera stream to computer photo program?  My phone is frozen, cannot get into use phone, cannot connect to the Internet, and even APPLE is stumped.

    I only have my IPhone5 for two months and am very upset that now they may need to give me a new phone and lose anything that may not have been recently backed up by the phone.  Has anyone else had this problem?  How did you reseolve it?  Hard reboots did not help.

        jsavage9621,
    It pains me to hear about your experience with the Home Phone Connect.  This device usually works seamlessly and is a great alternative to a landline phone.  It sounds like we've done our fair share of work on your account here.  I'm going to go ahead and send you a Private Message so that we can access your account and review any open tickets for you.  I look forward to speaking with you.
    TrevorC_VZW
    Follow us on Twitter @VZWSupport

  • Problems with viewing contacts after activating the cellular data entry

    Hello I have a problem, I activated my iPhone 4S voice data phone to send a mms anddoes not make me see the book as some one can help me? Thanks to all

    yes iam experiencing same problem,it is very frustrating,nokia must solve it,anyway i found a way to overcome it that is we normally type sms first then select contacts whom to send,do it in reverse manner first select contacts from contact list mark them and from options menu select create message to send sms to all marked contacts,problem of dissappearing some contacts will be overcome

  • I have Mozilla Firefox as my browser vs Internet explorer. This morning when I tried to open Mozilla after several attempts it said it had crashed with a window that I could check the box to send the report to Mozilla but it wont even let me send the repo

    have Mozilla Firefox as my browser vs Internet explorer. This morning when I tried to open Mozilla after several attempts it said it had crashed with a window that I could check the box to send the report to Mozilla but it wont even let me send the report I can get on the internet with explorer but dont want to go back to that so would I just delete mozzila and start all over or will that not clear up the problem? Im lost help

    Have you tried any of the solutions in [[Firefox crashes when you open it]]?

Maybe you are looking for

  • Videos "not copied because it cannot be played on this iPod"

    I'm getting this message with purchased videos. They download and show up in my library, but I can't sync them to my iPod. Purchased music syncs fine. I also can't view them directly in iTunes on my Mac. HELP!! I have hundreds of dollars worth of TV

  • Web Reports - directing output to local printer.

    We are running Forms/Reports web enabled, and we are designing reports, that must send the output directly to the customers printers without first showing them in a browser. Can anyone please tell me how to do this? Regards Benny

  • Photo Library Bug on iOS6

    Has anyone encountered their photo library copying your added picture folder's pictures to where you have triplicates? I have deleted the added folder, but it still has two of every picture I had in the added folder and I can't delete it off my 4S.

  • Right click to add new folder to desktop, not there

    I want to add new folders to desktop (I use to be able to right click & new folder was an option to add to desktop)

  • Comparison of Oracle, MySQL and PostgreSQL DBMS

    Hi, Wanted to share this article: http://www-css.fnal.gov/dsg/external/freeware/mysql-vs-pgsql.html Regards, Priyanka