|
How to copy layout from one ALV report program to
another?
* --------------------------------------------------------------------
REPORT Z_COPY_ALV_VARNTS_PROG_TO_PROG . * =====================================================================
* ---------------------------------------------------------------------
INCLUDE STRUCTURE LTDX . DATA : END OF MYLTDX .
INCLUDE STRUCTURE LTDXT . DATA : END OF MYLTDXT .
DATA : BEGIN OF MYLTDXD OCCURS 0 . INCLUDE STRUCTURE LTDXD . DATA : END OF MYLTDXD . * ---------------------------------------------------------------------
DATA : PROGRAMM LIKE RS38M-PROGRAMM . DATA : BEGIN OF MDYNPFIELDS OCCURS 1 . INCLUDE STRUCTURE DYNPREAD . DATA : END OF MDYNPFIELDS . CONSTANTS BUTTONSELECTED(1) TYPE C VALUE 'X' . * =====================================================================
DEFINE GET_FILENAME . CALL FUNCTION 'WS_FILENAME_GET'
END-OF-DEFINITION . * =====================================================================
DEFINE DOWNLOAD_TO_ASCII . CALL FUNCTION 'WS_DOWNLOAD'
END-OF-DEFINITION . * =====================================================================
DEFINE UPLOAD_FROM_ASCII . CALL FUNCTION 'WS_UPLOAD'
END-OF-DEFINITION . * =====================================================================
PARAMETERS : P_FROM_P LIKE RS38M-PROGRAMM OBLIGATORY .
* =====================================================================
AT SELECTION-SCREEN .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE_x .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE_t .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE_d .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FROM_P .
CALL FUNCTION 'DYNP_VALUES_READ'
READ TABLE MDYNPFIELDS INDEX 1 . PROGRAMM = MDYNPFIELDS-FIELDVALUE . CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
P_FROM_P = PROGRAMM . AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_TO_P . CLEAR MDYNPFIELDS . REFRESH MDYNPFIELDS . MDYNPFIELDS-FIELDNAME = 'P_TO_P' . APPEND MDYNPFIELDS . CALL FUNCTION 'DYNP_VALUES_READ'
READ TABLE MDYNPFIELDS INDEX 1 . PROGRAMM = MDYNPFIELDS-FIELDVALUE . CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
P_TO_P = PROGRAMM . * =====================================================================
START-OF-SELECTION . CASE BUTTONSELECTED. WHEN P_SAME_S .
WHEN P_DOWNLD .
WHEN P_UPLOAD .
ENDCASE . *&---------------------------------------------------------------------*
FORM COPY_FROM_PROG_TO_PROG. CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
IF MANS = 'J' .
SELECT * FROM LTDX INTO TABLE
MYLTDX
LOOP AT MYLTDX . MYLTDX-REPORT = P_TO_P
.
ENDLOOP . IF SY-SUBRC = 0 . DELETE FROM LTDX WHERE REPORT = P_TO_P . INSERT LTDX FROM TABLE MYLTDX . ENDIF . * --------------------------------------------------------------------- REFRESH MYLTDXT . CLEAR MYLTDXT . SELECT * FROM LTDXT INTO TABLE
MYLTDXT
LOOP AT MYLTDXT . MYLTDXT-REPORT = P_TO_P . MODIFY MYLTDXT . ENDLOOP . IF SY-SUBRC = 0 . DELETE FROM LTDXT WHERE REPORT = P_TO_P . INSERT LTDXT FROM TABLE MYLTDXT . ENDIF . * --------------------------------------------------------------------- REFRESH MYLTDXT . CLEAR MYLTDXT . SELECT * FROM LTDXT INTO TABLE
MYLTDXT
LOOP AT MYLTDXT . MYLTDXT-REPORT = P_TO_P . MODIFY MYLTDXT . ENDLOOP . IF SY-SUBRC = 0 . DELETE FROM LTDXT WHERE REPORT = P_TO_P . INSERT LTDXT FROM TABLE MYLTDXT . ENDIF . * --------------------------------------------------------------------- ENDIF . ENDFORM. " COPY_FROM_PROG_TO_PROG *&---------------------------------------------------------------------*
FORM VDOWNLOAD. REFRESH MYLTDX . CLEAR MYLTDX . SELECT * FROM LTDX INTO TABLE MYLTDX
DOWNLOAD_TO_ASCII P_FILE_x MYLTDX .
* --------------------------------------------------------------------- REFRESH MYLTDXT . CLEAR MYLTDXT . SELECT * FROM LTDXT INTO TABLE MYLTDXT
DOWNLOAD_TO_ASCII P_FILE_t MYLTDXT .
* --------------------------------------------------------------------- REFRESH MYLTDXT . CLEAR MYLTDXT . SELECT * FROM LTDXD INTO TABLE MYLTDXT
DOWNLOAD_TO_ASCII P_FILE_d MYLTDXT . * ---------------------------------------------------------------------
ENDFORM.
" VDOWNLOAD
*&---------------------------------------------------------------------*
FORM VUPLOAD. CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
IF MANS = 'J' . * ---------------------------------------------------------------------
UPLOAD_FROM_ASCII P_FILE_x MYLTDX . LOOP AT MYLTDX . MYLTDX-REPORT = P_TO_P . MODIFY MYLTDX . ENDLOOP . IF SY-SUBRC = 0 . DELETE FROM LTDX WHERE REPORT = P_TO_P . INSERT LTDX FROM TABLE MYLTDX . ENDIF . * --------------------------------------------------------------------- REFRESH MYLTDXT . CLEAR MYLTDXT . UPLOAD_FROM_ASCII P_FILE_t MYLTDXT . LOOP AT MYLTDXT . MYLTDXT-REPORT = P_TO_P . MODIFY MYLTDXT . ENDLOOP . IF SY-SUBRC = 0 . DELETE FROM LTDXT WHERE REPORT = P_TO_P . INSERT LTDXT FROM TABLE MYLTDXT . ENDIF . * --------------------------------------------------------------------- REFRESH MYLTDXD . CLEAR MYLTDXD . UPLOAD_FROM_ASCII P_FILE_d MYLTDXT . LOOP AT MYLTDXT . MYLTDXT-REPORT = P_TO_P . MODIFY MYLTDXT . ENDLOOP . IF SY-SUBRC = 0 . DELETE FROM LTDXT WHERE REPORT = P_TO_P . INSERT LTDXT FROM TABLE MYLTDXT . ENDIF . * --------------------------------------------------------------------- ENDIF . ENDFORM. " VUPLOAD *---------- End of Program |
|
Read Also
Do you have a ABAP Question? ABAP Books
More ABAP Tips
SAP ERP Modules, Basis, ABAP and Other IMG Stuff All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|