2022 Dec 06 10:39 AM
lDear Team,
I have an requirment to download the ALV to XML files by single line item via 'Material , Document no & lines items'
Here the issue's was when i download the XML 'I getting some characters in document'
Please help me how to clear it.
FORM convert_xml_form .
TYPES: BEGIN OF ty_xml,
mblnr TYPE mseg-mblnr,
zeile TYPE mseg-zeile,
ebeln TYPE mseg-ebeln,
matnr TYPE mseg-matnr,
erfme TYPE mseg-erfme,
erfmg TYPE mseg-erfmg,
menge TYPE mseg-menge,
lifnr TYPE mseg-lifnr,
name2 TYPE lfa1-name2,
END OF ty_xml.
DATA: BEGIN OF gt_xml OCCURS 0,
line(120),
END OF gt_xml.
DATA: lt_xml TYPE TABLE OF ty_xml,
ls_xml TYPE ty_xml.
DATA: ld_filename TYPE string,
file_path TYPE string,
l_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
lv_path TYPE string,
lv_data TYPE string.
LOOP AT lt_last INTO ls_last.
gt_xml-line = '<Material Received>'.
APPEND gt_xml.
gt_xml-line = '<Receiving Number>' .
APPEND gt_xml.
gt_xml-line = '<Line Item>' .
APPEND gt_xml.
gt_xml-line = '<Purshase Order>' .
APPEND gt_xml.
gt_xml-line = '<Part Number>' .
APPEND gt_xml.
gt_xml-line = '<Unit Of Entry >' .
APPEND gt_xml.
gt_xml-line = '<Qty Of UOM>' .
APPEND gt_xml.
gt_xml-line = '<Quantity >' .
APPEND gt_xml.
gt_xml-line = '<Vendor name >' .
APPEND gt_xml.
gt_xml-line = ls_last-mblnr .
APPEND gt_xml.
gt_xml-line = ls_last-zeile .
APPEND gt_xml.
gt_xml-line = ls_last-ebeln .
APPEND gt_xml.
gt_xml-line = ls_last-matnr .
APPEND gt_xml.
gt_xml-line = ls_last-erfme .
APPEND gt_xml.
gt_xml-line = ls_last-erfmg .
APPEND gt_xml.
gt_xml-line = ls_last-menge.
APPEND gt_xml.
gt_xml-line = ls_last-name2.
APPEND gt_xml.
gt_xml-line = '</Receiving Number>' .
APPEND gt_xml.
gt_xml-line = '</Line Item>' .
APPEND gt_xml.
gt_xml-line = '</Purshase Order>' .
APPEND gt_xml.
gt_xml-line = '</Part Number>' .
APPEND gt_xml.
gt_xml-line = '</Unit Of Entry >' .
APPEND gt_xml.
gt_xml-line = '</Qty Of UOM>' .
APPEND gt_xml.
gt_xml-line = '</Quantity >' .
APPEND gt_xml.
gt_xml-line = '</Vendor >' .
APPEND gt_xml.
gt_xml-line = '</Material Received>'.
APPEND gt_xml.
lv_path = p_file.
CLEAR : lv_data.
CONCATENATE ls_last-matnr '-' ls_last-mblnr '-' ls_last-zeile INTO lv_data.
l_filename = lv_data.
CONCATENATE lv_path 'ZMPNREP1\' l_filename'.XML' INTO ld_fullpath.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'DBF'
TABLES
data_tab = gt_xml
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
REFRESH:gt_xml.
CLEAR: ls_last,lv_path,file_path,l_filename,ld_fullpath.
ENDLOOP.
ENDFORM. " CONVERT_XML_FORM
2022 Dec 06 1:37 PM
You should not use DBF format (DBase format), it's not supported. You should use ASC or BIN. ASC in your case.
2022 Dec 06 3:53 PM
Thanks for reply Sandra Rossi.
I need to download the .XML format. I got as per client requirment .
But my issue was when i download it 'I getting some char as per above attached attachment.
Please help me!!!!.
2022 Dec 07 10:59 AM
Hi ,
Please help for above Question.
I have an requirment to download the ALV to XML files by single line item via 'Material , Document no & lines items'
Here the issue's was when i download the XML 'I getting some characters in document'
Please help me how to clear it.
FORM convert_xml_form .
TYPES: BEGIN OF ty_xml,
mblnr TYPE mseg-mblnr,
zeile TYPE mseg-zeile,
ebeln TYPE mseg-ebeln,
matnr TYPE mseg-matnr,
erfme TYPE mseg-erfme,
erfmg TYPE mseg-erfmg,
menge TYPE mseg-menge,
lifnr TYPE mseg-lifnr,
name2 TYPE lfa1-name2,
END OF ty_xml.
DATA: BEGIN OF gt_xml OCCURS 0,
line(120),
END OF gt_xml.
DATA: lt_xml TYPE TABLE OF ty_xml,
ls_xml TYPE ty_xml.
DATA: ld_filename TYPE string,
file_path TYPE string,
l_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
lv_path TYPE string,
lv_data TYPE string.
LOOP AT lt_last INTO ls_last.
gt_xml-line = '<Material Received>'.
APPEND gt_xml.
gt_xml-line = '<Receiving Number>' .
APPEND gt_xml.
gt_xml-line = '<Line Item>' .
APPEND gt_xml.
gt_xml-line = '<Purshase Order>' .
APPEND gt_xml.
gt_xml-line = '<Part Number>' .
APPEND gt_xml.
gt_xml-line = '<Unit Of Entry >' .
APPEND gt_xml.
gt_xml-line = '<Qty Of UOM>' .
APPEND gt_xml.
gt_xml-line = '<Quantity >' .
APPEND gt_xml.
gt_xml-line = '<Vendor name >' .
APPEND gt_xml.
gt_xml-line = ls_last-mblnr .
APPEND gt_xml.
gt_xml-line = ls_last-zeile .
APPEND gt_xml.
gt_xml-line = ls_last-ebeln .
APPEND gt_xml.
gt_xml-line = ls_last-matnr .
APPEND gt_xml.
gt_xml-line = ls_last-erfme .
APPEND gt_xml.
gt_xml-line = ls_last-erfmg .
APPEND gt_xml.
gt_xml-line = ls_last-menge.
APPEND gt_xml.
gt_xml-line = ls_last-name2.
APPEND gt_xml.
gt_xml-line = '</Receiving Number>' .
APPEND gt_xml.
gt_xml-line = '</Line Item>' .
APPEND gt_xml.
gt_xml-line = '</Purshase Order>' .
APPEND gt_xml.
gt_xml-line = '</Part Number>' .
APPEND gt_xml.
gt_xml-line = '</Unit Of Entry >' .
APPEND gt_xml.
gt_xml-line = '</Qty Of UOM>' .
APPEND gt_xml.
gt_xml-line = '</Quantity >' .
APPEND gt_xml.
gt_xml-line = '</Vendor >' .
APPEND gt_xml.
gt_xml-line = '</Material Received>'.
APPEND gt_xml.
lv_path = p_file.
CLEAR : lv_data.
CONCATENATE ls_last-matnr '-' ls_last-mblnr '-' ls_last-zeile INTO lv_data.
l_filename = lv_data.
CONCATENATE lv_path 'ZMPNREP1\' l_filename'.XML' INTO ld_fullpath.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'DBF'
TABLES
data_tab = gt_xml
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
REFRESH:gt_xml.
CLEAR: ls_last,lv_path,file_path,l_filename,ld_fullpath.
ENDLOOP.
ENDFORM. " CONVERT_XML_FORM