Smartform output : Articles are getting disorder

Hi all,
In the smartform output the articles are displaying disorder, i want to display the articles as ascending order kindly help me on this issue..
Eg: vf03>billingdocument>issueoutput>select output type-->click on print preview is getting output, in this outptu articles are not getting ascending order.
Regards
Suni

Hi Suni,
Take the function module, which is generated after executing the smartform and add L and F01 to that. Suppose ur function module is
/1BCDWB/SF00000161
like this
/1BCDWB/LSF00000161F01
u add and open it in SE38, then it will act as a include program, then you can put break point where ever is required. Hope this helps u.
Regards,
Chandu.
Edited by: chandra sekhar narra on Oct 27, 2010 9:29 AM

Similar Messages

  • Pricing conditions for the articles are getting triggered one day before the actual activation date to 3rd party systems through job WPMU.

    Hi SAP Guru´s,
    Currently we are sending the pricing, promotions & article master data delta load to 3rd party system from SAP ECC via SAP XI through IDOCS using daily scheduled batch jobs WPMU. IDOC segment - WP_PLU.
    Here the issue is the promotion & pricing data are sent to 3rd party system one day before the actual start date.
    Eg: Promotion 123456 which has start date as 15/05/2014 & ending on 30/05/2014 & was created & activated on 13/05/2014.
    This promotion 123456 is getting triggered from SAP ECC through batch job on 14/05/2014 morning & 3rd party system receives the data on 14/05/2014 & the promotion are getting activated at 3rd party system end on 14/05/2014 itself which actually gets active from 15/05/2014.
    Same in the case for Standard Pricing data which needs to be active from 31/05/2014 once the promotion 123456 ends on 30/05/2014.
    The standard pricing data gets triggered from SAP ECC on 30/05/2014 through batch job & reaching 3rd party system on 30/05/2014 & getting activate on 30/05/2014 itself.
    This creates more issues at the store end as well as affecting business.
    We checked at 3rd party system end & they replied that their system considers the updated time stamp & date to activate the prices & it does not considers the actual active from & active to date. They need the data to be sent from SAP ECC on the effective date of the pricing & promotions.
    Can any one help me how to change the pricing conditions beign triggered through batch job in SAP ECC based on the actual promotion & pricing conditons start date or is there any other process to trigger the data through the batch job on the actual promotion & pricing data activation date.
    Thanks in Advance.
    Thanks & Regards,
    P.P.Shankar

    Hello Shankar,
    Change the lead time in the POS Outbound Profile. You can't put less than 2 days there so data for today and tomorrow will be transferred which also means you need to adjust your batch timing accordingly.
    Sales and Distribution -> POS Interface -> Outbound -> Maintain Profile for POS Outbound.
    See if it helps. The best option would still be that the 3rd part system considers the activtion date.
    Kind Regards
    Kaizad

  • Text and table structure getting jumbled up in the smartform output

    Hi all ,
    While viewing the print preview of a smartform output , i am facing  a strange issue.
    The hardcoded text is getting jumbled up .For eg:"As soon as possible"  becomes " as possible . soon as"
    The structure of the table is also getting reversed.That is the table is now getting displayed with the last couloum first.The data in the table is also coming in the reverse order.
    While executing the smartform directly , the layout is coming in the proper order.But while executing this through a transaction (FINT) , this issue is coming up.The print program is a standard program.
    I have tried deleting the window , copying it to a new smartform etc.I have also tried in different systems to check whether if it is an issue with the system.
    If anyone has faced a similar issue , please let me know how to solve it.Thanks a lot in advance.
    Regards,
    Rashmi

    Hi
    Please check the Printout rather the print Preview. and also check the Structure/table entries also that u printing and also if u r using template, then check the assignment 1 of 1 , etc to the texts.
    surya

  • Can anybody tell me the way of getting Smartform output as xml format??

    Dear Experts,
    Can anybody tell me the way of getting Smartform output as xml format??
    Is there exists a standard way of getting it?
    Regards,
    Nikhil Jain

    Hi,
    Use function module FB_DOWNLOAD_FORM .
    Provide your form name as input for i_formname.
    you will get the output in xml format.
    or use utilities--> download option for downloading in xml format.
    For your referrence:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/0b6bc290-0201-0010-5b87-a0e7c7eb55d0?quicklink=index&overridelayout=true
    May it helps you.
    Regards.
    DS

  • IN F-58 screen check are getting print in disorder way

    Hi all
    Could you please give me solution .i have an issue when i gave print check in f-58 screen check are getting printed in disorder like 1,2,6,9,5, it should be in serial like 123456789way please guid me how can make it correct to print in serial order

    Hi Abdulla,
    in tcode F-58 select check box Do not Void any Checks
    Regards,
    Sreehari

  • Output types are not getting displayed in Outbound Delivery in Display mode

    Hello,
    The actual requirement is that output types should get attched to the outbound delivery when we do GI(Good Issue) on the outbound delivery.
    So, I have created an outbound delivery and did GI on it through IDoc. But, I can not see output types on the delivery (To see output types, go to Extra -> Output -> Header in VL03N) in the display mode. However, I can see in change mode (VL02N).
    Could you please suggest the solution for this?

    Hi sreeram,
    go to crm -> transactions -> basic settings -> define transaction types
    copy default email cx03 and create new zemail.
    assign that zemail to bus2000126 business activity.select the business activity and click on customizing header.assign the category email. click on channel. maintain the channels 1)GUI crm webclient UI, 2)ICW Interaction center webclient.
    save the changes.
    go to crm -> transactions -> basic settings -> settings for activities -> maintain categories, goals, priorities -> click on assign categories to transaction types.
    assign the category email(which you have assigned above) to the transaction type zemail.
    even check maintain categories as well
    click on maintain categories -> check 401 email assigned to class G email.
    Regards
    Krishna

  • How to download a smartform output as excel file WITH EXACT LAYOUT.

    Hi,
         I have searched the forum but could not found any satisfactory answer. I have a smartform with a table, some texts and a logo. I have to write a code which will save the smartform output as excel file in the system keeping the layout of the smartform output EXACT.
    i.e., the excel file will contain the output with EXACTLY THE SAME layout as would have been for a pdf file (if the smartform output is converted to a pdf file) and the client can then edit the fields of the table in the excel file.  How can I achieve this? Please give a suggestion.. Thanks in advance.

    Hi Anirban,
    Your Requirement is to download a smartform to  microsoft  Excel .
    Well unfortunately we can only download data into excel which is in a tabular format i.e stored in internal tables we have function modules to do the same even u can do that using OLE2.
    If u try to download a smartform to Excel only format supported will be ASCII, if u will continue with that the smartforms text's will get downloaded to excel but whole data would be downloaded in a single Cell.
    Code to do the same is -
    >>>>
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
      EXPORTING
      i_language = v_language
      i_application = 'SAPDEFAULT'
      IMPORTING
      e_devtype = v_e_devtype.
       CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = w_form
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
       IMPORTING
         FM_NAME                  =  w_fmname
       EXCEPTIONS
         NO_FORM                  = 1
         NO_FUNCTION_MODULE       = 2
         OTHERS                   = 3
      IF sy-subrc <> 0.
        MESSAGE E002(zcpm) WITH 'Smartform call fails'.
      ENDIF.
    wa_outopt-tdprinter = v_e_devtype.
    wa_ctrlop-no_dialog = 'X'.
    wa_ctrlop-getotf    = 'X'.
      CALL FUNCTION w_fmname "'/1BCDWB/SF00000025'
        EXPORTING
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = WA_CTRLOP
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
        OUTPUT_OPTIONS             = WA_OUTOPT
    *    USER_SETTINGS              = ' '
        IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = T_OTFDATA
    *   JOB_OUTPUT_OPTIONS         =
    *    document_output_info       = st_document_output_info
    *    job_output_info            = st_job_output_info
    *    job_output_options         = st_job_output_options
        TABLES
          T_FINAL                    = T_FINAL
          T_ZSDT_WAGONS              = T_ZSDT_WAGONS_1
          T_QTY                      = T_QTY
          T_QTY1                     = T_QTY1
          T_CON1                     = T_CON1
          T_CON2                     = T_CON2
          "T_ZTMM_OUTWB_TXN           = T_ZTMM_OUTWB_TXN
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    T_OTF[] = T_OTFDATA-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
              format = 'ASCII'
              max_linewidth = 132
    * ARCHIVE_INDEX = ' '
    IMPORTING
              bin_filesize = w_bin_filesize
    TABLES
              otf   = t_otf
              lines = t_pdf_tab
    EXCEPTIONS
              err_max_linewidth = 1
              err_format = 2
           err_conv_not_possible = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if tabix_m = 1.
    *CALL METHOD cl_gui_frontend_services=>file_save_dialog
    *CHANGING
    *filename = w_FILE_NAME
    *path     = w_FILE_PATH
    *fullpath = w_FULL_PATH
    ** USER_ACTION =
    ** FILE_ENCODING =
    *EXCEPTIONS
    *CNTL_ERROR = 1
    *ERROR_NO_GUI = 2
    *NOT_SUPPORTED_BY_GUI = 3
    *others = 4
    *IF sy-subrc <> 0.
    *MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    CALL function 'TMP_GUI_BROWSE_FOR_FOLDER'
    EXPORTING
    WINDOW_TITLE = 'Select A File Folder'
    INITIAL_FOLDER = 'C:\'
    IMPORTING
    SELECTED_FOLDER = W_PATH.
    endif.
    CONDENSE W_PATH.
    concatenate W_PATH '\' wa_final-vbeln '.XLS' into w_FULL_PATH.
    ****************************************************************************Saving the PDF file on to Application server************************
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       BIN_FILESIZE                     = w_bin_filesize
       FILENAME                         = w_FULL_PATH
       FILETYPE                         = 'BIN'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    IMPORTING
       FILELENGTH                      = w_filesize
      TABLES
        DATA_TAB                        = t_pdf_tab
    *   FIELDNAMES                      =
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
    As u said ,u want to download a smartform to Excel it could be done but only if u r using a internal table and exactly printing line by line values in the smartform, But if u are performing calculation in between, using multiple internal table Work areas, structures, etc i.e if whole smartform is developed with many distributed windows , unfortunately it wont be possible to download a smartform to excel in such cases, because the whole output comes from multiple internal tables, calculations, etc all the data is not printed in a tabular manner so in such a case it would be just impossible to download the smartform  to excel.
    But we definitely have a workaround which could be done to download the data into excel.
    you can develop a ALV report with a header and footer u can define the header and footer of the alv according to the smartform and the middle portion would contain the tabular kind of data which u must be using as Smartform table to print the same.
    So if u have a similar kind of smartform with some header data, tabular data, and some footer data, then u can use ALV to do the same thing , advantage with ALV would be that u can easily download the same into excel.
    Other alternative is that u can Convert and download the smartform to PDF  and copy the same to an Excel wooksheet.
    These are all the possibilities with which u can do the same.
    Regards,
    Akash Rana

  • Smartform output to be send via Email

    Hi Guys,
    I have a custom report and output generated by Smartform, currently it is printing on printer.
    My requirement is to sent this output to customer via Email.(email and perferred communication details are available from customer master)
    We have a output management server which will receive this output and convert into PDF format and distribute this output to customer.
    I would like to know what are the possible changes require on driver program.
    Appriciate your help.
    Regards
    Pravin
    Edited by: Pravin on Apr 16, 2008 9:23 PM
    Edited by: Pravin on Apr 16, 2008 9:25 PM

    Hi Pravin,
    Check the following sample program. Smartform driver program. It helps you how to convert smartform output as PDF using function module CONVERT_OTF. Once it is converted mail can be sent through function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    Wherever u find MAI that should be mail.
    REPORT  zvenkat_smartform_via_mai.
    *&  Structures and Infotype Internal tables.
    TABLES pernr.
    INFOTYPES:
      0000,
      0001,
      0002,
      0006,
      0022,
      0023.
    INCLUDE dbpnpmac.
    *&  Declaration part
    * Types
    TYPES:
       BEGIN OF t_emp_info,
         pernr TYPE pa0001-pernr,
         ename TYPE pa0001-ename,
         bukrs TYPE pa0001-bukrs,
         persk TYPE pa0001-persk,
         stell TYPE pa0001-stell,
         gblnd TYPE pa0002-gblnd,
       END OF t_emp_info,
       BEGIN OF t_mard,
         matnr TYPE mard-matnr,
         werks TYPE mard-werks,
         labst TYPE mard-labst,
         meins TYPE mara-meins,
       END OF t_mard.
    * Work areas
    DATA:
      w_emp_info TYPE t_emp_info.
    * Internal tables
    DATA:
      i_emp_info TYPE STANDARD TABLE OF t_emp_info,
      i_mard     TYPE STANDARD TABLE OF t_mard.
    "  Mai related declarations
    "Variables
    DATA :
         g_sent_to_all   TYPE sonv-flag,
         g_tab_lines     TYPE i.
    "Types
    TYPES:
         t_document_data  TYPE  sodocchgi1,
         t_packing_list   TYPE  sopcklsti1,
         t_attachment     TYPE  solisti1,
         t_body_msg       TYPE  solisti1,
         t_receivers      TYPE  somlreci1,
         t_pdf            TYPE  tline.
    "Workareas
    DATA :
         w_document_data  TYPE  t_document_data,
         w_packing_list   TYPE  t_packing_list,
         w_attachment     TYPE  t_attachment,
         w_body_msg       TYPE  t_body_msg,
         w_receivers      TYPE  t_receivers,
         w_pdf            TYPE  t_pdf.
    "Internal Tables
    DATA :
         i_document_data  TYPE STANDARD TABLE OF t_document_data,
         i_packing_list   TYPE STANDARD TABLE OF t_packing_list,
         i_attachment     TYPE STANDARD TABLE OF t_attachment,
         i_body_msg       TYPE STANDARD TABLE OF t_body_msg,
         i_receivers      TYPE STANDARD TABLE OF t_receivers,
         i_pdf            TYPE STANDARD TABLE OF t_pdf.
    PARAMETERS:
               p_mai_id(99) TYPE c.
    *& Start-of-selection.
    START-OF-SELECTION.
    GET pernr.
      PERFORM get_data.
      PERFORM show_smartform.
    *& End-of-selection.
    END-OF-SELECTION.
    *&      Form  get_data
    FORM get_data .
      rp-provide-from-last p0000 space pn-begda pn-endda.
      rp-provide-from-last p0001 space pn-begda pn-endda.
      rp-provide-from-last p0002 space pn-begda pn-endda.
      MOVE-CORRESPONDING: p0000 TO w_emp_info,
                          p0001 TO w_emp_info,
                          p0002 TO w_emp_info.
      SELECT matnr werks labst
      FROM mard
      INTO CORRESPONDING FIELDS OF TABLE i_mard.
    ENDFORM.                    " get_data
    *&      Form  show_smartform
    FORM show_smartform .
      DATA :
        l_sform_name TYPE tdsfname,
        l_fm_name    TYPE rs38l_fnam.
      DATA :
            l_sf_control TYPE ssfctrlop,
            l_sf_options TYPE ssfcompop.
      DATA: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
    *        i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.
      DATA: op_option TYPE ssfctrlop,
            job_output TYPE ssfcrescl.
    *  op_option-getotf = 'X'.
      l_sform_name = 'ZVENKAT_SMARTFORM'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = l_sform_name
        IMPORTING
          fm_name            = l_fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      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 l_fm_name
          EXPORTING
            control_parameters = op_option
            output_options     = l_sf_options
            w_emp_info         = w_emp_info
    IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
       job_output_info            = job_output
          TABLES
            p0006              = p0006
            p0022              = p0022
            p0023              = p0023
            i_mard             = i_mard.
        IF sy-subrc <>  0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format = 'PDF'
          TABLES
            otf    = job_output-otfdata
            lines  = i_pdf.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        PERFORM send_mai.
      ENDIF.
    ENDFORM.                    " show_smartform
    *&      Form  send_mai
    FORM send_mail .
      "Subject of the mai.
      w_document_data-obj_name  = 'MAI_TO_HEAD'.
      w_document_data-obj_descr = 'Regarding Mai Program by SAP ABAP'.
      "Body of the mai
      PERFORM build_body_of_mai
        USING:space,
              'Hi,',
              'I am fine. How are you? How are you doing ? ',
              'This program has been created to send simple mai',
              'with Subject,Body with Address of the sender. ',
              'Regards,',
              'Venkat.O,',
              'SAP HR Technical Consultant.'.
      "Write Packing List for Body
      DESCRIBE TABLE i_body_msg LINES g_tab_lines.
      w_packing_list-head_start = 1.
      w_packing_list-head_num   = 0.
      w_packing_list-body_start = 1.
      w_packing_list-body_num   = g_tab_lines.
      w_packing_list-doc_type   = 'RAW'.
      APPEND w_packing_list TO i_packing_list.
      CLEAR  w_packing_list.
      "Write Packing List for Attachment
      w_packing_list-transf_bin = 'X'.
      w_packing_list-head_start = 1.
      w_packing_list-head_num   = 1.
      w_packing_list-body_start = 1.
      DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.
      w_packing_list-doc_type   = 'PDF'.
      w_packing_list-obj_descr  = 'PDF Attachment'.
      w_packing_list-obj_name   = 'PDF_ATTACHMENT'.
      w_packing_list-doc_size   = w_packing_list-body_num * 255.
      APPEND w_packing_list TO i_packing_list.
      CLEAR  w_packing_list.
      "Fill the document data and get size of attachment
      w_document_data-obj_langu  = sy-langu.
      READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.
      w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_attachment ).
      "Receivers List.
      w_receivers-rec_type   = 'U'.      "Internet address
      w_receivers-receiver   = p_mai_id. "here mai Id should be given
      w_receivers-com_type   = 'INT'.
      w_receivers-notif_del  = 'X'.
      w_receivers-notif_ndel = 'X'.
      APPEND w_receivers TO i_receivers .
      CLEAR:w_receivers.
      "Function module to send mai to Recipients
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = w_document_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = g_sent_to_all
        TABLES
          packing_list               = i_packing_list
          contents_bin               = i_attachment
          contents_txt               = i_body_msg
          receivers                  = i_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.
      IF sy-subrc = 0 .
        MESSAGE i303(me) WITH 'Mai has been Successfully Sent.'.
      ELSE.
        WAIT UP TO 2 SECONDS.
        "This program starts the SAPconnect send process.
        SUBMIT rsconn01 WITH mode = 'INT'
                        WITH output = 'X'
                        AND RETURN.
      ENDIF.
    ENDFORM.                    " send_mai
    *&      Form  build_body_of_mai
    *       text
    *      -->L_MESSAGE  text
    FORM build_body_of_mai  USING l_message.
      w_body_msg = l_message.
      APPEND w_body_msg TO i_body_msg.
      CLEAR  w_body_msg.
    ENDFORM.                    " build_body_of_mai
    I hope that it helps u .
    Regards,
    Venkat.O

  • Error "number out of range" in pdf sent through mail using smartform output

    Hi Experts,
    We have a program which sends mail using smartform output in 'PDF' format. We are able to preview smartform correctely in SAP and mail is also getting sent fine with attachment of form as PDF document. But, when we try to open the document, it gives error saying 'Number out of range'. Also, not all of the windows of smartform are appearing in document and some are coming only half.
    We are not able to find out the reason for this. Any help would be appriciated.
    Gouri.

    Hello,
    How did you solve this one? We are facing the same problem in ECC6.0.
    Thanks in advance,
    Benjamin de Rijke

  • Converting smartforms output into PDF

    Hi ALL,
      How to convert the smartforms output into PDF based form. After executing the form, it should directly  open in PDF. How to do this?
    Points will be awarded.
    Thanks and regards,
    vinoth.

    Hi Vinoth Kumar,
    Please go throuh the below procedure and sample Code, this might help you.
    Procedure
    When we activate the Smartform the system generates a Function Module. The function module name we can get from Smartfrom screen from menubar
    “Environment => Function Module_Name” . In a report we can get this Function module name by calling a Function Module standard SSF_FUNCTION_MODULE_NAME. This function module at runtime calls the FM generated by smartform, which in turn is then used to pass data from the report to Smartform. In the report given below the FM generated is “ /1BCDWB/SF00000152 ”. In this FM we can see CONTROL_PARAMETERS in import tab. This is of type SSFCTRLOP. We need to set the GETOTF of this to be ‘X’. Setting this field will activate the OTF field in smartform.
    In export tab of the FM generated by smartform we can see a parameter JOB_OUTPUT_INFO which is of type SSFCRESCL. The SSFCRESCL is a structure of having one of fields as OTFDATA. OTFDATA in turn is a table of type ITCOO. ITCOO has two fields TDPRINTCOM and TDPRINTPAR. TDPRINTCOM represents command line of OTF format data and TDPRINTPAR contains command parameters of OTF format data.
    In every Smartform output in OTF format, TDPRINTCOM begins and ends with ‘//’. ‘EP’ represents the end-of-page value for TDPRINTCOM field.
    In addition we need to set few fields at the place where we call this FM(generated by smartform) in our program. While calling this FM we should set control_parameters, output_options, user_settings and job_putput_info fields as shown in program.
    Once these settings are done we can call Function Module CONVERT_OTF to convert the OTF data of smartfrom output to PDF data format. Once these are done we can call method “cl_gui_fronted_services=>file_save_dialog” to specify the directory path where we want to save the output PDF file. After this we can call Function Module GUI_DOWNLOAD to download the PDF file on our local system.
    Here is a sample code of program to perform the function.
    SAMPLE CODE
    *& Report  ZAMIT_SMART_FORM_PDF                                        *
    REPORT  ZAMIT_SMART_FORM_PDF                    .
    data: carr_id type sbook-carrid,
          cparam type ssfctrlop,
          outop type ssfcompop,
          fm_name type rs38l_fnam.
    DATA: tab_otf_data TYPE ssfcrescl,
          pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
          tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
          file_size TYPE i,
          bin_filesize TYPE i,
          FILE_NAME type string,
          File_path type string,
          FULL_PATH type string.
    parameter:      p_custid type scustom-id default 1.
    select-options: s_carrid for carr_id     default 'LH' to 'LH'.
    parameter:      p_form   type tdsfname   default 'ZAMIT_SMART_FORM'.
    data: customer    type scustom,
          bookings    type ty_bookings,
          connections type ty_connections.
    start-of-selection.
    suppressing the dialog box for print preview****************************
    outop-tddest = 'LP01'.
    cparam-no_dialog = 'X'.
    cparam-preview = SPACE.
    cparam-getotf = 'X'.
      select single * from scustom into customer where id = p_custid.
      check sy-subrc = 0.
      select * from sbook   into table bookings
               where customid = p_custid
               and   carrid in s_carrid
               order by primary key.
      select * from spfli into table connections
               for all entries in bookings
               where carrid = bookings-carrid
               and   connid = bookings-connid
               order by primary key.
      call function 'SSF_FUNCTION_MODULE_NAME'
           exporting  formname           = p_form
                    variant            = ' '
                    direct_call        = ' '
           importing  fm_name            = fm_name
           exceptions no_form            = 1
                      no_function_module = 2
                      others             = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        exit.
      endif.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards
    calling the generated function module
      call function fm_name
           exporting
                    archive_index        =
                    archive_parameters   =
                     control_parameters   = cparam
                    mail_appl_obj        =
                    mail_recipient       =
                    mail_sender          =
                     output_options       =  outop
                     user_settings        = SPACE
                     bookings             = bookings
                      customer             = customer
                      connections          = connections
          importing
                    document_output_info =
                     job_output_info      = tab_otf_data
                    job_output_options   =
           exceptions formatting_error     = 1
                      internal_error       = 2
                      send_error           = 3
                      user_canceled        = 4
                      others               = 5.
      if sy-subrc <> 0.
      error handling
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
      tab_otf_final[] = tab_otf_data-otfdata[].
      CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       format                      = 'PDF'
       max_linewidth               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
    IMPORTING
       bin_filesize                = bin_filesize
      BIN_FILE                    =
      TABLES
        otf                         = tab_otf_final
        lines                       = pdf_tab
    EXCEPTIONS
       err_max_linewidth           = 1
       err_format                  = 2
       err_conv_not_possible       = 3
       err_bad_otf                 = 4
       OTHERS                      = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
       WINDOW_TITLE         =
       DEFAULT_EXTENSION    =
       DEFAULT_FILE_NAME    =
       FILE_FILTER          =
       INITIAL_DIRECTORY    =
       WITH_ENCODING        =
       PROMPT_ON_OVERWRITE  = 'X'
      CHANGING
        filename             = FILE_NAME
        path                 = FILE_PATH
        fullpath             = FULL_PATH
       USER_ACTION          =
       FILE_ENCODING        =
    EXCEPTIONS
       CNTL_ERROR           = 1
       ERROR_NO_GUI         = 2
       NOT_SUPPORTED_BY_GUI = 3
       others               = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ************downloading the converted PDF data to your local PC*******
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       bin_filesize                    = bin_filesize
       filename                        = FULL_PATH
       filetype                        = 'BIN'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
    IMPORTING
       filelength                      = file_size
      TABLES
        data_tab                        = pdf_tab
      FIELDNAMES                      =
    EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       OTHERS                          = 22
    IF sy-subrc <> 0.
    ENDIF.

  • Download Smartform output in word document

    Hi All,
    I had a requirement to download the smartform output in ".doc" format.
    I had run FM CONVERT_OTF with parameter value format = 'ASCII', and downloaded using .doc format
    I was able to download but the output is not having logo and some different symbols are added.
    Can any suggest what would be the exact procedure to download the output in word document.
    Regards,
    Dinakar.

    Hi Dinakar,
    Please check the link provided:
    Help with Smartform download - unwanted items showing in file
    The solution provided in this link is very relevant for your question, so hope you will get the solution.
    Thanks & regards,
    Sarita Singh Rathour

  • Problem in displaying data in the smartform output.

    Dear Freinds,
                    I have a requirement as per my requirement i have to display the employee dependents details in the smartform output.
    I have taken a table in smartform and collected all teh employee dependents details . Each dependents his own  details around 8 fields. so iam displaying in the smartform it is working till now no problem ........iam getting data as below
    Dependentrelation | dependentname|passportno|expirydate|visano|visadate|visa expire date| ResidenceNo|Residence issuedate|
    spouse                 | Raja                   |123456       |10/09/2009|122233|10/01/2009|10/01/2010 | 1001             |10/01/2009
    These are the one of the dependentds details iam having till now , like this i have another dependts details. Now the problem i have
    to add some fields to this list ( to this internal table) ...........if iam adding one more feild data is getting truncated as i dont have any more fields to add to right in the horizontal line........how can i solve this issue and how can i add further fields to this list
    like date of birth of the dependents and gender
    please could any one tell how i can solve this issue.
    regards
    divya.

    If this is a Tablethen only thing you can do is re-size the grid and font size to adjust your data. Like, displaying HEADINGS & DATAs in 2 rows instead of 1, etc.
    Nothing else can be done. Otherwise you have to trim down the data to adjust in one page.

  • Multiple smartform Outputs in Single PDF

    Hi,
    I am displaying ALV report , from there I am converting my smartform output into PDF using CONVERT_OTF and Downloading it to my desktop.
    Now user is looking for push button in ALV, i.e Display PDF in Single File. I have created the pushbutton and tried to convert the OTF data PDF as per below link.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450?quicklink=index&overridelayout=true
    My file is downloading to the desired path. When i tried to open that file it is giving error message as below.
    THERE WAS AN ERROR OPENING THIS DOCUMENT .  THE FILE IS DAMAGED AND COULD NOT BE REPAIRED.
    when i seleted the rows seperatly, it is displaying as PDF correctly, but if i tried to append the lines as per the above reference link i am getting the problem.
    Can anyone please help me out to solve this.
    Thanks & Regards,
    Srinivas Bhavanam
    Moderator message - Cross post locked
    Edited by: Rob Burbank on Mar 24, 2010 6:25 PM

    This article is correct about the //. First make sure you remove them correctly, and nothing else. Only 2 // must remain, one at the beginning, one at the end.

  • Smartform output ( printout ) is not the same as the preview

    Dear Freinds,
    I have developed smartform , iam able to get data
    very much clear font and the design . However when i running the smart form through repot to give print using the Output Device Locl or LP01. I can see the output is not coming in the printout which is there in Print Preview.
    The Print Preview as below :
    Print preview the below is the data:
    ID : _____________QTY :____________
    Address :_________Pincode :____________
    Final printout in the paper (when using the output device
    Locl or LP01) the data is coming as below
    Name : _______                              QTY :____________
    Address : ___________                     Pincode :____________
    we can the see the above printing is not correct , as the lines are coming  short when
    compared to print preview and it is looking as broken lines....
    I have used underline for printing the lines using the Paragraph Format from Smart Styles.
    Please could you tell me what changes i have to do so that the line should stretch and touch the Qty
    , in the printpreview data is coming correctly i can see the line touches till the Qty.
      . Please suggest me what i have missed in the smartforms..
    thanks & regards
    madhuri
    Edited by: madhuri_2000 kumari on Oct 29, 2008 8:50 AM

    Dear Neeraj,
            The actual problem is the when i have in the ouput as below :
    Name : &wafinal-Name&__________ Designation : &wafinal-Job&________
    so iam getting data for Name : Madhuri______ Designation: Supervisor  -
    > this data
    is coming for me correctly when i see in the Print preview.
    As in the page  the two fields Name and Designation are in the same line i want the underline which is the under Madhuri should extend till the text Designation , but i found in the print preview it is coming
    correctly , however in the printout it is coming ast Name : Madhuri______       Desgination: Supervisor______.
    i can see there is a gap coming between end of the underline of the Name and the Designation.
    Actually my requirement is i wan to have
    Name : _____________________________Designation:_________________________________
    in first row. But in the printoverview iam ble to see exactly the same above however when i take printout i can the output as
    Name : ______________________            Designation:____________________________
    I have done in the smartform as per below :
    I have used the Table > in the table i have used the Main Area> in the Main area  i have created in Row1 and created a cell> Splited the Cell in two > so Row1 is having two cells> in the first cell i have created one text and given in the text area as Name : &Wa_final-Name&____ and in the second cell i have created another text and given in the text area as Designation : &wa_final-Job&________.
    So i am not able to extend  the underline of the Name : &Wa_final-Name&____ till Designation: &wa_final-Job&________, however iam able to see in the printout and only not getting truncated inthe
    printout.
    please could  let me know how and where i went wrong in getting  extended till Designation.
    Regards
    Madhuri.

  • Sending smartform output as PDF attachment, Error opening PDF attachment

    Hi Experts,
    I am using the code form the following link to send a smartform output as PDF attachment. I can able to see the message, but can not open PDF document.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSmartformtoPDFformat&
    The information should be on my smartform are some text, company logo and a barcode.
    With all of these received error: "There was an error opening this document. The file is damaged and could not be repaired."
    I tried different ways like only text, text with company logo, text with barcode. I got the following errors:
    An unrecognized token 'Td0' was found
    There was problem reading this document(16).
    There was problem reading this document(111).
    Does anyone have idea of these ? Your help is greatly appreciated.
    Thank you,
    Surya

    please see this code  ...  for sending the  Email as  PDF attach file,
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               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.
    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.
    * Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    * 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.
    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
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    *** Alternative way could be to submit another program and store spool
    *** id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
    *        to sap-spool
    *        spool parameters   %_print
    *        archive parameters %_print
    *        without spool dynpro
    *        and return.
    * Get spool id from program called above
    *  IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        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.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      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.
    *       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.
    *       FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                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.
    *       FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    *  perform send_email using p_email2.
    ENDFORM.
    *       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         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    *  CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    * If no sender specified - default blank
      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
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
    *       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.
    *&      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.
    reward  points  if it is usefull ....
    Girish

Maybe you are looking for

  • Not able to copy data to External Drive

    ok so I did do a search on this problem, but i started a new thread b/c I think i may be having a slightly different issue...please hear me out.. I have a Macbook, running Mac OS X Tiger (version 10.4.11). I have had a 500 GB external HD (MyBook) hoo

  • Unable to provision apps to new users in added realm

    I added a second realm, but there are no applications in the provisioning console for it. I wonder if provisioning is manual for multiple realms. Does anyone have any experience or knowledge with this? thanks, Perryn

  • Screen exit for Service entry sheet at line item level

    Hi, We would like to add some custom fields at service entry sheet at line item. A new tab to be introduced with custom fields at serive entry line item level. Any idea which screen exit can be use? or what is the way to find the screen exit? Regards

  • Telephone Number field when adding a new User - CCM 4.2.1

    Is their a way to automatically populate the telephone number field for a user? BAT does not allow this field to be added to the spreadsheet (phones-users). Thanks.

  • Myfaces migration 1.1 - 1.2

    hello, i tried to migrate my application from myfaces 1.1.5 to 1.2.3, after it i got an exception and i cannot find any solution, can you advice me? javax.faces.FacesException: Unable to convert string "net.tv.common.i18n.messages" to class "javax.el