Send  XML as attachment in Email activity

Hi
My requirement is to send XML as an attachment through email .
In the attachment if i select the MIME type as "XML" then no email notification is sent,
but if i select the MIME type as "text/html" , then attachement is sent through email , but attachment is in different format( with no content inside attachment) .
Can anyone help me on this .

have you tried the example on this page : http://java.net/projects/oraclesoasuite11g/pages/Notification

Similar Messages

  • Sending a binary attachment via email, looking for a more clean way

    Hi experts.
    I finally managed to send a binary attachment via email. Why "finally"? Never done before!
    Also I got to manage the "not standard" .SAP file extension, because the attachment is a transaction link.
    So let me explain how i did it:
    take SO_NEW_DOCUMENT_ATT_SEND_API1, filling following input data:
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = st_docdata
          commit_work                = 'X'
        TABLES
          packing_list               = lt_packlist
          contents_hex               = lt_hex
          contents_txt               = lt_content
          receivers                  = lt_recv
        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.
    But how to fill lt_hex? Well I did not found a way to transfer text data into raw data structure (lt_hex is type SOLIX).
    So, here is the trick:
    fill another table, lt_bin type SOLISTI1, with attachment content (text data);
    dump lt_bin content to a file on application server, having care to specify TEXT MODE and UTF-8 encoding;
    now reopen the same file in BINARY MODE and transfer content to lt_hex.
    Why I did not use parameter
    content_bin
    ? Because SAP ECC 6 is unicode enabled (I think UTF-16) and file has got to be UTF-8 or ASCII. Also, packing_list for attachment must specify binary tranfer mode. And doing so each UTF-16 character (2 bytes) is split into 2 characters (1 char + 1 NUL byte). Attachment is now unusable.
    What is the question? Here it is: how to fill lt_hex data directly from text (UTF-16) data, avoiding conversion errors?
    Thank you in advance.

    Hi Chhayank,
    the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
    Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
    ~Florian

  • Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Hi Chhayank,
    the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
    Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
    ~Florian

  • Send HTML as attachment in email in Stored Procedure

    Hi Guys,
    I am writing a stored procedure to send HTML attachment. Below is my code but no html attachment sent in mail. Kindly advise.
    USE [CarsemERP]
    GO
    /****** Object: StoredProcedure [dbo].[DBA_CarsemERP_SQLBlocks] Script Date: 04/01/2015 15:14:15 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <THARMENDRAN>
    -- Create date: <2014FEB21>
    -- Description: TO CHECK ANY LOCKS MORE THN 20 SEC IN SQL SERVER
    -- =============================================
    ALTER PROCEDURE [dbo].[DBA_CarsemERP_SQLBlocks]
    AS
    BEGIN
    DECLARE @iCnt As Int
    DECLARE @ICnt2 As Int
    DECLARE @SendEmail AS VARCHAR(3)
    DECLARE @Temp_DetailReq1 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    DECLARE @Temp_DetailReq2 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    SET @SendEmail = 'NO'
    SELECT @iCnt= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt > 0
    BEGIN
    Insert Into @Temp_DetailReq1
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    END
    WAITFOR DELAY '00:00:20'
    select @iCnt2= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt2 > 0
    BEGIN
    DECLARE @columnHeaders NVARCHAR(MAX)
    DECLARE @tableHTML NVARCHAR(MAX)
    DECLARE @body NVARCHAR(MAX)
    Insert Into @Temp_DetailReq2
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    SET @SendEmail = 'YES'
    BEGIN
    SET @columnHeaders = 'DBName</th><th>RequestId</th><th>BlockingId</th><th>BlockedObjectName</th><th>LockType</th><th>RequestingText</th><th>BlockingText</th><th>LoginName</th><th>HostName'
    set @tableHTML =
    '<div><b>There is blocking in VERPSVR02-02.</b></div><br>' + -- This is the bold text at the top of your email
    '<table border="0" cellpadding="5"><font face="Calibri" size=2>' +
    '<tr><th>' + @columnHeaders + '</th></tr>' +
    convert(nvarchar(max),
    select td = [DBName], '', -- Here we put the column names
    td = [RequestId], '',
    td = [BlockingId], '',
    td = [BlockedObjectName], '',
    td = [LockType], '',
    td = [RequestingText], '',
    td = [BlockingText], '',
    td = [LoginName], '',
    td = [HostName], '' -- Here we put the column names
    from @Temp_DetailReq2
    for xml path('tr'), type)) +'</font></table>'
    END
    END
    IF @SendEmail = 'YES'
    BEGIN
    EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'MyDBMailProfileName',
    @recipients = '[email protected]',
    @body = 'Please refer the attachment' ,
    @body_format = 'HTML',
    @subject = 'Alert! Blocking On ERPSVR02-02 Live Server',
    @file_attachments = @tableHTML,
    @importance = 'High';
    END
    END

    Hi Guys,
    I need help on how to generated HTML as attachment to email. I have write below stored procedure but the html did not send as attachment. Kindly guide me on how to save the generated HTML as a file and send it as attachment.
    USE [CarsemERP]
    GO
    /****** Object: StoredProcedure [dbo].[DBA_CarsemERP_SQLBlocks] Script Date: 04/01/2015 15:14:15 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <THARMENDRAN>
    -- Create date: <2014FEB21>
    -- Description: TO CHECK ANY LOCKS MORE THN 20 SEC IN SQL SERVER
    -- =============================================
    ALTER PROCEDURE [dbo].[DBA_CarsemERP_SQLBlocks]
    AS
    BEGIN
    DECLARE @iCnt As Int
    DECLARE @ICnt2 As Int
    DECLARE @SendEmail AS VARCHAR(3)
    DECLARE @Temp_DetailReq1 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    DECLARE @Temp_DetailReq2 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    SET @SendEmail = 'NO'
    SELECT @iCnt= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt > 0
    BEGIN
    Insert Into @Temp_DetailReq1
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    END
    WAITFOR DELAY '00:00:20'
    select @iCnt2= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt2 > 0
    BEGIN
    DECLARE @columnHeaders NVARCHAR(MAX)
    DECLARE @tableHTML NVARCHAR(MAX)
    DECLARE @body NVARCHAR(MAX)
    Insert Into @Temp_DetailReq2
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    SET @SendEmail = 'YES'
    BEGIN
    SET @columnHeaders = 'DBName</th><th>RequestId</th><th>BlockingId</th><th>BlockedObjectName</th><th>LockType</th><th>RequestingText</th><th>BlockingText</th><th>LoginName</th><th>HostName'
    set @tableHTML =
    '<div><b>There is blocking in VERPSVR02-02.</b></div><br>' + -- This is the bold text at the top of your email
    '<table border="0" cellpadding="5"><font face="Calibri" size=2>' +
    '<tr><th>' + @columnHeaders + '</th></tr>' +
    convert(nvarchar(max),
    select td = [DBName], '', -- Here we put the column names
    td = [RequestId], '',
    td = [BlockingId], '',
    td = [BlockedObjectName], '',
    td = [LockType], '',
    td = [RequestingText], '',
    td = [BlockingText], '',
    td = [LoginName], '',
    td = [HostName], '' -- Here we put the column names
    from @Temp_DetailReq2
    for xml path('tr'), type)) +'</font></table>'
    END
    END
    IF @SendEmail = 'YES'
    BEGIN
    EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'MyDBMailProfileName',
    @recipients = '[email protected]',
    @body = 'Please refer the attachment' ,
    @body_format = 'HTML',
    @subject = 'Alert! Blocking On ERPSVR02-02 Live Server',
    @file_attachments = @tableHTML,
    @importance = 'High';
    END
    END

  • Attachment with Email activity....................

    Hi,I am using email activity with attachment if i deployed application on linux server than i am not able to send any attachment from email .so to resolve this issue i have to disable payload validation on EM console so if i don't do that than I got following error in my BPEL.
    <bpelFault><faultType>0</faultType><remoteFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>oracle.fabric.common.FabricInvocationException: Schema validation failed for message part EmailPayload. Please ensure at the message sender level that the data sent is schema compliant.</summary></part><part name="detail"><detail>Element not completed: 'BodyPart'</detail></part><part name="code"><code>null</code></part></remoteFault></bpelFault>
    Thanks in advance please help me friends..so how to send email attachment_ without_ disable payload validation on EM console .................
    Edited by: 835461 on Aug 11, 2011 10:52 PM

    Hi,
    When i try to send the email with attachments i am getting the below error from soa console. Please help me.
    <Oct 5, 2011 3:00:00 PM IST> <Error> <oracle.soa.services.notification> <BEA-000000> <<MDBConsumer.processNotification>
    Error for message ID 0bed1e8d948a85ed:7cbdb9db:132d35431f7:-7ff6 ERROR MESSAGE : 0;
    But I am able to send the Emails without attachments.
    Where am I going wrong ..
    Thanks,

  • Text in the email body is going as attachment through email activity

    hi ,
    In my bpel email activity the body part is going as an attachment. Even a text like 'hi' also going as an attachment where i need to download the file and need to read the content.
    Can any one help is in solving this issue.
    Thank you
    Gayaz

    hi Jyotirmoy,
    this is the format i am using
    <scope name="Email_1">
    <bpelx:annotation>
    <bpelx:pattern patternName="bpelx:email"></bpelx:pattern>
    </bpelx:annotation>
    <variables>
    <variable name="varNotificationReq"
    messageType="ns3:EmailNotificationRequest"/>
    <variable name="varNotificationResponse"
    messageType="ns3:ArrayOfResponse"/>
    <variable name="NotificationServiceFaultVariable"
    messageType="ns3:NotificationServiceErrorMessage"/>
    </variables>
    <sequence name="Sequence_2">
    <assign name="EmailParamsAssign">
    <copy>
    <from expression="string('Default')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:FromAccountName"/>
    </copy>
    <copy>
    <from expression="string('')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:Bcc"/>
    </copy>
    <copy>
    <from expression="string('')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:Cc"/>
    </copy>
    <copy>
    <from expression="string('')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:ReplyToAddress"/>
    </copy>
    <copy>
    <from expression="concat(concat(concat('RLMS ',bpws:getVariableData('inputVariable','payload','/client:AarlmsDailyWeeklySubscriptionProcessRequest/client:input')),' Subscription Alert: Uploaded and modified files for folder'), bpws:getVariableData('folderPath'))"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:Subject"/>
    </copy>
    <copy>
    <from expression="bpws:getVariableData('emailIds')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:To"/>
    </copy>
    <copy>
    <from>
    <Content xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
    <MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">multipart/mixed</MimeType>
    <ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
    <MultiPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
    <BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
    <MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
    <ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
    <BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
    </BodyPart>
    </MultiPart>
    </ContentBody>
    </Content>
    </from>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:Content"/>
    </copy>
    <copy>
    <from expression="string('text/html; charset=UTF-8')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:Content/ns3:ContentBody/ns3:MultiPart/ns3:BodyPart[1]/ns3:MimeType"/>
    </copy>
    <copy>
    <from expression="string('NotificationAttachment1.html')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:Content/ns3:ContentBody/ns3:MultiPart/ns3:BodyPart[1]/ns3:BodyPartName"/>
    </copy>
    <copy>
    <from expression="string('hi')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns3:Content/ns3:ContentBody/ns3:MultiPart/ns3:BodyPart[1]/ns3:ContentBody"/>
    </copy>
    </assign>
    <invoke name="InvokeNotificationService" partnerLink="NotificationService"
    portType="ns3:NotificationService"
    operation="sendEmailNotification"
    inputVariable="varNotificationReq"
    outputVariable="varNotificationResponse"/>
    </sequence>
    </scope>
    Thank you
    Gayaz

  • Sending Excel as attachment in Email (Unicode)

    Hi,
    I'm using SO_NEW_DOCUMENT_ATT_SEND_API1 FM to send excel attachments as emails to external addresses.
    However, this the SAP upgrade to ECC6.0 from R/3 4.6B
    then I cannot open BIG5 char excel, who does know how to sending Unicode excel as attachment in email.
    the Excel can show Chinese , BIG5 code ,Japanese ,Korea .
    OR which new funciton module in ECC6.0 like SO_NEW_DOCUMENT_ATT_SEND_API1 FM .
    Regards,
    Hank

    Hey,
    try this one.
        lv_string = str_data1.
          cl_bcs_convert=>string_to_solix(
            EXPORTING
              iv_string   = lv_string
              iv_codepage = '4103'  "suitable for MS Excel, leave empty
          iv_add_bom  = 'X'     "for other doc types
            IMPORTING
              et_solix  = binary_content
              ev_size   = size ).
        CATCH cx_bcs.
          MESSAGE e445(so).
      ENDTRY.
            send_request = cl_bcs=>create_persistent( ).
    Now  create document object from internal table with text
    document = cl_document_bcs=>create_document(
              i_type    = 'RAW'
              i_text    = main_text
              i_subject = l_var ).     
           document->add_attachment(
              i_attachment_type    = 'xls'                               i_attachment_subject = ' Details'                      i_attachment_size    = size
              i_att_content_hex    = binary_content ).
        add document object to send request
            send_request->set_document( document ).
        --------- add recipient (e-mail address) -----------------------
        create recipient object
            recipient = cl_cam_address_bcs=>create_internet_address( abc at abc.com).
           recipient = cl_cam_address_bcs=>create_internet_address( 'abc at abc.com' ).
        add recipient object to send request
            send_request->add_recipient( recipient ).
            sent_to_all = send_request->send( i_with_error_screen = 'X' ).
            COMMIT WORK.
    This will definitely work .if any doubts aask me.
    Neeraj

  • Not Able to send pdf as attachment through email

    Hi,
    I am trying to send the generated pdf as attachment throught email and for the same i am referring to this blog
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417100)ID1409662650DB01562818410448928630End?blog=/pub/wlg/8551
    but when i am trying to send the mail using the method given in this blog , i am getting this error
    com.sap.tc.adobe.pdfobject.core.PDFObjectRuntimeException: Processing exception during a "MergeData" operation. Request start time: Fri Dec 11 18:05:24 IST 2009 com.adobe.ProcessingException: PDF is not interactive. Data can only be imported into interactive forms. Exception Stack Trace: com.adobe.ProcessingException: PDF is not interactive
    and at the backend i am getting the error as
    #com.sun.mail.smtp.SMTPSendFailedException: 501 Bad address syntax
    Can any one please help me out with a solution ?? Any suggestions are welcomed
    Thanks a lot in advance

    Hi,
    Thanks for your reply , but i cannot set the enabled property of the form as true as we are not using the licensed version of the live cycle designer . But if i try the example step by step then even by setting the enabled property as false , the pdf is generated and sent through the email and when i am trying to do the same thing in one of my applications its not working . The pdf is generated but as soon as i click on the button send mail the above told error is displayed .
    There needs to be some other explaination for the error

  • How to send file as attachment in Email in Oracle UCM

    Hi All,
    I have created a simple html form which executes my custom service( internally calls java method) to send a email "forms data" to the user. I need to send file as attchment in email so how i can do it in oracle ucm.Currently i am using intradoc api.I am using a jquery plugin for sending forms data including uploaded file.
    function which i am using in java for sending emails:-
    InternetFunctions.sendMailTo(emailStr, "MyMail", subject, this.m_service);
    I have set method="post" and enctype="multipart/form-data" in the form
    So plz help to provide a solution to send a file as attchment in email
    Thanks,
    user9018217

    From what I remember, there isn't an "out of the box" solution since InternetFunctions only provides some basic email functions (try decompiling the class to see what's available).
    Here's the link for the original Stellent 10gR3 sample components: http://www.oracle.com/technetwork/middleware/content-management/index-092832.html. Take a look at the AcmeMail component within the HowTo Components sample. It shows how to create a custom idcservice that sends basic emails. You can use that as a baseline for creating your own email service and then use something like JavaMail to implement attachments. That's what I did.
    Good luck, and please award points as necessary.

  • Send Excel as attachment in Email

    Hi,
    I have an excel file attached as the original to a DIR.
    I want to send this excel file as an attachment in the external email.
    I am retrieving the data contents of original file in binary format using CVAPI_DOC_CHECKOUTVIEW
    Then I am converting binary to text using SCMS_BINARY_TO_TEXT
    and then sending the email with the data file as attachment using SO_DOCUMENT_SEND_API1.
    However, this attachment does not open when its type is .xls
    It does open with .txt, but the file is distorted and in non-understanable format.
    Regards,
    Reema

    hi,
    Check this Out...
    REPORT  ZEMAIL_ATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY
    Regards,
    Santosh

  • Send Output as attachment to email address

    Hi friends,
    My requirement is to send the Output as attachment to a specific email address.
    I have created a new output type and using transmission medium as External Send.
    If I use SH/BP/SP it is picking the mail address and working fine.
    Now my requirement is to send to fixed standard email address irrelevant of document.
    Can anyone help me to explain how can I achieve this by setting in Parner functions of that output type?
    I dont want to add any parner function in partner determination.
    Thanks in advance.
    Rgds,
    AK

    Hi there,
    Define a new customized Z table & maintain the required mail ids in the table.
    in the O/p processing prog, call the Z table & send the mail to the mail ids mentioned in it.
    For formality, assign the O/p to an partner function in your condition records.
    Regards,
    Sivanand

  • Problem in sending CSV as attachment in email

    Hi All,
    I'm working on ECC 5.0. I have an internal table with the data. I have to send this data as an attachment in an email. I sending a sample code which i used. When i try to open the attachment it is giving as warning popup 'File type is not recognized' and also the entire record in coming in the first column only.
    *& Report  ZTEST_EMAIL_SEND_ATTACH_PDF
    REPORT  ZTEST_EMAIL_SEND_ATTACH_PDF.
    class CL_ABAP_CHAR_UTILITIES definition load.
    constants:v_nl type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>newline,
         v_ht type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>horizontal_TAB,
         v_bs type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>CR_LF.
    data: begin of i_records occurs 0,
            data(30) type c,
            reason(225) type c,
          end of i_records.
    DATA: v_dest LIKE tsp01-rqdest,
          v_handle LIKE sy-tabix,
          v_spool_id LIKE tsp01-rqident,
          v_rc TYPE c,
          v_errmessage(100) TYPE c,
          v_text(200) TYPE c,
          i_pdf type standard table of tline.
    DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    START-OF-SELECTION.
    i_records-data = '1002'.
    i_records-reason = 'date is empty'.
    append i_records.
    clear i_records.
    i_records-data = '1005'.
    i_records-reason = 'time is empty'.
    append i_records.
    clear i_records.
    loop at i_records.
    concatenate i_records-data i_records-reason into objbin-line separated by ','.
    concatenate v_nl objbin-line into objbin-line.
    append objbin.
    clear: i_records, objbin.
    endloop.
    perform f_mail_send.
    *&      Form  f_mail_send
          text
    -->  p1        text
    <--  p2        text
    form f_mail_send .
    DATA: i_email TYPE TABLE OF somlreci1 WITH HEADER LINE,
          i_mess TYPE TABLE OF solisti1 WITH HEADER LINE,
          w_subject TYPE so_obj_des,
         w_name TYPE so_obj_nam.
          w_name TYPE char30.
    i_email-receiver = '[email protected]'.
    APPEND i_email.
    i_mess-line = 'This is a test message. Customer Statements'.
    APPEND i_mess.
    w_name = 'Statements_345594_344455_conv'.
    w_subject = 'Your Customer Statement for'.
    PERFORM send_mail_out_raw TABLES i_email
                                     i_mess
                              USING  w_subject
                                     w_name.
    endform.                    " f_mail_send
    *&      Form  send_mail_out_raw
          text
         -->PI_EMAIL   text
         -->PI_MESS    text
         -->PI_PDF     text
         -->PV_SUBJECT text
         -->PV_NAME    text
    FORM send_mail_out_raw TABLES pi_email STRUCTURE somlreci1
                                  pi_mess STRUCTURE solisti1 "Message
                            USING pv_subject TYPE so_obj_des
                                  pv_name TYPE char30.
      DATA :
        li_receivers TYPE STANDARD TABLE OF somlreci1,
        li_head TYPE STANDARD TABLE OF solisti1,
        li_packing_list TYPE STANDARD TABLE OF sopcklsti1,
        li_pdf TYPE STANDARD TABLE OF solisti1.
      DATA : lst_doc_data TYPE sodocchgi1,
             lw_lines    TYPE i,
             lw_name(34) TYPE c,
             lw_subject TYPE sodocchgi1-obj_descr.
      DATA : lst_pemail TYPE somlreci1,
             lst_pmess TYPE solisti1,
             lst_receivers TYPE somlreci1,
             lst_head TYPE solisti1,
             lst_packing_list TYPE sopcklsti1,
             lst_mess TYPE solisti1.
      lw_subject = pv_subject.
      lw_name = pv_name.
      CONCATENATE lw_name '.csv' INTO lw_name.
      CONDENSE lw_name NO-GAPS.
    Fill the email content
      DESCRIBE TABLE pi_mess LINES lw_lines.
    Populate the subject/generic message attributes
      lst_doc_data-obj_langu = sy-langu.
      lst_doc_data-obj_name  = lw_name.
      lst_doc_data-obj_descr = lw_subject.
      READ TABLE pi_mess INTO lst_mess INDEX lw_lines.
      lst_doc_data-doc_size = ( lw_lines - 1 ) * 255 +
                              STRLEN( lst_mess ).
    Describe the body of the message
      REFRESH li_packing_list.
      lst_packing_list-transf_bin = space.
      lst_packing_list-head_start = 1.
      lst_packing_list-head_num = 0.
      lst_packing_list-body_start = 1.
      lst_packing_list-body_num = lw_lines.
      lst_packing_list-doc_type = 'RAW'.
      lst_packing_list-doc_size = ( lw_lines - 1 ) * 255 +
                                  STRLEN( lst_mess ).
      APPEND lst_packing_list TO li_packing_list.
      CLEAR lst_packing_list.
    Create attachment
      CLEAR lw_lines.
      DESCRIBE TABLE objbin LINES lw_lines.
      lst_packing_list-transf_bin = 'X'.
      lst_packing_list-head_start = 1.
      lst_packing_list-head_num   = 1.
      lst_packing_list-body_start = 1.
      lst_packing_list-body_num   = lw_lines.
      lst_packing_list-doc_type   =  'CSV'.
      lst_packing_list-obj_descr  =  lw_subject.
      lst_packing_list-obj_name   =  lw_name.
      lst_packing_list-doc_size   =  ( lw_lines ) * 255.
      APPEND lst_packing_list TO li_packing_list.
    Header
      REFRESH li_head.
      CLEAR lst_head. REFRESH li_head.
      lst_head-line = lw_name. APPEND lst_head TO li_head.
    Add the recipients email address
      REFRESH li_receivers.
      LOOP AT pi_email INTO lst_pemail.
        lst_receivers-receiver = lst_pemail-receiver.
        lst_receivers-rec_type = 'U'.
        lst_receivers-com_type = 'INT'.
        APPEND lst_receivers TO li_receivers.
        CLEAR lst_receivers.
      ENDLOOP.
    *Send mail to external address
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
         document_data              = lst_doc_data
         put_in_outbox              = 'X'
         commit_work                = 'X'
       TABLES
         packing_list               = li_packing_list
         object_header              = li_head
         contents_bin               = objbin
         contents_txt               = pi_mess
         receivers                  = li_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.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                   = lst_doc_data
         PUT_IN_OUTBOX                    = 'X'
         COMMIT_WORK                      = 'X'
      IMPORTING
        SENT_TO_ALL                      =
        NEW_OBJECT_ID                    =
        tables
          packing_list                     = li_packing_list
         OBJECT_HEADER                    = li_head
         CONTENTS_BIN                     = objbin
         CONTENTS_TXT                     = pi_mess
        CONTENTS_HEX                     =
        OBJECT_PARA                      =
        OBJECT_PARB                      =
          receivers                        = li_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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "Send_mail
    Sai

    Hi sai,
    1. I just tried it now.
    2. And it works ok now.
    3. Just make 2 corrections.
      a) replace your definition of new_line with.
    <b>constants:v_nl(2) type c value CL_ABAP_CHAR_UTILITIES=>CR_LF,</b>
    b) Instead of using    concatenate v_nl objbin-line into objbin-line.
       use
    <b>  concatenate  objbin-line v_nl into objbin-line.</b>
    regards,
    amit m.

  • Upload a .xls file and send it as attachment on email

    Hi guys,
    I have a program that creates a .xls file using the function module call method cl_gui_frontend_services=>gui_download. I've been trying to upload the file as an attachment to send it via email but still haven't found a way to do this task.
    Appreciate your help,
    Thanks 

    Hi Orlando,
    convert content to Hex format then,
    lw_document = cl_document_bcs=>create_document(
               i_type    = 'RAW / HTM'
               i_text    = lw_main_text
               i_subject = lw_subject ).
          w_document->add_attachment(
             i_attachment_type    = 'XLS'
             i_attachment_subject = lw_att_sub
             i_att_content_text   = p_int_soli[]
             i_att_content_hex    = p_int_solix[] ).
    w_int_address = lw_smtp-low.
                 w_camuser = cl_cam_address_bcs=>create_internet_address( w_int_address ).
                 w_recipient = w_camuser.
    thanks,
    Anil

  • Xml file attachment in email

    I'm trying to attach a piece of XML in an email. In 10.1.2 this works ok; I used orcl:get-content-as-string(bpws:getVariableData('OutputVariable','RELATIONS')) and put that into the ContentBody of an email.
    In 10.1.3.1 this does not work anymore.
    orcl:get-content-as-string is no longer available so I used ora:getContentAsString instead. So far so good.
    I also had to use a mime type of text/html because with text/xml I get java.io.IOException: Unable to write XML attachment java.lang.String and java.lang.ClassCastException: java.lang.String errors allthough BPEL Console does not show an error.
    With mime type text/html I get an email with an attachment but the content of the XML is not escaped; a tag like <NAME>John & Jack</NAME> should be <NAME>John &amp;amp; Jack</NAME>
    does anyone have a clue or a solution that works in 10.1.3.1

    Hi
    There is a bug : 6083186 logged on the same issue.
    "PROBLEMS WITH ESCAPED XML IN BPEL 10.1.3.1.0"
    Cheers
    Anirudh Pucha

  • Xml attachment and email

    HI i have to send xml as attachment in an email.
    I am able create xml  do is by below sample code:
          Creating a ixml factory
    l_ixml = cl_ixml=>create( ).
          Creating the dom object model
    l_document = l_ixml->create_document( ).
          Fill root node with value flights
    l_element_flights  = l_document->create_simple_element(
                name = 'root'
                parent = l_document ).
    l_element_airline  = l_document->create_simple_element(
                name = 'cartHeader'
                parent = l_element_flights  ).
    l_value = wa_orderh-object_id.
    l_rc = l_element_airline->set_attribute( name = 'cartNumber' value = l_value ).
    l_value = wa_orderh-description.
    l_rc = l_element_airline->set_attribute( name = 'cartDescription' value = l_value ).
    l_value = wa_orderh-description.
    l_rc = l_element_airline->set_attribute( name = 'cartDescription' value = l_value ).
    READ TABLE t_partner INTO wa_partner WITH KEY ref_guid = wa_orderh-guid
                                                  partner_fct = '00000001'.
    l_value = wa_partner-partner_no.
    l_rc = l_element_airline->set_attribute( name = 'Soldto' value = l_value ).
    READ TABLE t_cumulate INTO wa_cumulate WITH KEY guid = wa_orderh-guid.
    l_value = wa_cumulate-net_value.
    l_rc = l_element_airline->set_attribute( name = 'netValue' value = l_value ).
    l_value = wa_cumulate-tax_amount.
    l_rc = l_element_airline->set_attribute( name = 'tax' value = l_value ).
    l_value = wa_cumulate-gross_value.
    l_rc = l_element_airline->set_attribute( name = 'grossValue' value = l_value ).
    DESCRIBE TABLE t_item LINES v_lines.
    l_value = v_lines.
    l_rc = l_element_airline->set_attribute( name = 'TotalItems' value = l_value ).
    l_value = sy-datum.
    l_rc = l_element_airline->set_attribute( name = 'extractDate' value = l_value ).
    l_value = sy-uzeit.
    l_rc = l_element_airline->set_attribute( name = 'extractTime' value = l_value ).
    l_value = sy-zonlo.
    l_rc = l_element_airline->set_attribute( name = 'extractTimeZone' value = l_value ).
    LOOP AT t_item INTO wa_item.
    l_element_airline  = l_document->create_simple_element(
                name = 'cartItems'
                parent = l_element_flights  ).
      l_value = wa_item-ordered_prod.
      l_rc = l_element_airline->set_attribute( name = 'productId' value = l_value ).
      l_value = wa_item-description.
      l_rc = l_element_airline->set_attribute( name = 'productDescription' value = l_value ).
      READ TABLE t_schedlin INTO wa_schedlin WITH KEY item_guid = wa_item-guid.
      l_value = wa_schedlin-quantity.
      l_rc = l_element_airline->set_attribute( name = 'Quantity' value = l_value ).
      l_value = wa_schedlin-quantity.
      l_rc = l_element_airline->set_attribute( name = 'Quantity' value = l_value ).
      READ TABLE t_product_i INTO wa_product_i WITH KEY guid = wa_item-guid.
      l_value = wa_product_i-base_qty_unit.
      l_rc = l_element_airline->set_attribute( name = 'UOM' value = l_value ).
      l_value = wa_item-number_int.
      l_rc = l_element_airline->set_attribute( name = 'itemNumber' value = l_value ).
      READ TABLE t_item INTO wa_item1 WITH KEY parent = wa_item-guid.
      l_value = wa_item1-number_int.
      l_rc = l_element_airline->set_attribute( name = 'itemParentNumber' value = l_value ).
      READ TABLE t_pricingi INTO wa_pricingi WITH KEY guid = wa_item-guid.
      l_value = wa_pricingi-net_value.
      l_rc = l_element_airline->set_attribute( name = 'netValue' value = l_value ).
      l_value = wa_pricingi-tax_amount.
      l_rc = l_element_airline->set_attribute( name = 'tax' value = l_value ).
      l_value = wa_pricingi-gross_value.
      l_rc = l_element_airline->set_attribute( name = 'grossValue' value = l_value ).
      READ TABLE t_partner INTO wa_partner WITH KEY ref_guid = wa_orderh-guid
                                                    partner_fct = '00000001'.
      l_value = wa_partner-partner_no.
      l_rc = l_element_airline->set_attribute( name = 'Shipto' value = l_value ).
    ENDLOOP.
      Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
      Connect internal XML table to stream factory
    l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
      Rendering the document
    l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                          document = l_document ).
    l_rc = l_renderer->render( ).
      Saving the XML document
    l_xml_size = l_ostream->get_num_written_raw( ).
    Now l_xml_table has got some data which has got some numbers - something like this ...
    1. 3C3F786D6C2076657273696F6E3D22312E30223F3E3C726F6F743E3C636172744865616465<
    2. 3D224D38363638422F41222070726F647563744465736372697074696F6E3D225853455256<   and so on records in internal table.
    Now i want to send an emai with attachment as xml file. I am using so_object_send.. i used this FM and was successfully able to send pdf.. can anyboday help me in sending xml file..
    thanks
    Niraja
    Edited by: Niraja on Aug 27, 2010 8:21 PM

    i m pasting tghe code again. . pls help
          Creating a ixml factory
    l_ixml = cl_ixml=>create( ).
          Creating the dom object model
    l_document = l_ixml->create_document( ).
          Fill root node with value flights
    l_element_flights  = l_document->create_simple_element(
                name = 'root'
                parent = l_document ).
    l_element_airline  = l_document->create_simple_element(
                name = 'cartHeader'
                parent = l_element_flights  ).
    l_value = wa_orderh-object_id.
    l_rc = l_element_airline->set_attribute( name = 'cartNumber' value = l_value ).
    l_value = wa_orderh-description.
    l_rc = l_element_airline->set_attribute( name = 'cartDescription' value = l_value ).
    l_value = wa_orderh-description.
    l_rc = l_element_airline->set_attribute( name = 'cartDescription' value = l_value ).
    READ TABLE t_partner INTO wa_partner WITH KEY ref_guid = wa_orderh-guid
                                                  partner_fct = '00000001'.
    l_value = wa_partner-partner_no.
    l_rc = l_element_airline->set_attribute( name = 'Soldto' value = l_value ).
    READ TABLE t_cumulate INTO wa_cumulate WITH KEY guid = wa_orderh-guid.
    l_value = wa_cumulate-net_value.
    l_rc = l_element_airline->set_attribute( name = 'netValue' value = l_value ).
    l_value = wa_cumulate-tax_amount.
    l_rc = l_element_airline->set_attribute( name = 'tax' value = l_value ).
    l_value = wa_cumulate-gross_value.
    l_rc = l_element_airline->set_attribute( name = 'grossValue' value = l_value ).
    DESCRIBE TABLE t_item LINES v_lines.
    l_value = v_lines.
    l_rc = l_element_airline->set_attribute( name = 'TotalItems' value = l_value ).
    l_value = sy-datum.
    l_rc = l_element_airline->set_attribute( name = 'extractDate' value = l_value ).
    l_value = sy-uzeit.
    l_rc = l_element_airline->set_attribute( name = 'extractTime' value = l_value ).
    l_value = sy-zonlo.
    l_rc = l_element_airline->set_attribute( name = 'extractTimeZone' value = l_value ).
    LOOP AT t_item INTO wa_item.
    l_element_airline  = l_document->create_simple_element(
                name = 'cartItems'
                parent = l_element_flights  ).
      l_value = wa_item-ordered_prod.
      l_rc = l_element_airline->set_attribute( name = 'productId' value = l_value ).
      l_value = wa_item-description.
      l_rc = l_element_airline->set_attribute( name = 'productDescription' value = l_value ).
      READ TABLE t_schedlin INTO wa_schedlin WITH KEY item_guid = wa_item-guid.
      l_value = wa_schedlin-quantity.
      l_rc = l_element_airline->set_attribute( name = 'Quantity' value = l_value ).
      l_value = wa_schedlin-quantity.
      l_rc = l_element_airline->set_attribute( name = 'Quantity' value = l_value ).
      READ TABLE t_product_i INTO wa_product_i WITH KEY guid = wa_item-guid.
      l_value = wa_product_i-base_qty_unit.
      l_rc = l_element_airline->set_attribute( name = 'UOM' value = l_value ).
      l_value = wa_item-number_int.
      l_rc = l_element_airline->set_attribute( name = 'itemNumber' value = l_value ).
      READ TABLE t_item INTO wa_item1 WITH KEY parent = wa_item-guid.
      l_value = wa_item1-number_int.
      l_rc = l_element_airline->set_attribute( name = 'itemParentNumber' value = l_value ).
      READ TABLE t_pricingi INTO wa_pricingi WITH KEY guid = wa_item-guid.
      l_value = wa_pricingi-net_value.
      l_rc = l_element_airline->set_attribute( name = 'netValue' value = l_value ).
      l_value = wa_pricingi-tax_amount.
      l_rc = l_element_airline->set_attribute( name = 'tax' value = l_value ).
      l_value = wa_pricingi-gross_value.
      l_rc = l_element_airline->set_attribute( name = 'grossValue' value = l_value ).
      READ TABLE t_partner INTO wa_partner WITH KEY ref_guid = wa_orderh-guid
                                                    partner_fct = '00000001'.
      l_value = wa_partner-partner_no.
      l_rc = l_element_airline->set_attribute( name = 'Shipto' value = l_value ).
    ENDLOOP.
      Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
      Connect internal XML table to stream factory
    l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
      Rendering the document
    l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                          document = l_document ).
    l_rc = l_renderer->render( ).
      Saving the XML document
    l_xml_size = l_ostream->get_num_written_raw( ). }

Maybe you are looking for