*----------------------------------------------------------------------* * DECLARATIONS * *----------------------------------------------------------------------* DATA: gv_msg TYPE STRING, gv_count TYPE I, gv_total TYPE I. DATA: BEGIN OF gs_dati, pernr TYPE PERNR_D, begda TYPE BEGDA, endda TYPE ENDDA, tipo TYPE ZTIPO_CMP, soglia_imp TYPE ZSOGLIA_IMP, soglia_perc TYPE ZSOGLIA_PERC, target_imp TYPE ZTARGET_IMP, target_perc TYPE ZTARGET_PERC, cap_imp TYPE ZCAP_IMP, cap_perc TYPE ZCAP_PERC, note TYPE CHAR50, subty TYPE SUBTY, aedtm TYPE AEDAT, uname TYPE AENAM, END OF gs_dati. DATA: gs_9008 TYPE p9008, gs_return TYPE BAPIRETURN1, gs_key TYPE BAPIPAKEY. DATA gt_dati LIKE STANDARD TABLE OF gs_dati WITH HEADER LINE. *----------------------------------------------------------------------* * LAYOUT * *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. PARAMETERS: pa_flcl TYPE STRING LOWER CASE, pa_test AS CHECKBOX. SELECTION-SCREEN END OF BLOCK b1. *----------------------------------------------------------------------* * PROGRAM BODY * *----------------------------------------------------------------------* START-OF-SELECTION. IF pa_flcl IS INITIAL. MESSAGE e002. "Indicare il file locale ENDIF. PERFORM read_xls. IF gt_dati[] IS NOT INITIAL. DESCRIBE TABLE gt_dati LINES gv_total. LOOP AT gt_dati. CLEAR gs_9008. MOVE-CORRESPONDING gt_dati TO gs_9008. gs_9008-infty = '9008'. CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE' EXPORTING number = gt_dati-pernr IMPORTING return = gs_return. IF gs_return-type <> 'E'. CLEAR: gs_return, gs_key. CALL FUNCTION 'HR_INFOTYPE_OPERATION' EXPORTING INFTY = '9008' NUMBER = gs_9008-pernr RECORD = gs_9008 OPERATION = 'INS' NOCOMMIT = pa_test IMPORTING RETURN = gs_return KEY = gs_key. IF gs_return-type = 'E'. CLEAR gv_msg. MESSAGE ID gs_return-id TYPE gs_return-type NUMBER gs_return-number WITH gs_return-message_v1 gs_return-message_v2 gs_return-message_v3 gs_return-message_v4 INTO gv_msg. WRITE: / gt_dati-pernr, gt_dati-begda, gt_dati-endda, gt_dati-subty, '-', gv_msg. ELSE. ADD 1 TO gv_count. ENDIF. CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE' EXPORTING number = gt_dati-pernr. ELSE. CLEAR gv_msg. MESSAGE ID gs_return-id TYPE gs_return-type NUMBER gs_return-number WITH gs_return-message_v1 gs_return-message_v2 gs_return-message_v3 gs_return-message_v4 INTO gv_msg. WRITE: / gt_dati-pernr, gt_dati-begda, gt_dati-endda, gt_dati-subty, '-', gv_msg. ENDIF. ENDLOOP. ENDIF. WRITE: / 'Righe processate correttamente:', gv_count, 'su', gv_total. END-OF-SELECTION. EXIT. *----------------------------------------------------------------------*
mercoledì 9 novembre 2016
Caricamento di un infotype
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento