SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Downloading all selected Function groups with all modules



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary -> Migration
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sun Nov 04, 2007 3:18 pm    Post subject: Downloading all selected Function groups with all modules Reply with quote

Downloading all selected Function groups with all modules and subroutines in one file. It does not export the automatically generated function modules for table views!

Code:
REPORT ZZENNO01 LINE-SIZE 250.        "Rel. 3.1, 4.5
*
**********************         HEADER                    **************
*
* Copyright (c) 1999 by Enno Wulff,
*                       Hommola & Wulff Unternehmensberatung GmbH
*                       http://www.hommola-wulff.de
*
*     You can use or modify this report for your own work as long
*               as you don't try to sell or republish it.
*      In no event will the author be liable for indirect, special,
*        Incidental, or consequental damages (if any) arising out of
*                       the use of this report.
*//////////////////////////////////////////////////////////////////////*

TABLES: TFDIR, TRDIR, TLIBG.

SELECT-OPTIONS:
            FUNKTGRP FOR TLIBG-AREA,
            USER FOR TLIBG-UNAME.
PARAMETERS: DOWNLOAD AS CHECKBOX,
            FILENAME LIKE RLGRAP-FILENAME.

DATA: BEGIN OF T OCCURS 500,           "Report für DOWNLOAD
        LINE(72),
      END OF T,
      BEGIN OF ALL OCCURS 500,         "Report für DOWNLOAD
        LINE(72),
      END OF ALL,
      XTRDIR LIKE TRDIR OCCURS 100 WITH HEADER LINE,
      FUNK_MAIN(8),
      X_FILENAME LIKE RLGRAP-FILENAME,
      ZINCLUDE(8).

INITIALIZATION.
  USER-SIGN = 'I'.
  USER-OPTION = 'EQ'.
  USER-LOW = SY-UNAME.
  APPEND USER.
  FUNKTGRP-SIGN = 'I'.
  FUNKTGRP-OPTION = 'BT'.
  FUNKTGRP-LOW = 'Z000'.
  FUNKTGRP-HIGH = 'ZZZZ'.
  APPEND FUNKTGRP.
  CONCATENATE 'C:\ABAP\' SY-UNAME '\FUNKTBST' INTO FILENAME.

START-OF-SELECTION.
  SELECT * FROM TLIBG WHERE AREA IN FUNKTGRP.
    CONCATENATE 'SAPL' TLIBG-AREA INTO FUNK_MAIN.
    SELECT SINGLE * FROM TRDIR WHERE NAME = FUNK_MAIN
                                 AND ( CNAM IN USER OR UNAM IN USER ).
    CHECK SY-SUBRC = 0.
    APPEND TRDIR TO XTRDIR.
  ENDSELECT.

  LOOP AT XTRDIR.
    TRDIR = XTRDIR.
    REFRESH T.
    REFRESH ALL.

    ALL = '** Funktionsbausteine: **'. APPEND ALL.
    SELECT * FROM TFDIR WHERE PNAME = TRDIR-NAME.
      CONCATENATE '**' TFDIR-FUNCNAME INTO ALL. APPEND ALL.
    ENDSELECT.                         "TFDIR
    READ REPORT TRDIR-NAME INTO T.
    LOOP AT T.

      IF T(10) CS 'INCLUDE'.
        PERFORM DO_EXCLUDE USING T.
      ELSE.
        ALL = T. APPEND ALL.
      ENDIF.
    ENDLOOP.

    FORMAT COLOR 5.
    WRITE: / '*********************'.
    WRITE: TRDIR-NAME.
    WRITE: '*********************'.
    FORMAT COLOR OFF.

    LOOP AT ALL.
      WRITE: / ALL.
    ENDLOOP.

    CHECK DOWNLOAD = 'X'.
    CONCATENATE FILENAME '\' TRDIR-NAME '.FUN' INTO X_FILENAME.
    CALL FUNCTION 'WS_DOWNLOAD'
         EXPORTING
              FILENAME            = X_FILENAME
              FILETYPE            = 'ASC'
         TABLES
              DATA_TAB            = ALL
         EXCEPTIONS
              FILE_OPEN_ERROR     = 1
              FILE_WRITE_ERROR    = 2
              INVALID_FILESIZE    = 3
              INVALID_TABLE_WIDTH = 4
              INVALID_TYPE        = 5
              NO_BATCH            = 6
              UNKNOWN_ERROR       = 7
              OTHERS              = 8.
  ENDLOOP.
*---------------------------------------------------------------------*
*       FORM DO_EXCLUDE                                               *
*---------------------------------------------------------------------*
FORM DO_EXCLUDE USING STRING.

  DATA: NAME(8),
        FALSCHER_ALARM,
        ZEILE(72),
        BEGIN OF INC OCCURS 500,       "Report für DOWNLOAD
          LINE(72),
        END OF INC.

  ZEILE = STRING.

  IF ZEILE(1) <> '*'.
    IF ZEILE CS 'TABLEFRAME' OR
       ZEILE CS 'TABLEPROC' OR
       ZEILE CS 'LSVIM'.                                    " OR
*     ZEILE CS 'STRUCTURE'.

      ALL = ZEILE. APPEND ALL.
      IF NOT ZEILE CS 'INCLUDE STRUCTURE'.
        ALL = '*=->> Automatisch generiert - Include wird übersprungen'.
        APPEND ALL. EXIT.
      ENDIF.
    ENDIF.
    CLEAR FALSCHER_ALARM.
    DO.
      IF ZEILE(7) = 'INCLUDE'.
        EXIT.
      ELSEIF ZEILE(1) = '"'.
        FALSCHER_ALARM = 'X'. EXIT.
      ELSE.
        SHIFT ZEILE.
      ENDIF.
      IF SY-INDEX > 100.
        FALSCHER_ALARM = 'X'.
        EXIT.
      ENDIF.
    ENDDO.
    IF FALSCHER_ALARM = SPACE.
      NAME = ZEILE+8(8).
      CONCATENATE '*$*$ Start ofInclude ' NAME  INTO ALL
            SEPARATED BY SPACE.
      APPEND ALL.

      REFRESH INC.
      READ REPORT NAME INTO INC.
      LOOP AT INC.
        IF INC CS 'INCLUDE'.
          PERFORM DO_EXCLUDE USING INC.
        ELSE.
          ALL = INC. APPEND ALL.
        ENDIF.
      ENDLOOP.
      CONCATENATE '*$*$ End of Include ' NAME INTO ALL
               SEPARATED BY SPACE.
    ELSE.
      ALL = ZEILE.
    ENDIF.
  ELSE.
    ALL = ZEILE.
  ENDIF.
  APPEND ALL.

ENDFORM.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary -> Migration All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.