cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue in sending XML Data to Application server

kirankumark2
Participant
0 Kudos
781

I have a requirement to send  payment XML generated from AL11 as it is Line by Line with custom program to Application server.  I have implemented the below Logic by debugging standard functionality implemented by SAP but the issue with my logic is, it is creating Whole XML as a single line in Application server.

I have gone through the many blogs related to XML but i am unable to find the logic to achieve the same. I don't have any prior knowledge on XML hence i am unable to understand the logic posted in blogs.

Sample requirement XML is attached 

Someone help me by correcting the below logic OR adding extra lines to achieve the same with purpose of  every method to gain some knowledge

"When payment File exists reading and send it to AL11
 "GET XML Data generated from F110 payment Run
    SELECT SINGLE *
      FROM regut
      INTO @DATA(is_regut)
      WHERE laufd @p_laufd        
        AND laufi @p_laufi         
        AND zbukr IN @s_zbukr.       
    IF sy-subrc 0.
      CALL FUNCTION 'FUNCTION_IMPORT_INTERFACE'
        EXPORTING
          funcname           'SDIXML_DOM_TO_SCREEN'
          inactive_version   ' '
        TABLES
          exception_list     l_exceptions_tab
          export_parameter   l_export_tab
          import_parameter   l_import_tab
          tables_parameter   l_tables_tab
        EXCEPTIONS
          error_message      1
          function_not_found 2
          invalid_name       3
          OTHERS             4.

      READ TABLE l_import_tab WITH KEY parameter 'ENCODING'" 1932783
      IF sy-subrc 0.
        ld_new 'X'.
      ENDIF.

      l_encoding is_regut-codepage.

      g_iixml cl_ixml=>create).
      i_document g_iixml->create_document).


      IF NOT is_regut-tsnam IS INITIAL.                     "nte1428908

        PERFORM read_data(saplfpaym05)
                          TABLES   gt_xfile
                          USING    is_regut-fsnam
                                   is_regut-tsnam
                                   is_regut
                          CHANGING lp_result
                                   lc_rsts_rc
                                   lc_rsts_msg
                                   ls_fbhandle
                                   gp_temse_laenge.

*                       Reset Codepage if we have both TemSe and File           "nte1423701
        IF is_regut-tsnam <> space AND is_regut-fsnam <> space"nte1423701
          CLEAR is_regut-codepage.                          "nte1423701
        ENDIF.
        IF is_regut-codepage IS INITIAL.
          PERFORM get_codepage(saplfpaym05USING is_regut-tsnam
                                         CHANGING is_regut-codepage.
        ENDIF.


        IF is_regut-saprl IS INITIAL.
          PERFORM replace_old_characters(saplfpaym05)
                                                  TABLES gt_xfile
                                                  USING  is_regut-codepage.
        ENDIF.


        LOOP AT gt_xfile INTO wa_xfile.
          CONCATENATE lf_string wa_xfile INTO lf_string IN BYTE MODE.
        ENDLOOP.


        i_streamfactory g_iixml->create_stream_factory).
        istream i_streamfactory->create_istream_xstringstring =
                                                          lf_string ).
        parser g_iixml->create_parserstream_factory i_streamfactory
                                         istream        istream
                                         document       i_document ).

        rc parser->parse).

*     get encoding from file, to display the correct encoding
        IF ld_new 'X'.
          LOOP AT gt_xfile INTO ls_xfile.
            conv cl_abap_conv_in_ce=>create(
            encoding l_encoding
            input ls_xfile ).
            CALL METHOD conv->readIMPORTING data ls_string ).
            EXIT.
          ENDLOOP.
        ENDIF.

      "Write XML to AL11
      PERFORM r98-ouvrir_fichier USING p_fconfb.  "Get File name
      OPEN DATASET w_fic FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
        MESSAGE e935(38WITH w_fic.
      ENDIF.
      TRANSFER ls_string TO w_fic.
      IF sy-subrc 0.
        MESSAGE s000(38WITH TEXT-e10.
      ENDIF.
      CLOSE DATASET w_fic.

 

Accepted Solutions (0)

Answers (0)