仅供参考
REPORT ZCRM_GET_XML_FROM_FTP.
TYPE-POOLS ABAP.
**************************************************************************************************************************
* 变量声明
**************************************************************************************************************************
DATA: DIR_NAME LIKE EPSF-EPSDIRNAM.
DATA: IT_DIRLIST LIKE EPSFILI OCCURS 0 WITH HEADER LINE.
DATA: WA_DIRLIST TYPE EPSFILI.
DATA: BEGIN OF IT_FILES OCCURS 0,
FILENAME(100),
END OF IT_FILES.
DATA: BEGIN OF DEL_FILES OCCURS 0,
FILENAME(100),
END OF DEL_FILES.
DATA: PROCESS_FLAG TYPE CHAR1.
*------------------------------------------------------------------
* BDC使用变量
*------------------------------------------------------------------
DATA:LV_MODE TYPE C.
DATA:BEGIN OF IT_BDC OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA:END OF IT_BDC.
DATA:BEGIN OF IT_MESS OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA:END OF IT_MESS.
DATA: UPDATE_OK TYPE CHAR1.
LV_MODE = 'N'.
*------------------------------------------------------------------
* TYPE DECLARATIONS FOR THE VARIABLES
*------------------------------------------------------------------
* DECLARING THE FILE TYPE
DATA: G_UNIXFILENAME TYPE STRING. "UNIX FILE PATH.
* DECLARING THE STRUCTURE FOR THE XML INTERNAL TABLE
TYPES: BEGIN OF TY_XML,
RAW(20000) TYPE C,
END OF TY_XML.
* DECLARING THE XML INTERNAL TABLE
DATA: G_T_XML_TAB TYPE TABLE OF TY_XML INITIAL SIZE 0.
* DECLARING THE WORK AREA FOR THE XML INTERNAL TABLE
DATA: WA_XML_TAB TYPE TY_XML.
* DECLARING THE STRING TO CONTAIN THE DATA FOR THE XML INTERNAL
* TABLE
DATA: G_STR TYPE STRING.
* DECLARING THE STRING TO CONTAIN X STRING
DATA: G_XMLDATA TYPE XSTRING.
* DECLARING THE TABLE TO CONTAIN THE PARSED DATA
DATA: G_T_XML_INFO TYPE TABLE OF SMUM_XMLTB INITIAL SIZE 0.
* DECLARING THE WORK AREA FOR THE INTERNAL TABLE CONTAINING THE
* PARSED DATA.
DATA: G_S_XML_INFO LIKE LINE OF G_T_XML_INFO.
* DECLARING THE TABLE TO CONTAIN THE RETURNED MESSAGES FROM THE
* PARSING FM
DATA: G_T_RETURN TYPE STANDARD TABLE OF BAPIRET2.
* DECLARING THE WORK AREA FOR THE RETURN TABLE
DATA: WA_RETURN LIKE LINE OF G_T_RETURN.
* DECLARING THE STRUCTURE FOR THE TABLE CONTAINING FIELDS IN THE
* XML FILE
TYPES: BEGIN OF STRUC_PEOPLE,
HOMEPERNR(8),
UNAME(4) TYPE C,
USERID(32),
END OF STRUC_PEOPLE.
* DECLARING THE INTERNAL TABLE CONTAINING THE FIELDS IN THE XML
* FILE
DATA: G_T_EMPLOYEEREQUEST TYPE TABLE OF STRUC_PEOPLE.
* DECLARING THE WORK AREA FOR THE INTERNAL TABLE CONTAINING THE
*FIELDS IN THE * XML FILE
DATA: G_S_EMPLOYEEREQUEST LIKE LINE OF G_T_EMPLOYEEREQUEST.
*------------------------------------------------------------------
* TYPE DECLARATIONS FOR THE VARIABLES
*------------------------------------------------------------------
DATA: IT_IDOC_CONTRL TYPE EDI_DC40 .
DATA: IT_IDOC_DATA TYPE EDI_DD40 OCCURS 0 WITH HEADER LINE.
DATA: LT_EDI_DC40 TYPE