Sending internal table data to application server as an XML file

Hi All,
I am trying to send the internal table data to application server which should be stored in XML format.
I am using the following code:
DATA:
          result TYPE xstring.
        CALL TRANSFORMATION id
        SOURCE tab = p_output-xsfdata
        RESULT XML result.
        OPEN DATASET l_xml_full_path FOR OUTPUT IN BINARY MODE.
        TRANSFER  result TO l_xml_full_path.
        CLOSE DATASET l_xml_full_path.
And the content in the internal table is :
3C3F786D6C2076657273696F6E3D22312E30223F3E3C736620786D6C6E733D2275726E3A736
73796D206E616D653D22534653592D44415445223E30362F31302F323030393C2F73796D3E2
50617961626C653C6E65772D6C696E652F3E50617274206F6620746865204E616D653C6E657
.......and so on
With this a file is getting created on the application server, but the data is not correct. I am getting the data something like:
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><TAB><item>
PD94bWwgdmVyc2lvbj0iMS4wIj8+PHNmIHhtbG5zPSJ1cm46c2FwLWNv
MDA6eHNmIj48c21hcnR4c2Y+PGhlYWRlcj48Z2VuZXJhbD48dmVyc2lvbj4xLjE0LjI8L3ZlcnNp
b24PGZvcm0WkJMX1NESU5WX0xfMzwvZm9ybT48bGFuZ3VhZ2U+RU48L2xhbmd1YWdlPjxkZXZp
Y2UUFJJTlRFUjwvZGV2aWNlPjxvdXRwdXQtZGV2aWNlPlNYU0Y8L291dHB1dC1kZXZpY2UPC9n
ZW5lcmFsPjxwYWdlIG5hbWU9IkZJUlNUIiBpZD0iMDAxIi8PC9oZWFkZXIPGRhdGEgeG1sOnNw
YWNlPSJwcmVzZXJ2ZSIgc3R5bGU9Ii9TTUIxMS9CTF9TRiI+PGdyYXBoaWNzIG5hbWU9IkNPTUxP
R08iIG9iam5hbWU9Ii9TTUI0MC9MRUFGIiBvYmplY3Q9IkdSQVBISUNTIiBpZD0iQk1BUCIgdHlw
ZT0iQkNPTCIgcGFnZT0iRklSU1QiIHBhZ2UtaWQ9IjAwMSIgcmVzb2x1dGlvbj0iMDEwMCIvPjx3
aW5kb3cgbmFtZT0iU0VOREVSIiBwYWdlPSJGSVJTVCIgcGFnZS1pZD0iMDAxIj48dGV4dCBuYW1l
PSJDT01BRERSIiBzdHlsZT0iL1NNQjExL0JMX1NGIiBvYmpuYW1lPSIvU01CMTEvQkxfU0VOREVS
IiBsYW5nPSJFTiIPHAgbmFtZT0iWlMiPkJhc2VsaW5lIENvbXBhbnk8L3APHAgbmFtZT0iWlMi
PjM0NzUgRGVlciBDcmVlazx0YWIvPlBob25lOjx0YWIvPisxICg2NTApIDg0OS00MDAwPC9wPjxw
IG5hbWU9IlpTIj5QYWxvIEFsdG8sIENBIDk0MzA0PHRhYi8+RmF4Ojx0YWIvPisxICg2NTApIDg0
OS00MjAwPC9wPjxwIG5hbWU9IlpTIj5VU0E8dGFiLz5JbnRlcm5ldDo8dGFiLz5odHRwOi8vd3d3
LnNhcC5jb208L3A+PC90ZXh0Pjwvd2luZG93Pjx3aW5kb3cgbmFtZT0iUEFHRSIgcGFnZT0iRklS
U1QiIHBhZ2UtaWQ9IjAwMSI+PHRleHQgbmFtZT0iUEFHRU5VTUJFUiIgc3R5bGU9Ii9TTUIxMS9C
TF9TRiIgbGFuZz0iRU4iPjxwIG5hbWU9IlROIj5QYWdlIDxzeW0gbmFtZT0iU0ZTWS1QQUdFIj4x
PC9zeW0IG9mIDxzeW0gbmFtZT0iU0ZTWS1KT0JQQUdFUyIvPjwvcD48cCBuYW1lPSJUTiIPA==</item>
<item>c3ltIG5hbWU9IlNGU1ktREFURSI+MDYvMTAvMjAwOTwvc3ltPiA8c
RSIMTQ6MDg6MDM8L3N5bT48L3APC90ZXh0Pjwvd2luZG93Pjx3aW5kb3cgbmFtZT0iTkFNRSIg
cGFnZT0iRklSU1QiIHBhZ2UtaWQ9IjAwMSI+PHRleHQgbmFtZT0iRk9STVVMQVJUSVRFTCIgc3R5
bGU9Ii9TTUIxMS9CTF9TRiIgbGFuZz0iRU4iPjxwIG5hbWU9IlROIj48Y2hyIG5hbWU9Ik1MIj48
c3ltIG5hbWU9IlRJVExFIj5JbnZvaWNlPC9zeW0PC9jaHIPC9wPjwvdGV4dD48L3dpbmRvdz48
d2luZG93IG5hbWU9IkJJTExUT1BBUlRZIiBwYWdlPSJGSVJTVCIgcGFnZS1pZD0iMDAxIj48dGV4
dCBuYW1lPSJXSU5ET1dfVEVYVCIgc3R5bGU9Ii9TTUIxMS9CTF9TRiIgbGFuZz0iRU4iPjxwIG5h
bWU9IlRIIj5CaWxsLVRvLVBhcnR5PC9wPjwvdGV4dD48YWRkcmVzcyBuYW1lPSJCSUxMQUREUkVT
UyIgYWRkcm51bWJlcj0iMDAwMDAyMjQyNyI+PHRleHQgbmFtZT0iQklMTEFERFJFU1MiIHN0eWxl
PSIvU01CMTEvQkxfU0YiIGxhbmc9IkVOIj48cCBuYW1lPSJUMiI+VGVjaCBJbmM8bmV3LWxpbmUv
Could anyone tell me the reason why am I getting the data in this way?
Thanks in advance,
Swapna.
Edited by: NagaSwapna Thota on Jun 10, 2009 5:44 PM

HI,
Use this FM SAP_CONVERT_TO_XML_FORMAT to convert the data to XML format and then upload the convert data from the internal table to Application server.

Similar Messages

  • FM to upload the Internal table data into application server.

    Hi,
      Could you please give me Function module to Upload the Internal table data into Application server ie., in Tcode AL11.
    I know for downloading the Application server file into itab is "SUBST_GET_FILE_LIST" FM and using open dtaa set we get the data.
    Regards,
    deepthi.

    Hi Deepthi
    Incase you are looking to upload data in the AL11 through a program , then you can make use of OPEN DATASET...CLOSE DATASET statements.
    Here's the code snippet:
    IF tb_alvdisplay[] IS INITIAL.
        MESSAGE e999(/dcsea/zais_msg) WITH text-e01.
      ELSE.
        IF  NOT cb_ufile IS INITIAL  "Download to file
         AND sy-pagno = 0.            "Only down page headers for first page
          PERFORM fm_concatenate_path_name USING    p_path
                                                    p_file
                                           CHANGING v_file.
    *Open file for download.
          PERFORM fm_open_file USING v_file .
        ENDIF.
        LOOP AT tb_alvdisplay.
          IF  NOT cb_ufile IS INITIAL.
    *Passing the values of the respective headings to the structure.
            ws_rec-vend_no     = tb_alvdisplay-vendno.
            ws_rec-vend_nm     = tb_alvdisplay-vendnm.
            ws_rec-title       = tb_alvdisplay-vendtl.
            ws_rec-add         = tb_alvdisplay-add.
            ws_rec-city1       = tb_alvdisplay-city1.
            ws_rec-region      = tb_alvdisplay-region.
            ws_rec-country     = tb_alvdisplay-country.
            ws_rec-pobox       = tb_alvdisplay-po.
            ws_rec-phone       = tb_alvdisplay-telf1.
            ws_rec-extn        = tb_alvdisplay-extn.
            ws_rec-fax         = tb_alvdisplay-telfx.
            ws_rec-zterm       = tb_alvdisplay-zterm.
            ws_rec-remark      = tb_alvdisplay-remark.
            ws_rec-email       = tb_alvdisplay-email.
    *Passing the separator 'PIPE' to the structure.
              ws_rec-sep01  = co_sep.
              ws_rec-sep02  = co_sep.
              ws_rec-sep03  = co_sep.
              ws_rec-sep04  = co_sep.
              ws_rec-sep05  = co_sep.
              ws_rec-sep06  = co_sep.
              ws_rec-sep07  = co_sep.
              ws_rec-sep08  = co_sep.
              ws_rec-sep09  = co_sep.
              ws_rec-sep10  = co_sep.
              ws_rec-sep11  = co_sep.
              ws_rec-sep12  = co_sep.
              ws_rec-sep13  = co_sep.
            TRANSFER ws_rec TO v_file.
          ENDIF.
          AT LAST.
            IF NOT cb_ufile IS INITIAL.
    *Closing the DATASET file.
              CLOSE DATASET v_file.
              IF sy-subrc <> 0.
    *Failure Message.
                MESSAGE e999(/dcsea/zais_msg) WITH text-t04 text-t06.
              ELSE.
    *Success message.
                MESSAGE s999(/dcsea/zais_msg) WITH text-t05.
              ENDIF.
            ENDIF.
          ENDAT.
        ENDLOOP.
      ENDIF.
    Also as Gautham suggested you can use tcode CG3Z or CG3Y incase you are looking to upload the data directly.
    FInally, you can search SCN using the keywords, "Upload to AL11" and you'll get loads of results.
    Hope this helps.
    Harsh

  • Upload internal table data to Application server in Excel Sheet

    Hi All,
    I have all my data in an internal table.I want to Upload this data to the Application server in the EXCEL sheet with the Column Header.
    How can i do this.Is there any standarad function module or class to to write in xls format.
    Can anybody help me.
    Thanks,
    Swapna

    Hi
    In SAP ABAP you can transfer the contents of the internal table to a file. This is required when you wish to extract data from SAP tables into a flat file. This file can then be used to transfer data to another SAP or NON SAP system. This can also be used for an interfacing when you wish to transfer data on a daily or a weekly basis from R/3 to NON R/3 or SAP. The command used to create a file on the application server is as follows.
    OPEN DATASET
    Please see example code below.
    REPORT ZEX_DATATOFILE .
    *& ABAPLOVERS: Data Transfer
    Parameters to enter the path
    PARAMETERS FILENAME(128) DEFAULT '/usr/tmp/testfile.dat'
                             LOWER CASE.
    Table Declaration
    TABLES VBAK.
    Data Declaration
    DATA D_MSG_TEXT(50).
    Get data for file transfer
    DATA INT_VBAK LIKE VBAK OCCURS 100
                       WITH HEADER LINE.
    SELECT * FROM VBAK INTO TABLE INT_VBAK.
    SORT INT_VBAK BY VBELN.
    LOOP AT INT_VBAK.
      WRITE: / INT_VBAK-VBELN,
               INT_VBAK-KUNNR.
    ENDLOOP.
    Opening the File
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                          MESSAGE D_MSG_TEXT.
    IF SY-SUBRC NE 0.
      WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
      EXIT.
    ENDIF.
    Transferring Data
    LOOP AT INT_VBAK.
      TRANSFER INT_VBAK-VBELN TO FILENAME.
    ENDLOOP.
    Closing the File
    CLOSE DATASET FILENAME.

  • How to transfer internal table data to Applicatiion Server in XML fromat.

    how to transfer internal table data to Applicatiion Server in XML fromat.

    Hi if u want to transfer from to application server using xml in
    do like this,
    v_xml_table is u r internal table,
    and define li_xml_table as line of u r internal table
    OPEN DATASET g_file FOR OUTPUT IN BINARY  MODE .
        LOOP AT v_xml_table INTO  li_xml_table.
          TRANSFER li_xml_table TO g_file .
        ENDLOOP.
        CLOSE DATASET g_file.
      ENDIF.
    <removed_by_moderator>
    Regards,
    Prasad.
    Edited by: Julius Bussche on Jul 16, 2008 2:43 PM

  • Problem in sending an internal table data to application layer

    i have an internal table
    DATA : BEGIN OF I_DPAYH OCCURS 0,
           ECS_TCODE TYPE char2 VALUE '66',
           ZBKON TYPE DPAYH-ZBKON,
           LEDGER_FOLIO TYPE Char3 ,
           ZBNKN TYPE DPAYH-ZBNKN,
           ZNME1 TYPE DPAYH-ZNME1,
           MICR TYPE  char9 VALUE '40021102',
           USER_NO TYPE  char7 VALUE '4009175',
           DESP TYPE char20 VALUE 'MAHANAGAR GAS LTD',
           MASTR TYPE DPAYH-MASTR,
           RBETR TYPE DPAYH-RBETR,  -
    >                         "
           LAUFI TYPE DPAYH-LAUFI,
           ORIGN TYPE DPAYH-ORIGN,
           END OF I_DPAYH.
    the arrow mark field is of  currency data type and the problem
    is that in application server on character data type it accept
    thats why i have changed all the fields as character data type
    except  RBETR field all the data is transfferd except this field
    regards
    sarfaraz

    when iam doing converting currency into char
    Data: RBETR type char13
    writing
    SELECT  RBETR
      FROM DPAYH INTO CORRESPONDING FIELDS OF
       I_DPAYH .
    it is giving error when transffering in application server
    and giving the error
    (  The current statement is only defined for character-type data objects.)

  • How to send internal table data through mail from report in foreground

    hi all,
    iam trying  to convert the internal table data into excel format and sending it through mail by runnning the report in foreground.
    mail is going sucessfully with excel format,but iam facing the problem in the excel format of the material column as follows:
    the matrno shows the wrong format -2.63E+11  instead of displaying correct format-263215000000.
    Pls suggest the alternative process for the above mentioned problem.
    Thanks,
    Sivagopal R.

    Hi Siva,
      Try to copy 263215000000 in one of the cells of excel sheet and press enter.It will automatically convert into -2.63E+11 .
      This means the default formatting of the excel sheet makes this happen.If you convert the format of the cell to "NUMBER" then u will get the required result.
      But I doubt whether or not it is possible through ABAP programming.
    Regards,
    Vimal.

  • Error while transferin intenal table data to application server

    *& Report  YGL_BALANCES
    REPORT  YGL_BALANCES.
    TABLES:BAPI1028_0,BAPI1028_4,faglflext.
    data: f_glacc(10) type c  value 'flgl.text' .
    DATA: BALANCE LIKE BAPI1028_4-BALANCE,
          RETUR LIKE BAPIRETURN,
          FISC_YEAR LIKE BAPI1028_4-FISC_YEAR,
          FIS_PERIOD LIKE BAPI1028_4-FIS_PERIOD,
          DEBITS_PER LIKE BAPI1028_4-DEBITS_PER,
          CREDIT_PER LIKE BAPI1028_4-CREDIT_PER,
          PER_SALES LIKE BAPI1028_4-PER_SALES.
    data:prctr like faglflext-prctr,
         racct like faglflext-racct,
         rbukrs like faglflext-rbukrs.
    types: begin of   st_i ,
          COMP_CODE LIKE BAPI1028_4-COMP_CODE,
          GL_ACCOUNT LIKE BAPI1028_4-GL_ACCOUNT,
          FISC_YEAR(4),
          FIS_PERIOD(2),
          DEBITS_PER(23),
          CREDIT_PER(23),
          PER_SALES(23),
          BALANCE(23),
          CURRENCY LIKE BAPI1028_4-CURRENCY,
          CURRENCY_ISO(3),
         END OF st_i.
    DATA: ITAB like BAPI1028_4 OCCURS 10 WITH HEADER LINE.
    ***********************************************************************jtab like faglflext occurs 0 with header line.
    PARAMETERS: COMPCODE LIKE BAPI1028_0-COMP_CODE,
                CURRENCY LIKE BAPI1028_5-CURR_TYPE,
                YEAR LIKE BAPI1028_4-FISC_YEAR,
                ACCOUNT LIKE BAPI1028_0-GL_ACCOUNT.
    CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
      EXPORTING
        COMPANYCODE                   = COMPCODE
        GLACCT                        = ACCOUNT
        FISCALYEAR                    = YEAR
        CURRENCYTYPE                  = CURRENCY
    IMPORTING
       BALANCE_CARRIED_FORWARD       = BALANCE
       RETURN                        = RETUR
      TABLES
        ACCOUNT_BALANCES              = ITAB.
        open dataset f_glacc for output in text mode encoding  default.
       loop at itab .
        transfer itab to f_glacc.
       endloop.
        close dataset f_glacc.
    iam getting error like this
    Runtime Errors         UC_OBJECTS_NOT_CHARLIKE
    Date and Time          01/16/2006 07:09:51
    ShrtText
    The current statement is defined for character-type data objects only.
    What happened?
    Error in ABAP application program.
    The current ABAP program "YGL_BALANCES" had to be terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    Error analysis
    Only character-type data objects are supported at the argument
    position "f" for the statement
    "TRANSFER f TO ...".
    In this case, the operand "f" has the non-character-type "BAPI1028_4". The
    current program is flagged as a Unicode program. In the Unicode context,
    type X fields are seen as non-character-type, as are structures that
    contain non-character-type components.
    Trigger Location of Runtime Error
    Program                                 YGL_BALANCES
    Include                                 YGL_BALANCES
    Row                                     48
    Module Name                             START-OF-SELECTION
    Source Code Extract
    Line
    SourceCde
    18
    FIS_PERIOD LIKE BAPI1028_4-FIS_PERIOD,
    19
    DEBITS_PER LIKE BAPI1028_4-DEBITS_PER,
    20
    CREDIT_PER LIKE BAPI1028_4-CREDIT_PER,
    21
    PER_SALES LIKE BAPI1028_4-PER_SALES,
    22
    23
    ITAB LIKE BAPI1028_4 OCCURS 10 WITH HEADER LINE.
    24
    *data : wa like itab.
    25
    26
    PARAMETERS: COMPCODE LIKE BAPI1028_0-COMP_CODE,
    27
    CURRENCY LIKE BAPI1028_5-CURR_TYPE,
    28
    YEAR LIKE BAPI1028_4-FISC_YEAR,
    29
    ACCOUNT LIKE BAPI1028_0-GL_ACCOUNT.
    30
    31
    CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
    32
    EXPORTING
    33
    COMPANYCODE                   = COMPCODE
    34
    GLACCT                        = ACCOUNT
    35
    FISCALYEAR                    = YEAR
    36
    CURRENCYTYPE                  = CURRENCY
    37
    IMPORTING
    38
    BALANCE_CARRIED_FORWARD       = BALANCE
    39
    RETURN                        = RETUR
    40
    TABLES
    41
    ACCOUNT_BALANCES              = ITAB.
    42
    43
    *OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    44
    *TRANSFER `1234567890` TO file.
    45
    46
    open dataset f_glacc for output in text mode encoding  default.
    47
    loop at itab .
    >>>>>
    transfer itab to f_glacc.
    49
    endloop.
    50
    close dataset f_glacc.
    51
    52
    53
    54
    *CALL FUNCTION 'WS_DOWNLOAD'
    55
    EXPORTING
    56
      BIN_FILESIZE                  = ' '
    57
      CODEPAGE                      = ' '
    58
       FILENAME                      = 'C:\KLN.TXT'
    59
       FILETYPE                      = 'DAT'
    60
      MODE                          = ' '
    61
      WK1_N_FORMAT                  = ' '
    62
      WK1_N_SIZE                    = ' '
    63
      WK1_T_FORMAT                  = ' '
    64
      WK1_T_SIZE                    = ' '
    65
      COL_SELECT                    = ' '
    66
      COL_SELECTMASK                = ' '
    67
      NO_AUTH_CHECK                 = ' '

    Hi ,
    what is that file type .text ...?
    there is some problem as i understand from ur code ...
    There actually u have to mention application server path
    with file name...
    go thru this code ..I hope it will be helpful for u
    ELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001
    PARAMETERS    :  p_afile LIKE filename-fileintern LOWER CASE.
    SELECTION-SCREEN END OF BLOCK a.
    OPEN DATASET p_afile FOR OUTPUT IN TEXT MODE.
    *Display this message if the file is not opened successfully
      IF sy-subrc NE 0.
        MESSAGE e006 WITH 'Error in opening Server file'.
      ELSE.
        LOOP AT it_display.
          TRANSFER it_display TO p_afile.
        ENDLOOP.
        IF sy-subrc EQ 0.
          WRITE : /'File posted successfully'.
        ENDIF.
    *Close dataset
        CLOSE DATASET p_afile.
    *Display this message if the file is not closed
        IF sy-subrc NE 0.
          MESSAGE e006 WITH 'Error in closing Server file'.
        ENDIF.
      ENDIF.

  • How to Convert internal table data into text output and send mail in ABAP

    Hi All,
    Good Morning.
    Taking a glance at a code that converts internal table data to an Excel file in ABAP. also checked how to send this excel to mailing list as attachment.
    But thought of doing it without excel.
    I mean, I have an internal table which contains fields of all types (character,integer,date,time). Since it is only around 4 to 5 rows in it (output),why to convert it to excel. not required!!.  Instead I  want to send this output to User's mails as Normal mail body with No attachments.
    Could anybody please suggest me a way as to how to send internal table data as a mail ( not as an excel or PDF etc).
    as of now my findings are, it is quite complex to convert internal table data to email (Text) format. but i believe if there is some way of doing it.
    Best Regards
    Dileep VT

    here's something I have used in the past where we send out information about failed precalculation settings (which are stored in internal table gt_fail)
    notice we use gt_text as "mail body"
    TRY.
    *     -------- create persistent send request ------------------------
           gv_send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document -------------------------------
    *     create text to be sent
           wa_line = text-001.
           APPEND wa_line TO gt_text.
           CLEAR wa_line.
           APPEND wa_line TO gt_text.
           LOOP AT gt_fail ASSIGNING <fs_fail>.
             MOVE <fs_fail>-retry_count TO gv_count.
             CONCATENATE text-002
                         <fs_fail>-setting_id
                         text-003
                         gv_count
                         INTO wa_line SEPARATED BY space.
             APPEND wa_line TO gt_text.
             CLEAR wa_line.
           ENDLOOP.
           APPEND wa_line TO gt_text.
           wa_line = text-007.
           APPEND wa_line TO gt_text.
    *     create actual document
           gv_document = cl_document_bcs=>create_document(
                           i_type    = 'RAW'
                           i_text    = gt_text
                           i_length  = '12'
                           i_subject = 'Failed Precalculation Settings!' ).
    *     add document to send request
           CALL METHOD gv_send_request->set_document( gv_document ).
    *     --------- set sender -------------------------------------------
           gv_sender = cl_sapuser_bcs=>create( sy-uname ).
           CALL METHOD gv_send_request->set_sender
             EXPORTING
               i_sender = gv_sender.
    *     --------- add recipient (e-mail address) -----------------------
           LOOP AT s_email INTO wa_email.
             MOVE wa_email-low TO gv_email.
             gv_recipient = cl_cam_address_bcs=>create_internet_address(
                                               gv_email ).
             CALL METHOD gv_send_request->add_recipient
               EXPORTING
                 i_recipient = gv_recipient
                 i_express   = 'X'.
           ENDLOOP.
    *     ---------- set to send immediately -----------------------------
           CALL METHOD gv_send_request->set_send_immediately( 'X' ).
    *     ---------- send document ---------------------------------------
           CALL METHOD gv_send_request->send(
             EXPORTING
               i_with_error_screen = 'X'
             RECEIVING
               result              = gv_sent_to_all ).
           IF gv_sent_to_all = 'X'.
             WRITE text-004.
           ENDIF.
           COMMIT WORK.
    *   exception handling
         CATCH cx_bcs INTO gv_bcs_exception.
           WRITE: text-005.
           WRITE: text-006, gv_bcs_exception->error_type.
           EXIT.
       ENDTRY.
    with the following declarations
    * TABLES                                                               *
    TABLES:
       adr6,
       rsr_prec_sett.
    * INTERNAL TABLES & WORK AREAS                                         *
    DATA:
       gt_fail          TYPE SORTED TABLE OF rsr_prec_sett
                             WITH UNIQUE KEY setting_id run_date,
       gt_text          TYPE bcsy_text,
       wa_fail          LIKE LINE OF gt_fail,
       wa_line(90)      TYPE c.
    FIELD-SYMBOLS:
       <fs_fail>        LIKE LINE OF gt_fail.
    * VARIABLES                                                            *
    DATA:
       gv_count(4)      TYPE n,
       gv_send_request  TYPE REF TO cl_bcs,
       gv_document      TYPE REF TO cl_document_bcs,
       gv_sender        TYPE REF TO cl_sapuser_bcs,
       gv_recipient     TYPE REF TO if_recipient_bcs,
       gv_email         TYPE adr6-smtp_addr,
       gv_bcs_exception TYPE REF TO cx_bcs,
       gv_sent_to_all   TYPE os_boolean.
    * SELECTION-SCREEN                                                     *
    SELECT-OPTIONS:
       s_email          FOR adr6-smtp_addr NO INTERVALS MODIF ID sel.
    DATA:
       wa_email         LIKE LINE OF s_email.

  • How Internal table data send to sap mail as a attachment?

    Hi,
    Can any one please let me know , how we will send internal table data to sap mail.
    In my internal table my data output length is more than 255 characters.
    Thanks in advance.

    Hi
    Try out the below code:
    DATA: ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des .
    *        ld_receiver LIKE  sy-subrc.
      DATA:   it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
              it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
              w_cnt TYPE i,
              w_sent_all(1) TYPE c,                             "#EC NEEDED
              w_doc_data LIKE sodocchgi1.
      REFRESH it_receivers . CLEAR it_receivers .
      IF v_trip_send = 'X'.
        it_receivers-receiver = it_trip_dload-approver_email .
      ELSE .
        it_receivers-receiver = it_adv_dload-approver_email .
      ENDIF.
      it_receivers-rec_type = c_u .
      APPEND it_receivers. CLEAR it_receivers.
    *  it_receivers-receiver =            '  <Email ID>               '              "Email address.
      IF v_trip_send = 'X' .
        it_receivers-receiver = it_trip_dload-requester_email .
      ELSE .
        it_receivers-receiver = it_adv_dload-requester_email .
      ENDIF .
      it_receivers-rec_type = c_u .
      it_receivers-copy     = 'X' .
      APPEND it_receivers. CLEAR it_receivers.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
    * 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  = c_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   = c_saprpt.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = c_f.
      CLEAR it_attachment.
      REFRESH it_attachment.
      it_attachment[] = it_attach[].
    * Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_type = c_raw.
      APPEND it_packing_list.
    * Create attachment notification
      it_packing_list-transf_bin = c_x.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  ld_format.
      it_packing_list-obj_descr  =  ld_attdescription.
      it_packing_list-obj_name   =  ld_attfilename.
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data = w_doc_data
          put_in_outbox = c_x
          commit_work   = c_x
        IMPORTING
          sent_to_all   = w_sent_all
        TABLES
          packing_list  = it_packing_list
          contents_bin  = it_attachment
          contents_txt  = it_message
          receivers     = it_receivers.
    &*********<removed_by_moderator_together_with_6_unmentionables>************&
    Edited by: Julius Bussche on Jun 23, 2008 11:04 PM

  • Down load data to Application Server

    Hi Experts,
    Can you please confirm me on the follwoing ?
    1. IS it possible to download data from internal table (SAP) to Application Server(Not Presentaion Server) in XML Format ? If yes how .
    2. If i am downloading millions of records from SAP to Application Server, If power failure happen in the middle, is it possible to Catch last downloaded record ? If yes how.
    Experts it is very urgent.
    Thanks in Advance,
    Murali Krishna K

    Hi again,
    1. For converting to XML
       we need to use CALL TRANSFORMATION
    2. below is the program
       for converting (just copy paste in new program)
       It will also save the data to presenetaion server.
       U can utilise the new generated xml table
       to store it in app server.
    REPORT abc.
    DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
           f(255) TYPE c,
           END OF upl.
    DATA: xmlupl TYPE string .
    FIRST PHASE
    FIRST PHASE
    FIRST PHASE
    Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    Convert to TABLE
    CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
      EXPORTING
        i_string         = xml_out
        i_tabline_length = 100
      TABLES
        et_table         = itab.
    Download
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filetype = 'BIN'
        filename = 'd:\xx.xml'
      TABLES
        data_tab = itab.
    SECOND PHASE
    SECOND PHASE
    SECOND PHASE
    BREAK-POINT.
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename = 'D:\XX.XML'
        filetype = 'BIN'
      TABLES
        data_tab = upl.
    LOOP AT upl.
      CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE  XML xmlupl
    RESULT tab = t001[]
    BREAK-POINT.
    regards,
    amit m.

  • Encrypt data of application server..

    Hi,
    Is there any way to encrypt data of application server using a .exe file from user desktop..

    A similiar requirement was imposed by the German tax law (=> http://www.elster.de): encrypted transmission of (tax) data.
    But: due to German export control regulations SAP is not permitted to ship cryptographic software with its products. However, once you've "promised" to comply with those regulations (=> you need to contact the SAP contract department via your local subsidiary) you will be enabled to download the SAPCRYPTOLIB (without any extra charges).
    The SAPSECULIB (part of the shipment) allows only "harmless" cryptographic operations, such as digital signatures.
    The SAPCRYPTOLIB (subject of export control, see above) offers a superset of functionality (compared with SAPSECULIB), particularly the capability to encrypt data.
    The challenging part is the (public) key management. If you only have one single intended recipient (like in the ELSTER scnenario) the configuration is comparably simple. However if you have many potential recipients you need a more sophisticated PKI.
    Regards, Wolfgang

  • How to Down load Data in Application server into the Internal Table

    hi freinds,
    iam having a file in the application server.
    now i need to send the data in the file to the internal table.
    is there any Function Module?
    i need with out using the OPEN DATA SET and CLOSE DATA SET Keywords.
    is there any possible?
    Regard's,
    Ranjith.

    Hi,
    There is no other option for uploading the data from the application server to the internal table without using OPEN DATASET and CLOSE DATASET. Even if you find the FM internal logic in FM uses these keywords to read the data from Application server.

  • Internal table to XML data in Application Server

    Dear Experts,
    I have converted the internal table data into XML format using CL_XML_DOCUMENT class and CREATE_WITH_DATA - method. Here I have to upload this XML converted file in the given application server path. Kindly suggest me some methods or class, other options to do this.
    I need to upload the XML file in to specified application server path. Kindly give some ideas.
    Regards,
    Sakthi

    I guess you want to transfer XML document type ref to IF_IXML_DOCUMENT (which is instantiated with this method and stored in attribute M_DOCUMENT ) to a file on application server. Is that right?
    If so please refer below program you should get the idea
    DATA: gr_ixml TYPE REF TO if_ixml,
          gr_ixml_doc TYPE REF TO if_ixml_document.
    gr_ixml = cl_ixml=>create( ).
    "here you have the same kind of XML document
    "as the one created with method CREATE_WITH_DATA
    gr_ixml_doc = gr_ixml->create_document( ). 
    DATA  gr_ixml_element TYPE REF TO if_ixml_element.
    CALL METHOD gr_ixml_doc->create_element
      EXPORTING
        name = 'JOBS'
      RECEIVING
        rval = gr_ixml_element.
    CALL METHOD gr_ixml_doc->append_child
      EXPORTING
        new_child = gr_ixml_element.
    CALL METHOD gr_ixml_element->set_attribute
      EXPORTING
        name  = 'OBJID'
        value = '566677890'.
    "serialization
    DATA g_encoding_type TYPE string.
    DATA g_stream_factory TYPE REF TO if_ixml_stream_factory.
    DATA gr_encoding TYPE REF TO if_ixml_encoding.
    g_stream_factory = gr_ixml->create_stream_factory( ).
    gr_encoding = gr_ixml->create_encoding( byte_order = 0
                                           character_set = 'UTF-8' ).
    DATA b_xml TYPE xstring.
    DATA gr_ostream TYPE REF TO if_ixml_ostream.
    gr_ostream = g_stream_factory->create_ostream_xstring( b_xml ).
    CALL METHOD gr_ostream->set_encoding
      EXPORTING
        encoding = gr_encoding.
    CALL METHOD gr_ixml_doc->render
      EXPORTING
        ostream = gr_ostream
        recursive = 'X'.
    DATA g_resize TYPE i.
    g_resize = gr_ostream->get_num_written_raw( ).
    data ex_tab type table of x255.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = b_xml
      tables
        binary_tab            = ex_tab.
    "now open file on application server
    OPEN DATASET dset FOR OUTPUT IN BINARY MODE.
    "and transfer ex_tab to dset
    Regards
    Marcin

  • How to access internal table data from webdynpro to Flex application.

    Hi Connoisseur
    The data transfer from Abap WebDeypro to flex island works well. I followed , there is an example from Thomas Jung (by the way as always Great Work) and  Karthikeyan Venkatesan (Infosys) but this example covers simple type only.
    There is no example with complex types like arrayCollection which handle the transfer of data from flex to WebDynpro.
    i tried to do pass internal table value  to flex-datagrid.but its not work.
    i would like to know
    1.how to access internal table data from webdynpro to Flex application.
    2.how to pass the internal table to flex-datagrid.
    2.how to pass dynamically in ADOBE flex.
    3. how to do Flex is receiving the wd context data?
    4. how can we update WD context with FLEX data.
    Ple give me sample example and step by step procedure.
    Regards
    laxmikanth

    Hi Laxmikanth,
    Please refer this...
    Flash island: update complex type from flex
    Cheers..
    kris.

  • Convert internal table data to pdf format and send mail to Users

    Hi all ,
    I want to convert the data available in internal table to pdf format and then send it to mail .
    Please tell me wht are the fn modules available to convert the data from internal table to pdf and then send it mail .
    regards
    santosh .

    Hi Santosh
    Sending mail with attachment report in Background
    Content Author: Fernando Faian
    I have read the hint about "Sending mail with attachment report".
    It's great, but how can I make this function work in background??
    I had that needed last year too. See attachment a function group with two functions. The second one has that functionality to send email or fax (SAP office) with attachment objects in background job using SO_ATTACHMENT_INSERT function. 
    Pay attention because it’s working with output list from spool converted to pdf. 
    =================================================================================
    z_send_email_fax_global
    FUNCTION-POOL z_gfaian_mail_fax.            "MESSAGE-ID ..
    WORK TABLE AREAS
    TABLES: tsp01.
    INTERNAL TABLES
    DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
          lt_note_text   LIKE STANDARD TABLE OF soli  WITH HEADER LINE,
          lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
    DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
          lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
    DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
    TYPES: BEGIN OF y_files,
           file(60) TYPE c,
           END OF y_files.
    DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
    DATA: l_objcont     LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: l_objhead     LIKE soli OCCURS 0 WITH HEADER LINE.
    STRUCTURES
    DATA: folder_id      LIKE soodk,
          object_id      LIKE soodk,
          link_folder_id LIKE soodk,
          g_document     LIKE sood4,
         g_header_data  LIKE sood2,
          g_folmem_data  LIKE sofm2,
          g_header_data  LIKE sood2,
          g_receive_data LIKE soos6,
          g_ref_document LIKE sood4,
          g_new_parent   LIKE soodk,
          l_folder_id    LIKE sofdk,
          v_email(50).
    DATA: hd_dat  like sood1.
    VARIABLES
    DATA: client  LIKE tst01-dclient,
          name    LIKE tst01-dname,
          objtype LIKE rststype-type,
          type    LIKE rststype-type.
    DATA: numbytes TYPE i,
          arc_idx LIKE toa_dara,
          pdfspoolid LIKE tsp01-rqident,
          jobname LIKE tbtcjob-jobname,
          jobcount LIKE tbtcjob-jobcount,
          is_otf.
    DATA: outbox_flag LIKE sonv-flag VALUE 'X',
          store_flag  LIKE sonv-flag,
          delete_flag LIKE sonv-flag,
          owner       LIKE soud-usrnam,
          on          LIKE sonv-flag VALUE 'X',
          sent_to_all LIKE sonv-flag,
          g_authority LIKE sofa-usracc,
          w_objdes    LIKE sood4-objdes.
    DATA: c_file LIKE rlgrap-filename,
          n_spool(6) TYPE n.
    DATA: cancel.
    DATA: desired_type  LIKE sood-objtp,
          real_type LIKE sood-objtp,
          attach_type LIKE sood-objtp,
          otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
          ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
    CONSTANTS
    CONSTANTS: ou_fol LIKE sofh-folrg              VALUE 'O',
               c_objtp    LIKE g_document-objtp    VALUE 'RAW',
               c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
    =================================================================================
    z_send_email_fax2
    FUNCTION z_faian_mail_fax2.
    ""Interface local:
    *"  IMPORTING
    *"     REFERENCE(SRC_SPOOLID) LIKE  TSP01-RQIDENT
    *"     REFERENCE(FAX_MAIL_NUMBER) TYPE  SO_NAME
    *"     REFERENCE(HEADER_MAIL) TYPE  SO_OBJ_DES
    *"     REFERENCE(OBJECT_TYPE) TYPE  SO_ESCAPE
    *"  TABLES
    *"      LT_BODY_EMAIL STRUCTURE  SOLI
    *"  EXCEPTIONS
    *"      ERR_NO_ABAP_SPOOLJOB
    Fist part: Verify if the spool really exists
      SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
      IF sy-subrc NE 0.
        RAISE err_no_abap_spooljob. "doesn't exist
      ELSE.
        client = tsp01-rqclient.
        name   = tsp01-rqo1name.
        CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
             EXPORTING
                  authority     = 'SP01'
                  client        = client
                  name          = name
                  part          = 1
             IMPORTING
                  type          = type
                  objtype       = objtype
             EXCEPTIONS
                  fb_error      = 1
                  fb_rsts_other = 2
                  no_object     = 3
                  no_permission = 4
                  OTHERS        = 5.
        IF objtype(3) = 'OTF'.
          desired_type = otf.
        ELSE.
          desired_type = ali.
        ENDIF.
        CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
             EXPORTING
                  rqident              = src_spoolid
                  desired_type         = desired_type
             IMPORTING
                  real_type            = real_type
             TABLES
                  buffer               = l_objcont
             EXCEPTIONS
                  no_such_job          = 14
                  type_no_match        = 94
                  job_contains_no_data = 54
                  no_permission        = 21
                  can_not_access       = 21
                  read_error           = 54.
        IF sy-subrc EQ 0.
          attach_type = real_type.
        ENDIF.
        CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
             EXPORTING
                  owner     = sy-uname
                  region    = ou_fol
             IMPORTING
                  folder_id = l_folder_id
             EXCEPTIONS
                  OTHERS    = 5.
    fill out informations about the header of the email
        CLEAR: g_document.
        g_document-foltp     = l_folder_id-foltp.
        g_document-folyr     = l_folder_id-folyr.
        g_document-folno     = l_folder_id-folno.
        g_document-objtp     = c_objtp.
        g_document-objdes    = header_mail.
        g_document-file_ext  = c_file_ext.
        g_header_data-objdes    = header_mail.
        CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
             EXPORTING
                  method      = 'SAVE'
                  office_user = sy-uname
             IMPORTING
                  authority   = g_authority
             TABLES
                  objcont     = lt_body_email
                  attachments = lt_attachments
             CHANGING
                  document    = g_document
                  header_data = g_header_data
             EXCEPTIONS
                  OTHERS      = 1.
        folder_id-objtp = l_folder_id-foltp.
        folder_id-objyr = l_folder_id-folyr.
        folder_id-objno = l_folder_id-folno.
        object_id-objtp = c_objtp.
        object_id-objyr = g_document-objyr.
        object_id-objno = g_document-objno.
        link_folder_id-objtp = l_folder_id-foltp.
        link_folder_id-objyr = l_folder_id-folyr.
        link_folder_id-objno = l_folder_id-folno.
        REFRESH lt_rec_tab.
       CLEAR lt_rec_tab.
       lt_rec_tab-sel        = 'X'.
       lt_rec_tab-recesc     = object_type.   "This field for FAX/MAIL
       lt_rec_tab-recnam     = 'U-'.
       lt_rec_tab-deliver    = 'X'.
       lt_rec_tab-not_deli   = 'X'.
       lt_rec_tab-read       = 'X'.
       lt_rec_tab-mailstatus = 'E'.
       lt_rec_tab-adr_name   = fax_mail_number.
       lt_rec_tab-sortfield  = fax_mail_number.
       lt_rec_tab-recextnam  = fax_mail_number.
       lt_rec_tab-sortclass  = '5'.
       APPEND lt_rec_tab.
          lt_rec_tab-recextnam = fax_mail_number.
          lt_rec_tab-recesc = object_type.
          lt_rec_tab-sndart = 'INT'.
          lt_rec_tab-sndpri = 1.
          APPEND lt_rec_tab.
        lt_files-file = c_file.
        APPEND lt_files.
    begin of insertion by faianf01
        hd_dat-objdes = header_mail.
        CALL FUNCTION 'SO_ATTACHMENT_INSERT'
             EXPORTING
                  object_id                  = object_id
                  attach_type                = attach_type
                  object_hd_change           = hd_dat
                  owner                      = sy-uname
             TABLES
                  objcont                    = l_objcont
                  objhead                    = l_objhead
             EXCEPTIONS
                  active_user_not_exist      = 35
                  communication_failure      = 71
                  object_type_not_exist      = 17
                  operation_no_authorization = 21
                  owner_not_exist            = 22
                  parameter_error            = 23
                  substitute_not_active      = 31
                  substitute_not_defined     = 32
                  system_failure             = 72
                  x_error                    = 1000.
        IF sy-subrc > 0.
        ENDIF.
    end of insertion by faianf01
    send email from SAPOFFICE
        CALL FUNCTION 'SO_OBJECT_SEND'
             EXPORTING
                  folder_id                  = folder_id
                  object_id                  = object_id
                  outbox_flag                = outbox_flag
                  link_folder_id             = link_folder_id
                  owner                      = sy-uname
                 check_send_authority       = 'X'
             TABLES
                  receivers                  = lt_rec_tab
                 note_text                  = lt_note_text
             EXCEPTIONS
                  active_user_not_exist      = 35
                  communication_failure      = 71
                  component_not_available    = 1
                  folder_no_authorization    = 5
                  folder_not_exist           = 6
                  forwarder_not_exist        = 8
                  object_no_authorization    = 13
                  object_not_exist           = 14
                  object_not_sent            = 15
                  operation_no_authorization = 21
                  owner_not_exist            = 22
                  parameter_error            = 23
                  substitute_not_active      = 31
                  substitute_not_defined     = 32
                  system_failure             = 72
                  too_much_receivers         = 73
                  user_not_exist             = 35.
      ENDIF.
    ENDFUNCTION.
    =================================================================================
    z_send_email_fax
    FUNCTION ZCBFS_SEND_MAIL.
    ""Interface local:
    *"  IMPORTING
    *"     REFERENCE(SRC_SPOOLID) LIKE  TSP01-RQIDENT
    *"     REFERENCE(HEADER_MAIL) TYPE  SO_OBJ_DES
    *"  TABLES
    *"      LIST_FAX_MAIL_NUMBER STRUCTURE  SOLI
    *"  EXCEPTIONS
    *"      ERR_NO_ABAP_SPOOLJOB
      DATA: vg_achou(1) TYPE n.
    Fist part: Verify if the spool really exists
      vg_achou = 1.
      DO 60 TIMES.
        SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
        IF sy-subrc IS INITIAL.
          CLEAR vg_achou.
          EXIT.
        ELSE.
          WAIT UP TO 1 SECONDS.
        ENDIF.
      ENDDO.
      IF vg_achou = 1.
        RAISE err_no_abap_spooljob. "doesn't exist
      ENDIF.
      client = tsp01-rqclient.
      name   = tsp01-rqo1name.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
           EXPORTING
                authority     = 'SP01'
                client        = client
                name          = name
                part          = 1
           IMPORTING
                type          = type
                objtype       = objtype
           EXCEPTIONS
                fb_error      = 1
                fb_rsts_other = 2
                no_object     = 3
                no_permission = 4
                OTHERS        = 5.
      IF objtype(3) = 'OTF'.
        desired_type = otf.
      ELSE.
        desired_type = ali.
      ENDIF.
      CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
           EXPORTING
                rqident              = src_spoolid
                desired_type         = desired_type
           IMPORTING
                real_type            = real_type
           TABLES
                buffer               = l_objcont
           EXCEPTIONS
                no_such_job          = 14
                type_no_match        = 94
                job_contains_no_data = 54
                no_permission        = 21
                can_not_access       = 21
                read_error           = 54.
      IF sy-subrc EQ 0.
        attach_type = real_type.
      ENDIF.
      CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
           EXPORTING
                owner     = sy-uname
                region    = ou_fol
           IMPORTING
                folder_id = l_folder_id
           EXCEPTIONS
                OTHERS    = 5.
    fill out informations about the header of the email
      CLEAR: g_document.
      g_document-foltp     = l_folder_id-foltp.
      g_document-folyr     = l_folder_id-folyr.
      g_document-folno     = l_folder_id-folno.
      g_document-objtp     = c_objtp.
      g_document-objdes    = header_mail.
      g_document-file_ext  = c_file_ext.
      g_header_data-objdes    = header_mail.
      CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
           EXPORTING
                method      = 'SAVE'
                office_user = sy-uname
           IMPORTING
                authority   = g_authority
           TABLES
                attachments = lt_attachments
           CHANGING
                document    = g_document
                header_data = g_header_data
           EXCEPTIONS
                OTHERS      = 1.
      folder_id-objtp = l_folder_id-foltp.
      folder_id-objyr = l_folder_id-folyr.
      folder_id-objno = l_folder_id-folno.
      object_id-objtp = c_objtp.
      object_id-objyr = g_document-objyr.
      object_id-objno = g_document-objno.
      link_folder_id-objtp = l_folder_id-foltp.
      link_folder_id-objyr = l_folder_id-folyr.
      link_folder_id-objno = l_folder_id-folno.
      REFRESH lt_rec_tab.
      LOOP AT LIST_FAX_MAIL_NUMBER.
        lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
        lt_rec_tab-recesc = 'U'.
        lt_rec_tab-sndart = 'INT'.
        lt_rec_tab-sndpri = 1.
        APPEND lt_rec_tab.
      ENDLOOP.
      lt_files-file = c_file.
      APPEND lt_files.
      hd_dat-objdes = header_mail.
      CALL FUNCTION 'SO_ATTACHMENT_INSERT'
           EXPORTING
                object_id                  = object_id
                attach_type                = attach_type
                object_hd_change           = hd_dat
                owner                      = sy-uname
           TABLES
                objcont                    = l_objcont
                objhead                    = l_objhead
           EXCEPTIONS
                active_user_not_exist      = 35
                communication_failure      = 71
                object_type_not_exist      = 17
                operation_no_authorization = 21
                owner_not_exist            = 22
                parameter_error            = 23
                substitute_not_active      = 31
                substitute_not_defined     = 32
                system_failure             = 72
                x_error                    = 1000.
      IF sy-subrc > 0.
      ENDIF.
    send email from SAPOFFICE
      CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                folder_id                  = folder_id
                object_id                  = object_id
                outbox_flag                = outbox_flag
                link_folder_id             = link_folder_id
                owner                      = sy-uname
           TABLES
                receivers                  = lt_rec_tab
                note_text                  = lt_note_text
           EXCEPTIONS
                active_user_not_exist      = 35
                communication_failure      = 71
                component_not_available    = 1
                folder_no_authorization    = 5
                folder_not_exist           = 6
                forwarder_not_exist        = 8
                object_no_authorization    = 13
                object_not_exist           = 14
                object_not_sent            = 15
                operation_no_authorization = 21
                owner_not_exist            = 22
                parameter_error            = 23
                substitute_not_active      = 31
                substitute_not_defined     = 32
                system_failure             = 72
                too_much_receivers         = 73
                user_not_exist             = 35.
    ENDFUNCTION.
    Regards,
    Sree

Maybe you are looking for