Esacping in XML via ABAP CL_IXML functions?

Hello Partners:
I was going through some work of XML integration of SAP with a third-party. But came across an issue:
The text descriptions we are sending within an XML tag has certain special characters like '&'. But the XML parser is not escaping it. Hence its replacing '&' with '&' in the XML data string. So now I need to understand how can we implement escaping via ABAP for generated XML strings? Can you all please help me to understand which methods to use and how?
It will be much appreciated.
Thanks in advance.
Vivek Singh.

Hi,
It got escaped in this message I posted!
The issue is "&" being replaced by "& a m p ;". Please ignore the spaces in the latter, I have put it purposely to avoid the 'amp;' from being escaped when the browser parses this message.
Thanks.

Similar Messages

  • Parse XML streams via ABAP program or class

    Hi all,
    because of a new requirement we would like to create characteristics from a XML file by using the following structure.  
    xmlns:gdt="http://sap.com/xi/SAPGlobal/Global" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    We do not use SAP XI but I would like to parse the XML stream from a file in order to have the information available in a ABAP program. For this reason I'm looking for a standard SAP ABAP program or class to read and parse such a XML file. 
    I would appreciate if somebody have more details on this topic.

    Check this out.
    XML to ABAP
    Regards,
    Rich Heilman

  • How to extract data from BPC InfoCube via ABAP program?

    Hi experts!!
    I tried to extract data from a BPC InfoCube via ABAP program, but I did'n have succeed.
    I used the function 'RSDRI_INFOPROV_READ' to extract data from standard InfoCubes such as '0COPC_C07' and it run OK! However, when I change the InfoCube name to '/CPMB/WAIX8NE' (BPC InfoCube), everything goes wrong...
    Is there any difference between extracting data from BPC and standard InfoCubes?
    Thank you all!

    Moderator message - Welcome to SCN.
    But please do not cross and duplicate post.
    Thread locked.
    Rob

  • Delete Overlapping Requests - by Filename via ABAP Routine

    Hi SDN Community
    Do you know if it is possible to set the delete overlapping request parameters to recoginse the file name, and remove it via the derivation of the file name via an ABAP Routine.
    I am using an ABAP routine to derive the flat flat file upon loading, but do not know the syntax, or if it is possible to set this equivalent code into the delete overlapping request Routine area
    (The code basically derives the first day of the calendar week, for previous weeks in the Do n times Loop
    Thank you.
    Simon
    DATA: ld_CWEEK         TYPE scal-week,
          ld_DATE          TYPE SY-DATUM,
          ld_DATE1         TYPE SY-DATUM,
          lc_DIRECTORY(30) TYPE c,
          ln_YYYY(4)       TYPE n,
          ln_WW(2)         TYPE n.
    *Derive week from sy-datum
    ld_date = SY-DATUM.
    Determine the calendar week from the entered calendar date
      CALL FUNCTION 'DATE_GET_WEEK'
        EXPORTING
          date           = ld_date
        IMPORTING
          week          = ld_cweek
        EXCEPTIONS
          date_invalid = 1
          OTHERS        = 2.
    Get the First day of the week
            CALL FUNCTION 'WEEK_GET_FIRST_DAY'
              EXPORTING
                week         = ld_CWEEK
              IMPORTING
                date         = ld_DATE1
              EXCEPTIONS
                week_invalid = 1
                OTHERS       = 2.
      Need to find the previous calendar week and reconvert to the first
      day in order to accomodate weeks less than 7 days
      Get the last day of the current calendar week - 2
        DO 2 TIMES.
            ld_DATE1 = ld_DATE1 - 1.
    Determine the calendar week from the last day of the previous week
            CALL FUNCTION 'DATE_GET_WEEK'
              EXPORTING
                date         = ld_DATE1
              IMPORTING
                week         = ld_CWEEK
              EXCEPTIONS
                date_invalid = 1
                OTHERS       = 2.
    Get the First day of the week
              CALL FUNCTION 'WEEK_GET_FIRST_DAY'
                EXPORTING
                  week         = ld_CWEEK
                IMPORTING
                  date         = ld_DATE1
                EXCEPTIONS
                  week_invalid = 1
                  OTHERS       = 2.
        ENDDO.
    *ln_YYYY = ld_CWEEK(4).
    ln_YYYY = ld_DATE1(4).
    ln_WW = ld_CWEEK+4(2).
    *DIRECTORY represnts path where file is stored .
    lc_DIRECTORY = '/interfaces/EDW/data/CSM/'.
    CONCATENATE lc_DIRECTORY
    ld_date '_WEEK' ln_WW '_c1_pri_' ln_YYYY '.csv' into p_filename.
      'MIC_NT_' ld_date1 '_' ln_YYYY '.csv' into p_filename.

    Thank you for your response Debanshu
    However, i could not find this process type in the process chain area.
    Is this where you meant, can you please give me more detailed steps including long syntax of names of process types
    We are on BW 3.50
    i assumed the filename had to be constructed via abap according to some of the sdn replies i've searched through.
    Thank you.
    Simon

  • XML to ABAP Using XSLT

    Hello friends,
        I am trying a ABAP program (posted on SDN) to convert XML into ABAP (internal table) and not having any luck. Either it is my table/structure declaration or XSLT. Could any of you experts give me a hand with it please?
    Thanks in advance..but points on help!
    Here is my XML:
    And my ABAP program:
    REPORT  ZTESTXMLREAD.
    TYPE-POOLS: abap, ixml.
      class cl_ixml definition load.
    TYPES: BEGIN OF t_dc40,
             docnum(17) TYPE  C,
             status(2)  TYPE  C,
           END   OF t_dc40.
    TYPES: BEGIN OF t_emkt,
             spras(2)   TYPE  C,
             maktx(35)  TYPE  C,
           END   OF t_emkt.
    TYPES: BEGIN OF t_emrm,
             matnr(12)  TYPE  C,
             ersda(8)   TYPE  C,
             ernam(25)  TYPE  C,
             emktx      TYPE  t_emkt,
           END   OF t_emrm.
    TYPES: BEGIN OF t_mm,
             dc40   TYPE  t_dc40,
             emrm   TYPE  t_emrm,
           END   OF t_mm.
    DATA: l_ixml            TYPE REF TO if_ixml,
          l_streamfactory   TYPE REF TO if_ixml_stream_factory,
          l_istream         TYPE REF TO if_ixml_istream.
    DATA: l_filename        TYPE string.
    DATA: it_airplus    TYPE STANDARD TABLE OF t_mm,
          wa_airplus    TYPE t_mm.
    *Errorvariables
    DATA: xslt_err   TYPE REF TO cx_xslt_exception,
          err_string TYPE string.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:Test.XML'.
    START-OF-SELECTION.
      Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
      Creating input stream
        l_istream = l_streamfactory->create_istream_uri( 'file://c:Test.xml' ).
    here we use the CALL TRANSFORMATION method which calls
    TRY.
        CALL TRANSFORMATION ZTestXSLT
          SOURCE xml l_istream
          RESULT xml_output = it_airplus
    catch any error, very helpful if the XSLT isn't correct
        CATCH cx_xslt_exception INTO xslt_err.
        err_string = xslt_err->get_text( ).
        WRITE: / 'Transformation error: ', err_string.
        EXIT.
      ENDTRY.
    setting a breakpoint to watch the workarea
    by the internal table "it_airplus"
           break-point.
      LOOP AT it_airplus INTO wa_airplus.
      ENDLOOP.

    Thank you Durairaj, as a matter of fact my program is based on your post (one that you pointed me to). For whatever reason I'm not having luck figuring it out (may be just a bit of work pressure) could you please hlep me a bit more by pointing me to where in my program code/xslt I'm going wrong? I somehow feel that it could be my table structure or xslt.
    I would really appreciate it!
    Thanks again,
    erfan.

  • XML to ABAP Conversion

    Hi Experts,
    I am using SFP transaction.
       CALL METHOD cl_gui_frontend_services=>file_open_dialog
    CHANGING
    file_table = lt_file_table
    rc = lv_rc
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error = 2
    error_no_gui = 3
    not_supported_by_gui = 4
    OTHERS = 5.
    READ TABLE lt_file_table
    INTO lv_filename
    INDEX 1.
    cl_gui_frontend_services=>gui_upload(
    EXPORTING
    filename = lv_filename
    filetype = 'BIN' "Binary
    IMPORTING
    filelength = lv_filelength
    CHANGING
    data_tab = lt_rawtab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    not_supported_by_gui = 17
    error_no_gui = 18
    OTHERS = 19 ).
    Get FP reference
    DATA: lo_fp TYPE REF TO if_fp VALUE IS INITIAL.
    lo_fp = cl_fp=>get_reference( ).
    For handling exceptions
    DATA: lo_fpex TYPE REF TO cx_fp_runtime VALUE IS INITIAL.
    TRY.
    Create PDF Object using destination 'ADS' (<-- this is how it is
    defined in SM59)
    DATA: lo_pdfobj TYPE REF TO if_fp_pdf_object VALUE IS INITIAL.
    lo_pdfobj = lo_fp->create_pdf_object( connection = 'ADS' ).
    FIELD-SYMBOLS: <ls_rawtab> LIKE LINE OF lt_rawtab.
    Move to XSTRING
    LOOP AT lt_rawtab ASSIGNING <ls_rawtab>.
    CONCATENATE pdf_data <ls_rawtab>-data INTO pdf_data IN BYTE MODE.
    ENDLOOP.
    Set document
    lo_pdfobj->set_document(
    EXPORTING
    pdfdata = PDF_DATA).
    CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
      EXPORTING
        IM_XSTRING = XML_DATA
      IMPORTING
        EX_STRING  = LV_XML_DATA_STRING.
    Remove NEW-LINE character from XML data in STRING format
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    REPLACE ALL OCCURrENCES OF cl_abap_char_utilities=>newline IN
    lv_xml_data_string WITH ''.
    Make the XML envelope compliant with identity transform
    REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'
    IN lv_xml_data_string
    WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns :asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.
    REPLACE '</data>' IN lv_xml_data_string WITH '</asx:values></asx:abap>'.
    Apply the identity transform and convert XML into ABAP in one step
    CALL TRANSFORMATION ('ID')
    SOURCE XML lv_xml_data_string
    RESULT out = out.
    But getting error
    Short text
        XSLT: No valid XML source
    Runtime Errors         XSLT_BAD_SOURCE_CONTEXT
    Except.                CX_XSLT_RUNTIME_ERROR
    How i call -->call transforamtion...Can any one please tell me how to convert XML to abap internal table?...
    Thanks

    Hi,
       I just catch the exception.
    Regards,
    Mathi

  • XML transformation -- abap

    Hi Experts, I need help with this XSLT for call transformation. I have defined an internal table and intend to use it as a source for Call Tranformation. But I have Problems to defining my internal table to get the resut of the function transformation.(SAP 4.7)
    In my case i have a xml with attibutes and i can't store these attibutes in internal table.
    Hope to hear from any of u soon!
    CMA
    <--XSLT--
    >
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/abapxml" version="1.0">
      <xsl:template match="//Catalog">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml">
          <asx:values>
            <CATALOG>
              <!-- Boucle catalogue -->
              <xsl:for-each select="EnTete">
                <ENTETE>
                  <EMETTEUR>
                    <xsl:value-of select="Emetteur"/>
                  </EMETTEUR>
                  <DATEPUBLICATION>
                    <xsl:value-of select="DatePublication"/>
                  </DATEPUBLICATION>
                  <!-- Suite -->
                  <xsl:for-each select="Univers">
                    <UNIVERS>
                      <LIBELLE>
                        <xsl:value-of select="@libelle"/>
                      </LIBELLE>
                      <OBJREF>
                        <xsl:value-of select="@objref"/>
                      </OBJREF>
                      <OBJID>
                        <xsl:value-of select="@objid"/>
                      </OBJID>
                      <EMETTEUR>
                         <xsl:value-of select="Emetteur"/>
                     </EMETTEUR>
                    </UNIVERS>
                  </xsl:for-each>
                </ENTETE>
              </xsl:for-each>
              <!-- ENTETE-->
            </CATALOG>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    <--XML--
    >
    <?xml version="1.0" encoding="UTF-8"?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml">
    <asx:values>
    <Catalog>
         <EnTete>
              <Emetteur>UGAP</Emetteur>
              <DatePublication>27/06/2007 09:20:02</DatePublication>
                  <Univers libelle="Nettoyage, hygine et entretien"  objref="08" objid="374417o.bemp" >
                     <Emetteur>UGAP</Emetteur>
                  </Univers>
               <Univers libelle="Nettoyage, hygine et entretien"  objref="09" objid="374417o.bemp" >
                     <Emetteur>UGAP</Emetteur> 
                  </Univers>
    </EnTete>       
    </Catalog>
    </asx:values>
    </asx:abap>
    <--abap--
    >
    TYPES: BEGIN OF t_universs,
           libelle(35),
           objref(35),
           objid(35),
          boutique  TYPE t_boutique,
           END OF t_universs.
    TYPES: t_univers TYPE t_universs OCCURS 0.
                   UNIVERS                 *
    TYPES: BEGIN OF t_entetes,
                Emetteur(20),
                DatePublication(30),
                UNIVERS  TYPE t_univers,
             END OF t_entetes.
    *TYPES: t_entete TYPE t_entetes OCCURS 0.
    DATA: it_data    TYPE STANDARD TABLE OF t_entetes,
          wa_data    TYPE t_entetes.
    PARAMETER p_file(200) DEFAULT '/tmp/catalogue4.xml' LOWER CASE .
    start-of-selection.
    DATA: dsn(20) VALUE '/usr/catalogue2.xml',
          msg(100).
    data : l_sysubrc like sy-subrc.
    *OPEN DATASET p_file FOR INPUT MESSAGE msg
                    IN TEXT MODE ENCODING DEFAULT.
    OPEN DATASET p_file FOR INPUT IN BINARY MODE.
    IF sy-subrc = 0.
    CLEAR : gv_read_xml.
    clear l_sysubrc.
    READ DATASET p_file INTO gv_read_xml.
    Transformation XML en ABAP-DATA
    PERFORM check_xml USING gv_read_xml.
    CLOSE DATASET p_file.
    ENDIF.
    *& Form check_xml
    FORM check_xml USING p_xml TYPE string.
    DATA: cx_runtime_error TYPE REF TO cx_xslt_runtime_error.
    DATA: cx_format_error TYPE REF TO cx_xslt_format_error.
    DATA: err_text TYPE string.
    DATA: lt_xml TYPE STANDARD TABLE OF typ_xml,
          ls_xml TYPE typ_xml,
          source_xml TYPE string,
          lt_result_xml TYPE abap_trans_resbind_tab,
          ls_result_xml TYPE abap_trans_resbind.
    TRY.
    CALL TRANSFORMATION ZUGAP
    SOURCE XML p_xml
    RESULT CATALOG = it_data.
    ENDTRY.
    LOOP AT it_data INTO wa_data.
    ENDLOOP.
    i'm wonder if is it possible to get attribute from xml with abap function transformation...
    Hope to hear from any of u soon!

    Hi Marcelo,
    Thanks a lot for your reply, your code is very usefull but my problem is located around the XSLT file.
    With my progam (abap), I can't read the attibutes from a XML file correctly because the XSLT have not the suitable tags.
    In my XML i have 2 rows of "Univers" and after use the function transformation from abap i can store only 1 rows in internal table   :
    <Catalog>
         <EnTete>
              <Emetteur>UBB</Emetteur>
                  <b><Univers libelle="Nettoyage, hygine et entretien"  objref="08">
                  </Univers>
                  <Univers libelle="Nettoyage, hygine et entretien"  objref="09">
                  </Univers></b>     
                  </EnTete>       
    </Catalog>
    XSLT :
    <xsl:for-each select="EnTete">
                <ENTETE>
                  <EMETTEUR>
                    <xsl:value-of select="Emetteur"/>
                  </EMETTEUR>
                   <xsl:for-each select="Univers">
                    <UNIVERS>
                      <UNIVERS1>
                        <LIBELLE> <xsl:value-of select="@libelle"/></LIBELLE>
                        <OBJREF> <xsl:value-of select="@objref"/>  </OBJREF>
                      </UNIVERS1>
                    </UNIVERS>
                   </xsl:for-each>
                </ENTETE>
              </xsl:for-each>
    My question is : How can i do to define attributes in XSLT to allow read them by a program abap ?
    In my example, the program abap get only 1 attribute in my iternal table, what is the suitable syntax in the xslt to read all the attributes  ?
    Hope to hear from any of u soon!
    Christophe.

  • How to assign an output type to a document via ABAP

    Hello Guru's
    I have an interface with a 3rd party system to send information from deliveries. When a delivery is created, we trigger output with 'Post goods issue' and output triggers the interface.
    We need to also trigger output with 'reverse goods issue' and here is the problem. When GI is cancelled I don't know how to trigger the interface having the control from Sales not from MM.
    I'm thinking to use the same approach assigning an output to the delivery in a user-exit of GI cancellation process. But I don't know how to assign this output to a delivery document using ABAP. I have looked for BAPI's or Functions but no successful.
    - Do you know how to assign outputs to documents via ABAP?
    - Do you have any other idea to trigger the interface when GI is cancelled?
    Thank you in advance,
    Manuel

    Hi,
    Guess u need to maintain it in SPAD transaction.
    Cheers
    VJ

  • Send a mail via ABAP program

    Hello Experts,
    I want to send mail via ABAP program with the following requirements :
    1. Recipient is OUTLOOK email -id
    2. Sender address has to be an external email-id
    3. Send mail as CC and BCC also to other email-id.
    Is there any function module which can satisfy all the above requirements.
    Regards,
    Mansi.

    hi,
    this code will definately help you just go through it:
    firstly  exported the data to memory using the FM LIST_FROM_MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_listobject
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE e000(su) WITH text-001.
    ENDIF.
    then i converted it into ASCII using LIST_TO_ASCI,
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = t_xlstab
    listobject = t_listobject
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    IF sy-subrc NE 0.
    MESSAGE e003(yuksdbfzs).
    ENDIF.
    This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
    cl_abap_char_utilities=>horizontal_tab.
    Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
    This will create an excel attachment.
    Sample code for formatting the data for the attachment in excel format.
    u2022     Format the data for excel file download
    LOOP AT t_xlstab INTO wa_xlstab .
    DESCRIBE TABLE t_xlstab LINES lw_cnt.
    CLEAR lw_sytabix.
    lw_sytabix = sy-tabix.
    u2022     If not new line then replace '|' by tabs
    IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
    REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
    WITH cl_abap_char_utilities=>horizontal_tab.
    MODIFY t_xlstab FROM wa_xlstab .
    CLEAR wa_xlstab.
    wa_xlstab = cl_abap_char_utilities=>newline.
    IF lw_cnt NE 0 .
    lw_sytabix = lw_sytabix + 1.
    u2022     Insert new line for the excel data
    INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
    lw_cnt = lw_cnt - 1.
    ENDIF.
    CLEAR wa_xlstab.
    ENDIF.
    ENDLOOP.
    Sample code for creating attachment and sending mail:
    FORM send_mail .
    u2022     Define the attachment format
    lw_doc_type = 'XLS'.
    u2022     Create the document which is to be sent
    lwa_doc_chng-obj_name = 'List'.
    lwa_doc_chng-obj_descr = w_subject. "Subject
    lwa_doc_chng-obj_langu = sy-langu.
    u2022     Fill the document data and get size of message
    LOOP AT t_message.
    lt_objtxt = t_message-line.
    APPEND lt_objtxt.
    ENDLOOP.
    DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
    IF lw_tab_lines GT 0.
    READ TABLE lt_objtxt INDEX lw_tab_lines.
    lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    lwa_doc_chng-obj_langu = sy-langu.
    lwa_doc_chng-sensitivty = 'F'.
    ELSE.
    lwa_doc_chng-doc_size = 0.
    ENDIF.
    u2022     Fill Packing List For the body of e-mail
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = 'RAW'.
    APPEND lt_packing_list.
    u2022     Create the attachment (the list itself)
    DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
    u2022     Fill the fields of the packing_list for creating the attachment:
    lt_packing_list-transf_bin = 'X'.
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = lw_doc_type.
    lt_packing_list-obj_name = 'Attach'.
    lt_packing_list-obj_descr = w_docdesc.
    lt_packing_list-doc_size = lw_tab_lines * 255.
    APPEND lt_packing_list.
    u2022     Fill the mail recipient list
    lt_reclist-rec_type = 'U'.
    LOOP AT t_recipient_list.
    lt_reclist-receiver = t_recipient_list-address.
    APPEND lt_reclist.
    ENDLOOP.
    u2022     Finally send E-Mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = lw_sent_to_all
    TABLES
    packing_list = lt_packing_list
    object_header = lt_objhead
    contents_bin = t_xlstab
    contents_txt = lt_objtxt
    receivers = lt_reclist
    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.
    Hope it will help you
    regards
    Rahul sharma

  • Problem sending xls file in an attachment via ABAP proxy

    Hello,
    I have in tmp directory a xls file, I tranfer such file to a table, and afterwards I send in an attachment via ABAP proxy, here is the code:
         l_attachment        TYPE REF TO if_ai_attachment,
            lt_attach           TYPE prx_attach,
            l_name              TYPE string,
            lx_string           TYPE xstring,
            l_string            TYPE string,
            l_type              TYPE string,
            des                 TYPE string.
      CLASS cl_ai_factory DEFINITION LOAD.
      DATA:    BEGIN OF itab OCCURS 0,
               raw(255) TYPE x,
             END OF itab.
      DATA: l_controller TYPE REF TO if_ai_posting_controller.
      DATA: it TYPE zhcm_mt_segur_out.
      CREATE OBJECT prxy.
      OPEN DATASET orig FOR INPUT IN binary MODE.
      READ DATASET orig INTO itab-raw.
      WHILE sy-subrc = 0.
        APPEND itab.
        READ DATASET orig INTO itab-raw.
      ENDWHILE.
      CLOSE DATASET orig.
      LOOP AT itab.
        CONCATENATE lx_string itab-raw INTO lx_string in byte mode.
      ENDLOOP.
      L_NAME = 'Segur.xls'.
      L_TYPE = CL_AI_ATTACHMENT=>IF_AI_ATTACHMENT~C_MIMETYPE_EXCEL.
      TRY.
          L_ATTACHMENT =
            CL_AI_FACTORY=>CREATE_ATTACHMENT_FROM_binary(
                      P_DATA = LX_STRING
                      P_TYPE = L_TYPE
                      P_NAME = L_NAME ).
          APPEND L_ATTACHMENT TO LT_ATTACH.
          L_CONTROLLER = CL_AI_FACTORY=>CREATE_CONTROLLER( ).
          L_CONTROLLER->SET_ATTACHMENTS( LT_ATTACH ).
          CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
            EXPORTING
              CONTROLLER = L_CONTROLLER
              OUTPUT     = IT.
          COMMIT WORK.
        CATCH CX_AI_SYSTEM_FAULT .
          DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
          CREATE OBJECT FAULT.
          WRITE :/ FAULT->ERRORTEXT.
      ENDTRY.
    I am using a Mail receiver channel, I receive a mail, with to attachments, one .xml and the other one .bin, I save it to my computer and I change the extension to .xls and when I try to open it, the file is not valid and can be opened after being repaired. What Im doing wrong? I would like to receive a valid xls file, what i should change?
    Thanks a lot,
    Luis

    Hi,
    yes I know, I have used the MessageTransformBean module, and the PayloadSwapBean module. But which parameter I should use for leaving only one attachement in the e-mail. I did this configuration:
    1
    localejbs/AF_Modules/MessageTransformBean
    Local Enterprise Bean
    <b>trans</b>
    2
    localejbs/AF_Modules/PayloadSwapBean
    Local Enterprise Bean
    <b>swap</b>
    3
    localejbs/AF_Modules/MessageTransformBean
    Local Enterprise Bean
    <b>trans1</b>
    4
    localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    Local Enterprise Bean
    mail
    <i><b>Module configuration</b></i>
    trans
    Transform.ContentDisposition
    inline
    swap
    swap.keyName
    payload-name
    swap
    swap.keyValue
    Segur
    trans1
    Transform.ContentDescription
    Segur
    trans1
    Transform.ContentDisposition
    attachment;filename="Segur.xls"
    trans1
    Transform.ContentType
    application/vnd.ms-excel;name="Segur.xls"
    In the e-mail I get one attachement without name .xml and another one Segur.xsl, and I want only one attachment, the last one. What I should change in my configuration??
    Best regards,
    Luis

  • Create Directory via ABAP on Application Server

    Hej folks,
    does anybody know how to create a directory on the ApplServer via ABAP?
    Thanks in advance!
    boris

    You can create an external command via SM69 which you can then invoke through function module SXPG_COMMAND_EXECUTE
    For NT you'd need something like the following:
    Operating system command                             
    cmd                                                                               
    Parameters for operating system command              
    /c mkdir
    $/SAPGLOBALHOST/\?   
    Have fun,
    Mark
    Kudos to Pete Devereux and Pete White

  • File to R/3 via Abap proxy -- need help

    Hello,
    I have made a scenario File to R/3 via Abap Proxy
    My Inbound Async Message Interface has Message Type -Emp_Rac_Detail_MT.
    Message Type has structure
    EmpID
    EmpName
    Age
    I have table in R/3 ZRACTABLE where I need to post data
    Fields in ZRACTABLE are
    EMPID
    EMPNAME
    AGE1
    Pls send me the code that I need to write in Async Method of Proxy
    that will put data
    Regards

    Hi Herry,
    First of all u have to write a Function module in R/3 ....for that i given u the code above.
    Now in ur inbount proxy in the implementation class u have to write code right???
    Here is the code...
    **** INSERT IMPLEMENTATION HERE **** ***
    DATA:
    lv_EMPID type EMPID,
    lv_EMPNAME type EMPNAME,
    lv_AGE type AGE.
    Convert Input Parameters
    lv_EMPID        =  input-Emp_Rac_Detail_MT-EMPID.
    lv_EMPNAME      =  input-Emp_Rac_Detail_MT-EMPNAME.
    lv_AGE          =  input-Emp_Rac_Detail_MT-AGE.
    call function 'ZEMP_RAC_FM'             /** thats ur function module name **/
        EXPORTING
        EMPID       =  lv_EMPID .
        EMPNAME     =  lv_EMPNAME.
        AGE         =  lv_AGE.
    endmethod.
    Regards
    biplab
    <i>*** give points if it hepls you!!!</i>

  • Read/write XML via OO4O

    We have some ASP code (Active Server Pages) that uses OO4O to select/insert data in an Oracle 8i rel. 2 database (The OO4O objects are from the same release 8.1.6). Now we would like to enhance it to read and store some XML documents directly (the XML documents are about 10 KB and have nested master/detail like structure).
    Our first idea was to write a stored procedure with a string argument to save the XML document, and to write a stored function also returning a string to retrieve the same data. But it appears that there is a 4KB limitation here (we thought it was a 32 KB limitation, but have only been able to get 4 KB?).
    Then we tried to use the RAW parameter type (although the documentation recommends not to), but this apparently requires the data top be transformed to binary format (the XML is in ISO8859-1 format).
    Have you any suggestions on how to overcome these limitations?
    Or are we simply going in the wrong direction (Is there a better way to use XML via OO4O than with stored procedures)?
    Regards
    Tom Bjerre.
    NB: The stored procedures written in Java look like:
    public static String get_xml(String key) throws SQLException{...}
    public static void set_xml(String key, String xmlStr) throws SQLException{...}
    with call specs of:
    CREATE OR REPLACE PACKAGE TEST AUTHID DEFINER AS
    FUNCTION GET_XML ("key" IN VARCHAR2)
    RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'Test.UtilXML.get_xml(java.lang.String) return java.lang.String';
    PROCEDURE SET_XML ("key" IN VARCHAR2, "xmlStr" IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Test.UtilXML.set_xml(java.lang.String, java.lang.String)';
    END TEST;
    null

    CHAR is limited to 2k.
    VARCHAR2 is limited to 4k.
    You should be using CLOB if you're
    saving XML strings.

  • Assign resource to task via abap automatically

    Hi experts.
    I need to assign via abap a resource to a task.
    The scenario is the following:
    I have a RoleA with 4 resources staffed (Resource1, Resource2, Resource3, Resource4) and 2 tasks assigned (Task1, Task2).
    I need to assign for example Resource1 to Task1 via abap knowing:
    - Task1 guid
    - RoleA guid
    - Resource1 business partner guid.
    How is it possible?
    Is there a function module or a method to do this?
    Thanks,
    Luca

    Luca;
    I never used this functionality.
    This "Resource" tab strip that you mentioned used the Object BUS2177.
    I found this BAPI's:
    BAPI_BUS2177_CREATE
    BAPI_BUS2177_CANDIDATE_ADD
    BAPI_BUS2177_STAFFING_ADD  (this BAPI may helpyou)
    Explore with this, I think that you are closer to solve this thread.
    Hope this help you.
    Best regards,
    Mariano.
    PD: Points will be apreciated.

  • Problemas no recebimento de XML via E-mail caracteres especiais

    Boa Tarde
    Estou com problemas no cenario de Validação de Assinatura com apenas um XML :
    Estou recebendo um XML via E-mail !
    Quando verifico o XML pelo Validador Online disponibilizado pelo SEFAZ RS ,a Assinatura é dada como Válida
    e quando é pelo PI usando o serviço de Validação da Assinatura(Verify) a mesma é dada como inválida... Através do Payload na SXI_MONITOR verifiquei que além dos cacacteres ENTER entre as TAGs aparecem ESPAÇOS ...(ex.: Tag1 valor fecha Tag1   espaço  Tag2 valor fecha Tag2).teria como tratar isso sem invalidar a Assinatura automáticamente ?

    Boa Tarde
    Não sei se você chegou a receber alguns casos  que lhe enviei ...! Quando ele chega ao e-mail ele já esta assim....!
    Esse é nosso grande problema as vezes o parceiro não se sente obrigado em ajustar o seu sistema,  uma vez que lhe é apresentado uma ferrameta do governo que valida esse mesmo arquivo rejeitado pelo serviço  de Validação de *** Digital(AS JAVA)SAP  ...,oque penso em  fazer  quanto a essa questão,.. desenvolver  uma  solução para tratar a excessão ..com calculo  de Hash ...comparação Binária.. e outras mais...!
    Só que eu não queria tomar um caminho muito distante doque a SAP possa vir a tomar com essa solução no futuro até mesmo para não depreciar essa ferramenta que é tão boa...!
    Att
    Ronaldo de Moraes
    Edited by: Ronaldo de Moraes on Oct 21, 2009 4:58 PM

Maybe you are looking for

  • Java and javascript cookies

    Hi i create a cookie called "SaveState" from javascript in my JSP dynpage. I want to read this from java (NOT JAVASCRIPT). Is this possible? if not, is there some kind of portal memory I can use to pass values between java and javascript? thanks Anto

  • Exit or Badi: On release of Production Order

    Hi, Module PP. Q) Say, equipment is under maintanance so it should give warning message while releasing the Production order through CO01. Note: it should give message while releasing the Production Order and not when saving it. Regards, Sujit

  • Hyperion pop-up windows popping up incorrectly

    Every pop-up window in Hyperion is popping up such that only the very left edge of the window shows. I can drag it around, but I cannot drag it open from a corner or double-click it to maximize it. The functionality of the pop-up window is still in p

  • NSM AD 3.1 & 3.1.1 303 error

    Hello,Somehow all our policies that use DFS stopt working after some months with out problems and i get the errors: 225 : The specified name could not be resolved by the network client. and 303 : Extended path information is missing for the specified

  • Quien resuelve asuntos de facturación?? me quitaron 5 días de los treinta pagados???

    quien resuelve asuntos de facturación, tengo varios inconvenientes