Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Developed a Tool for Downloading Programs based on the User Selection Criteria such as Package, User Name and Program name .

These  Files  are Then Stored  In a Folder. 

Error rendering macro 'code': Invalid value specified for parameter 'lang'
REPORT  YESWAR_PROG_DOWNLOAD_READ NO STANDARD PAGE HEADING.
TABLES:
   TADIR.
DATA: LINES TYPE SY-INDEX.
DATA:
BEGIN OF T_TADIR OCCURS 10,
DEVCLASS LIKE TADIR-DEVCLASS,
OBJ_NAME TYPE TADIR-OBJ_NAME,
AUTHOR TYPE TADIR-AUTHOR,
END OF T_TADIR.
DATA: ITAB TYPE TABLE OF STRING WITH HEADER LINE.
DATA:
   BEGIN OF T_REPOSRC OCCURS 10,
     PROGNAME TYPE REPOSRC-PROGNAME,
     SUBC TYPE REPOSRC-SUBC,
     CNAM TYPE REPOSRC-CNAM,
     CDAT TYPE REPOSRC-CDAT,
     R3STATE TYPE REPOSRC-R3STATE,
     UNAM TYPE REPOSRC-UNAM,
     UDAT TYPE REPOSRC-UDAT,
   END OF T_REPOSRC.
DATA:
  BOX1,
  BOX2,
  W_BOX ,
  W_NO TYPE I VALUE 1,
  W_DEVCLASS LIKE TADIR-DEVCLASS,
  W_AUTHOR     LIKE TADIR-AUTHOR,
  W_LINES TYPE I,
  W_LINE1 TYPE I,
  W_NEXTREC TYPE I,
  W_INDEX TYPE I.
SELECT-OPTIONS:
  S_AUTHOR FOR TADIR-AUTHOR ,
  S_DCLASS FOR TADIR-DEVCLASS  ,
  S_PROG   FOR TADIR-OBJ_NAME.
SELECTION-SCREEN  BEGIN OF BLOCK B1 WITH FRAME  TITLE TEXT-001.
PARAMETERS:
    R1  RADIOBUTTON GROUP G1,
    R2  RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN.
  SELECT   DEVCLASS
         OBJ_NAME
          AUTHOR
    INTO TABLE T_TADIR
    FROM  TADIR
    WHERE
    PGMID  EQ 'R3TR'
    AND OBJECT = 'PROG'
    AND   DEVCLASS IN S_DCLASS
    AND  OBJ_NAME IN S_PROG
    AND AUTHOR IN S_AUTHOR.
  IF  SY-SUBRC  NE 0.
    MESSAGE  E014(YESWAR).
  ENDIF.
TOP-OF-PAGE.
  WRITE:/ TEXT-005 COLOR 4 ,SY-SYSID COLOR 3.
  WRITE:/ TEXT-006 COLOR 5, SY-DBCNT COLOR 3.
TOP-OF-PAGE DURING LINE-SELECTION.
  WRITE:/ TEXT-005 COLOR 4 ,SY-SYSID COLOR 3.
  WRITE:/ TEXT-006, SY-DBCNT COLOR 5.
  ULINE.
START-OF-SELECTION.
  IF R1 = 'X'.
    PERFORM SELECT.
    PERFORM OUTPUT1.
  ELSE.
    PERFORM SELECT.
    PERFORM OUTPUT2.
  ENDIF.
  SET PF-STATUS 'ABCDA'.
*&--------------------------------------------------------------------*
*&      Form  SELECT
*&--------------------------------------------------------------------*
FORM SELECT .
  SELECT   DEVCLASS
         OBJ_NAME
          AUTHOR
    INTO TABLE T_TADIR
    FROM  TADIR
    WHERE
    PGMID  EQ 'R3TR'
    AND OBJECT = 'PROG'
    AND   DEVCLASS IN S_DCLASS
    AND  OBJ_NAME IN S_PROG
    AND AUTHOR IN S_AUTHOR.
  LINES = SY-DBCNT + 5.
ENDFORM.                    " SELECT
*&--------------------------------------------------------------------*
*&      Form  OUTPUT1
*&--------------------------------------------------------------------*
FOR  DISPLAYING ALL THE PROGRAM  NAMES
**---------------------------------------------------------------------*
FORM OUTPUT1 .
  SORT T_TADIR BY DEVCLASS.
  LOOP AT T_TADIR.
    AT NEW DEVCLASS.
      SET BLANK LINES ON.
      WRITE:/ BOX1 AS CHECKBOX,
             T_TADIR-DEVCLASS.
    ENDAT.
    WRITE:/40  BOX2 AS CHECKBOX,
              T_TADIR-OBJ_NAME.
    HIDE : T_TADIR-OBJ_NAME,
            T_TADIR-AUTHOR..
  ENDLOOP.
ENDFORM.                                                    " OUTPUT1
*&---------------------------------------------------------------------*
*&      Form  MODIFY_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MODIFY_LIST.
  DO LINES TIMES.
    READ LINE SY-INDEX.
    IF SY-UCOMM EQ 'SELLALL'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX1 FROM 'X'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM 'X'.
*      ENDIF.
    ENDIF.
    IF SY-UCOMM EQ 'DSELLALL'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM ' '.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2  FROM ' '.
    ENDIF.
  ENDDO.
ENDFORM.                    " MODIFY_LIST
*&---------------------------------------------------------------------*
*&      Form  EXTRA_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM EXTRA_LIST .
  SELECT PROGNAME
        SUBC
        CNAM
        CDAT
        R3STATE
        UNAM
        UDAT
   FROM REPOSRC
   INTO
   TABLE T_REPOSRC
   WHERE PROGNAME EQ T_TADIR-OBJ_NAME
     AND CNAM     EQ T_TADIR-AUTHOR.
  WINDOW STARTING AT 1 50
         ENDING  AT 60 60.
  LOOP AT T_REPOSRC .
    WRITE:/ TEXT-101 COLOR 1, T_REPOSRC-PROGNAME  COLOR 1,
          / TEXT-102 COLOR 2 ,T_REPOSRC-SUBC  COLOR 1,
          / TEXT-103 COLOR 3, T_REPOSRC-CNAM  COLOR 1,
          / TEXT-104 COLOR 4 , T_REPOSRC-CDAT  COLOR 1,
          / TEXT-105 COLOR 5, T_REPOSRC-R3STATE  COLOR 1,
          / TEXT-106  COLOR 6,T_REPOSRC-UNAM  COLOR 1,
          / TEXT-107 COLOR 7,T_REPOSRC-UDAT  COLOR 1.
    ULINE.
  ENDLOOP.
ENDFORM.                    " EXTRA_LIST
*&--------------------------------------------------------------------*
*&      Form  APPLY_LIST
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM APPLY_LIST .
  DATA: W_SEL TYPE C.
  IF SY-UCOMM EQ 'APPLY' .
    DO.
      READ LINE SY-INDEX FIELD VALUE BOX1.
      IF SY-SUBRC NE 0.
        EXIT.
      ENDIF.
      IF SY-SUBRC EQ 0.
        W_SEL = 'X'.
        MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM W_SEL.
        MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM W_SEL.
      ENDIF.
      IF BOX1 NE 'X'.
        W_SEL = ' '.
        MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM W_SEL.
        MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM W_SEL.
      ENDIF.
    ENDDO.
  ENDIF.
ENDFORM.                    " APPLY_LIST
*&--------------------------------------------------------------------*
*&      Form  R1_X
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
AT USER-COMMAND.
  CASE SY-UCOMM.
    WHEN 'SELLALL' ..
      PERFORM MODIFY_LIST.
      SET PF-STATUS 'ABCDA' EXCLUDING 'SELLALL' IMMEDIATELY.
    WHEN 'DSELLALL' .
      PERFORM MODIFY_LIST.
      SET PF-STATUS 'ABCDA' EXCLUDING 'DSELLALL'  IMMEDIATELY..
    WHEN 'APPLY'.
      PERFORM APPLY_LIST.
    WHEN 'EXTRA'.
      DO.
        READ LINE SY-INDEX FIELD VALUE BOX2.
        IF SY-SUBRC NE 0. EXIT. ENDIF.
        IF BOX2 EQ 'X'.
          PERFORM  EXTRA_LIST .
          CLEAR BOX2.
          MODIFY LINE SY-INDEX
                      FIELD VALUE  BOX2
                      FIELD FORMAT BOX2 INPUT OFF
                                  T_TADIR-OBJ_NAME  COLOR COL_NEGATIVE  INVERSE ON.
        ENDIF.
      ENDDO.
    WHEN 'DOWNLOAD'.
      DO .
        READ LINE SY-INDEX FIELD VALUE BOX2 INTO W_BOX.
        IF SY-SUBRC NE 0.
          EXIT.
        ENDIF.
        IF W_BOX = 'X'.
          PERFORM DOWNLOAD.
        ENDIF.
      ENDDO.
  ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  MODIFY_LIST1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MODIFY_LIST1 .
  DO LINES TIMES.
    READ LINE SY-INDEX.
    IF SY-UCOMM EQ 'SELLALL'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX1 FROM 'X'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM 'X'.
    ENDIF.
    IF SY-UCOMM EQ 'DSELLALL'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM ' '.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2  FROM ' '.
    ENDIF.
  ENDDO.
ENDFORM.                    " MODIFY_LIST1
*&--------------------------------------------------------------------*
*&      Form  OUTPUT_12
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM OUTPUT2.
  WRITE:/ SY-DBCNT COLOR 5.
  SORT T_TADIR BY AUTHOR.
  LOOP AT T_TADIR.
    ON CHANGE OF T_TADIR-AUTHOR.
      WRITE:/10 BOX1 AS CHECKBOX,
             15 T_TADIR-AUTHOR.
    ENDON.
    WRITE:/50 BOX2 AS CHECKBOX,
           55 T_TADIR-OBJ_NAME.
    HIDE T_TADIR-OBJ_NAME.
  ENDLOOP.
ENDFORM.                                                    "OUTPUT_12
*&---------------------------------------------------------------------*
*&      Form  DOWNLOAD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM DOWNLOAD .
  DATA: W_FILE TYPE STRING,
           W_PROGRAM(30).
  READ REPORT  T_TADIR-OBJ_NAME INTO ITAB..
  CONCATENATE 'D:\FILE_DOWNLOAD\'  T_TADIR-OBJ_NAME  '.TXT' INTO W_FILE.
  WRITE:/ W_FILE.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME = W_FILE
      FILETYPE = 'ASC'
    TABLES
      DATA_TAB = ITAB.
ENDFORM.                    " DOWNLOAD
  • No labels