*----------------------------------------------------------------------* * DECLARATIONS * *----------------------------------------------------------------------* TABLES: ltdx. DATA: gt_ltdx LIKE ltdx OCCURS 0, gt_ltdxt LIKE ltdxt OCCURS 0, gs_ltdx LIKE LINE OF gt_ltdx, gs_ltdxt LIKE LINE OF gt_ltdxt, gt_vari LIKE vari OCCURS 0, gt_varit LIKE varit OCCURS 0, gt_varid LIKE varid OCCURS 0, gv_msg TYPE string. *----------------------------------------------------------------------* * LAYOUT * *----------------------------------------------------------------------* PARAMETERS: pa_repid LIKE ltdx-report OBLIGATORY, pa_rfc LIKE rfcdes-rfcdest. SELECTION-SCREEN SKIP. PARAMETERS: rb_vari RADIOBUTTON GROUP rbg1, pa_vari LIKE vari-variant. SELECTION-SCREEN SKIP. PARAMETERS: rb_ltdx RADIOBUTTON GROUP rbg1, pa_lvari LIKE ltdx-variant, pa_user LIKE ltdx-username. SELECT-OPTIONS so_user FOR ltdx-username. *----------------------------------------------------------------------* * EVENTS * *----------------------------------------------------------------------* AT SELECTION-SCREEN. IF so_user[] IS NOT INITIAL AND pa_user IS INITIAL. MESSAGE 'Scegliere un utente da cui copiare' TYPE 'E'. ENDIF. *----------------------------------------------------------------------* * PROGRAM BODY * *----------------------------------------------------------------------* START-OF-SELECTION. IF rb_ltdx = 'X'. CALL FUNCTION 'ZRFC_READ_LTDX' DESTINATION pa_rfc EXPORTING i_repid = pa_repid i_username = pa_user i_variant = pa_lvari TABLES t_ltdx = gt_ltdx t_ltdxt = gt_ltdxt. IF gt_ltdx[] IS NOT INITIAL. LOOP AT so_user. LOOP AT gt_ltdx INTO gs_ltdx WHERE username = pa_user. gs_ltdx-username = so_user-low. APPEND gs_ltdx TO gt_ltdx. ENDLOOP. LOOP AT gt_ltdxt INTO gs_ltdxt WHERE username = pa_user. gs_ltdxt-username = so_user-low. APPEND gs_ltdxt TO gt_ltdxt. ENDLOOP. ENDLOOP. MODIFY ltdx FROM TABLE gt_ltdx. MODIFY ltdxt FROM TABLE gt_ltdxt. gv_msg = 'Copia completata'. ELSE. gv_msg = 'Nessun dato da copiare'. ENDIF. ELSE. CALL FUNCTION 'ZRFC_READ_VARI' DESTINATION pa_rfc EXPORTING i_repid = pa_repid i_variant = pa_vari TABLES t_vari = gt_vari t_varit = gt_varit t_varid = gt_varid. IF gt_vari[] IS NOT INITIAL. MODIFY vari FROM TABLE gt_vari. MODIFY varit FROM TABLE gt_varit. MODIFY varid FROM TABLE gt_varid. gv_msg = 'Copia completata'. ELSE. gv_msg = 'Nessun dato da copiare'. ENDIF. ENDIF. END-OF-SELECTION. MESSAGE gv_msg TYPE 'I'. FUNCTION zrfc_read_ltdx. *"---------------------------------------------------------------------- *"*"Interfaccia locale: *" IMPORTING *" VALUE(I_REPID) TYPE REPID *" VALUE(I_USERNAME) TYPE SLIS_USER *" VALUE(I_VARIANT) TYPE SLIS_VARI *" TABLES *" T_LTDX STRUCTURE LTDX *" T_LTDXT STRUCTURE LTDXT *"---------------------------------------------------------------------- RANGES: lr_user FOR ltdx-username, lr_vari FOR ltdx-variant. IF i_username IS NOT INITIAL. lr_user-sign = 'I'. lr_user-option = 'EQ'. lr_user-low = i_username. APPEND lr_user. ENDIF. IF i_variant IS NOT INITIAL. lr_vari-sign = 'I'. lr_vari-option = 'EQ'. lr_vari-low = i_variant. APPEND lr_vari. ENDIF. SELECT * FROM ltdx INTO TABLE t_ltdx WHERE report = i_repid AND username IN lr_user AND variant IN lr_vari. SELECT * FROM ltdxt INTO TABLE t_ltdxt WHERE report = i_repid AND username IN lr_user AND variant IN lr_vari. ENDFUNCTION. FUNCTION ZRFC_READ_VARI. *"---------------------------------------------------------------------- *"*"Interfaccia locale: *" IMPORTING *" VALUE(I_REPID) TYPE VARI_REPRT *" VALUE(I_VARIANT) TYPE VARIANT *" TABLES *" T_VARI STRUCTURE VARI *" T_VARIT STRUCTURE VARIT *" T_VARID STRUCTURE VARID *"---------------------------------------------------------------------- RANGES: lr_vari FOR vari-variant. IF i_variant IS NOT INITIAL. lr_vari-sign = 'I'. lr_vari-option = 'EQ'. lr_vari-low = i_variant. APPEND lr_vari. ENDIF. SELECT * FROM vari INTO TABLE t_vari WHERE report = i_repid AND variant IN lr_vari. SELECT * FROM varit INTO TABLE t_varit WHERE report = i_repid AND variant IN lr_vari. SELECT * FROM varid INTO TABLE t_varid WHERE report = i_repid AND variant IN lr_vari. ENDFUNCTION.
giovedì 26 gennaio 2017
Copiare le varianti
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento