저희 신규 고객사와의 인터페이스를 XML문서로 FTP서버를 통하여 구축하려고 합니다.
1. 정해진 XML문서를 업로드하여 인터널 테이블로 넣기
2. 화면에서 업로드한 값 보여주기
3. CBO테이블에 저장하기
==>XML태그에 대한 Element가 아래와 같이 정의 돼 있을 경우 업로드와 XML파일로 다운로드를 어떻게 할 수
있는지 고수님의 고견 부탁드립니다.
첨부파일 : 업로드할 XML 샘플 데이타
XML Element list
==>
Element | Length | Description for Element |
MsgBodyReqDtaSalesOrderResponseOrderHeaderOrdNum | 10 | Sales Order No. |
MsgBodyReqDtaSalesOrderResponseOrderHeaderCustCodInv | 10 | Delivery customer code |
MsgBodyReqDtaSalesOrderResponseOrderHeaderCustPONum | 20 | Customer PO No. |
MsgBodyReqDtaSalesOrderResponseOrderHeaderRemark1 | 35 | Remark01 |
MsgBodyReqDtaSalesOrderResponseOrderHeaderRemark2 | 35 | Remark02 |
MsgBodyReqDtaSalesOrderResponseOrderHeaderOrdDate | 8 | Order Date |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDelivDate | 8 | Requested delivery date |
MsgBodyReqDtaSalesOrderResponseOrderHeaderWh | 10 | Warehouse |
MsgBodyReqDtaSalesOrderResponseOrderHeaderYourRef | 20 | Customer Reference |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressCustName | 35 | Delivery customer name |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressAddr1 | 35 | Delivery customer address1 |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressAddr2 | 35 | Delivery customer address2 |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressAddr3 | 35 | Delivery customer address3 |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressAddr4 | 35 | Delivery customer address4 |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressZip | 10 | Post Code |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressPhone | 20 | Telephone number |
MsgBodyReqDtaSalesOrderResponseOrderHeaderDeliveryAddressFax | 20 | Fax number |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineLineNum | 6 | Sales order line number |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineStockCode | 24 | Stock Item |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineCustStockCode | 30 | Customer stock item code |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineDescrLine1 | 25 | Product English Name1 |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineDescrLine2 | 25 | Product English Name2 |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineCustDescrLine1 | 25 | Product Chinese Name1 |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineCustDescrLine2 | 25 | Product Chinese Name2 |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineUnitCodeDescr | 10 | Unit |
MsgBodyReqDtaSalesOrderResponseOrderLineListOrderLineQtyOrdered | 9 | Order Qty |
<>*&---------------------------------------------------------------------*
*& Report ZXML *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZXML .
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
******************************* FIRST PHASE
******************************* FIRST PHASE
******************************* FIRST PHASE
*------------------ Fetch Data
SELECT * FROM t001 INTO TABLE t001.
*------------------- XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
*------------- Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = itab.
*-------------- Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:xx.xml'
TABLES
data_tab = itab.
******************************* SECOND PHASE
******************************* SECOND PHASE
******************************* SECOND PHASE
BREAK-POINT.
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
*------------------- XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]