DATA WA_0009 TYPE
P0009.
DATA WA_0021 TYPE
P0021.
DATA: BEGIN OF
IT_FINAL OCCURS 0,
INFTY TYPE P0021-INFTY,
SUBTY TYPE P0021-SUBTY,
PERNR TYPE P0021-PERNR,
FAVOR TYPE P0021-FAVOR,
FGBDT TYPE P0021-FGBDT,
BEGDA
TYPE P0021-BEGDA,
ENDDA
TYPE P0021-ENDDA,
INFTY2 TYPE T582A-INFTY,
PERNR2 TYPE P0009-PERNR,
SUBTY2 TYPE P0009-SUBTY,
BKPLZ TYPE P0009-BKPLZ,
BEGDA2
TYPE P0009-BEGDA,
ENDDA2
TYPE P0009-ENDDA,
END OF IT_FINAL.
DATA: BEGIN OF
IT_0021 OCCURS 0,
INFTY TYPE P0021-INFTY,
SUBTY TYPE P0021-SUBTY,
PERNR TYPE P0021-PERNR,
FAVOR TYPE P0021-FAVOR,
FGBDT TYPE P0021-FGBDT,
BEGDA
TYPE P0021-BEGDA,
ENDDA
TYPE P0021-ENDDA,
END OF IT_0021.
DATA: BEGIN OF
IT_0009 OCCURS 0,
INFTY TYPE T582A-INFTY,
PERNR TYPE P0009-PERNR,
SUBTY TYPE P0009-SUBTY,
BKPLZ TYPE P0009-BKPLZ,
BEGDA
TYPE P0009-BEGDA,
ENDDA
TYPE P0009-ENDDA,
END OF IT_0009.
PARAMETERS P_FILE
TYPE STRING.
AT
SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL METHOD CL_RSAN_UT_FILES=>F4
EXPORTING
I_APPLSERV = SPACE
I_TITLE = SPACE
I_GUI_EXTENSION = SPACE
I_GUI_EXT_FILTER = SPACE
* I_GUI_INITIAL_DIRECTORY =
* I_APPLSERV_LOGICAL = 'X'
* I_APPLSERV_AL11 = 'X'
* IMPORTING
* E_CANCELED =
* E_LOGICAL_FILE =
* E_AL11_CHOSEN =
CHANGING
C_FILE_NAME = P_FILE
* EXCEPTIONS
* FAILED = 1
* others = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER
SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4.
ENDIF.
START-OF-SELECTION.
CALL METHOD
CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = P_FILE
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* VIRUS_SCAN_PROFILE =
* IMPORTING
* FILELENGTH =
* HEADER =
CHANGING
DATA_TAB = IT_FINAL[]
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* NOT_SUPPORTED_BY_GUI = 17
* ERROR_NO_GUI = 18
* others = 19
.
IF SY-SUBRC <> 0.
* MESSAGE ID
SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4.
ENDIF.
END-OF-SELECTION.
LOOP AT IT_FINAL.
MOVE: IT_FINAL-INFTY TO IT_0021-INFTY,
IT_FINAL-PERNR TO IT_0021-PERNR,
IT_FINAL-SUBTY TO IT_0021-SUBTY,
IT_FINAL-FAVOR TO IT_0021-FAVOR,
IT_FINAL-FGBDT TO IT_0021-FGBDT,
IT_FINAL-BEGDA TO IT_0021-BEGDA,
IT_FINAL-ENDDA TO IT_0021-ENDDA,
IT_FINAL-INFTY2 TO IT_0009-INFTY,
IT_FINAL-PERNR2 TO
IT_0009-PERNR,
IT_FINAL-SUBTY2 TO IT_0009-SUBTY,
IT_FINAL-BKPLZ TO IT_0009-BKPLZ ,
IT_FINAL-BEGDA2 TO IT_0009-BEGDA,
IT_FINAL-ENDDA2 TO IT_0009-ENDDA.
APPEND IT_0021.
APPEND IT_0009.
MOVE-CORRESPONDING IT_0021 TO WA_0021.
MOVE-CORRESPONDING IT_0009 TO WA_0009.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = IT_0009-PERNR
* IMPORTING
* RETURN
=
.
PERFORM SUB USING IT_0009-INFTY
IT_0009-PERNR IT_0009-SUBTY
IT_0009-ENDDA IT_0009-BEGDA WA_0009
'INS' '2'.
PERFORM SUB USING IT_0021-INFTY
IT_0021-PERNR IT_0021-SUBTY
IT_0021-ENDDA IT_0021-BEGDA WA_0021
'INS' '2'.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = IT_0009-PERNR
* IMPORTING
* RETURN =
.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form
SUB
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_0009_INFTY text
* -->P_IT_0009_PERNR text
* -->P_IT_0009_SUBTY text
* -->P_IT_0009_ENDDA text
* -->P_IT_0009_BEGDA text
* -->P_WA_0009 text
* -->P_0273 text
* -->P_0274 text
*----------------------------------------------------------------------*
FORM SUB USING
P_IT_0009_INFTY
P_IT_0009_PERNR
P_IT_0009_SUBTY
P_IT_0009_ENDDA
P_IT_0009_BEGDA
P_WA_0009
VALUE(P_0273)
VALUE(P_0274).
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = P_IT_0009_INFTY
NUMBER = P_IT_0009_PERNR
SUBTYPE =
P_IT_0009_SUBTY
* OBJECTID =
* LOCKINDICATOR =
VALIDITYEND = P_IT_0009_ENDDA
VALIDITYBEGIN =
P_IT_0009_BEGDA
* RECORDNUMBER =
RECORD = P_WA_0009
OPERATION = P_0273
* TCLAS = 'A'
DIALOG_MODE = P_0274
* NOCOMMIT =
* VIEW_IDENTIFIER =
* SECONDARY_RECORD =
* IMPORTING
* RETURN =
* KEY =
.
ENDFORM. " SUB