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

List of transactions



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Tue Sep 11, 2007 8:37 am    Post subject: List of transactions Reply with quote

Code:
*----------------------------------------------------------------------*
*                  REPORT Z_TRANSACTIONS                               *
*----------------------------------------------------------------------*
* TEXT ELEMENTS
* -------------
* Heading
*   Transaction code    Text
*
* Selection texts
*   P_DNLD   Download?
*   P_FILE   Filename:
*   S_SPRSL   Language:
*   S_TCODE   Transaction Code:
*
* Text Symbols
*   001   Transaction Selection
*   002   Download Option
*   003       Filename
*----------------------------------------------------------------------*
REPORT  z_transactions.

TABLES: tstct.

TYPES: BEGIN OF itab_tx,
        tcode LIKE tstct-tcode,
        ttext LIKE tstct-ttext,
      END OF itab_tx.

DATA: itab_tx       TYPE itab_tx OCCURS 0 WITH HEADER LINE,
      tx            TYPE itab_tx,
      itab_file     LIKE sval OCCURS 0 WITH HEADER LINE,
      p_file        LIKE rlgrap-filename,
      returncode    LIKE sy-subrc,
      filestring    TYPE string.

DATA: BEGIN OF fields OCCURS 2.
        INCLUDE STRUCTURE sval.
DATA: END OF fields.

* text-001 = Transaction Selection
SELECTION-SCREEN BEGIN OF BLOCK transx WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_tcode  FOR tstct-tcode,
                s_sprsl  FOR tstct-sprsl.
SELECTION-SCREEN END OF BLOCK transx.

* text-002 = Download Option
SELECTION-SCREEN BEGIN OF BLOCK dld WITH FRAME TITLE text-002.
PARAMETERS:     p_dnld   TYPE c AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK dld.

AT SELECTION-SCREEN OUTPUT.
  p_file = 'C:\SAPTXlist.xls'.
  p_dnld = 'X'.
  MOVE 'I' TO s_sprsl-sign.
  MOVE 'EQ' TO s_sprsl-option.
  MOVE 'EN' TO s_sprsl-low.
  APPEND s_sprsl.


START-OF-SELECTION.
  REFRESH itab_tx.

  SELECT * FROM tstct INTO CORRESPONDING FIELDS OF TABLE itab_tx
    WHERE tcode IN s_tcode AND sprsl IN s_sprsl.

  IF sy-subrc <> 0.
    MESSAGE s265(sf).
  ELSE.
    SORT itab_tx BY tcode.

    LOOP AT itab_tx.
      WRITE: /1  itab_tx-tcode(20),
           AT 20 itab_tx-ttext.
    ENDLOOP.

    IF p_dnld = 'X'.
      CLEAR fields.
      fields-tabname     = 'RLGRAP'.
      fields-fieldname   = 'FILENAME'.
      fields-value       = p_file.
      fields-field_attr  = '00'.
      APPEND fields.
      CALL FUNCTION 'POPUP_GET_VALUES'
           EXPORTING
                popup_title     = text-003
           IMPORTING
                returncode      = returncode
           TABLES
                fields          = fields
           EXCEPTIONS
                error_in_fields = 1
                OTHERS          = 2.

      CHECK returncode EQ space.

      filestring = fields-value.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                filename                = filestring
                write_field_separator   = ','
           TABLES
                data_tab                = itab_tx
           EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                no_authority            = 5
                unknown_error           = 6
                header_not_allowed      = 7
                separator_not_allowed   = 8
                filesize_not_allowed    = 9
                header_too_long         = 10
                dp_error_create         = 11
                dp_error_send           = 12
                dp_error_write          = 13
                unknown_dp_error        = 14
                access_denied           = 15
                dp_out_of_memory        = 16
                disk_full               = 17
                dp_timeout              = 18
                file_not_found          = 19
                dataprovider_exception  = 20
                control_flush_error     = 21
                OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE s999(b1) WITH 'File ' filestring
                              ' NOT created!'.
      ELSE.
        MESSAGE s999(b1) WITH 'File ' filestring
                              ' Created successfully!'.
      ENDIF.  "Check on download success
    ENDIF.    "Download
  ENDIF.      "Check on selection
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 -> Programming Techniques | Приемы программирования 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.