2025 Feb 10 5:47 PM - edited 2025 Feb 10 5:57 PM
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(saplfpaym05) USING 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_xstring( string =
lf_string ).
parser = g_iixml->create_parser( stream_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->read( IMPORTING 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(38) WITH w_fic.
ENDIF.
TRANSFER ls_string TO w_fic.
IF sy-subrc = 0.
MESSAGE s000(38) WITH TEXT-e10.
ENDIF.
CLOSE DATASET w_fic.
Request clarification before answering.
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.