ABAP-Download All Custom (Z) Objects with respect to DEV Class

Author: Kaleemullah

Submitted: 19/07/2007
Related Links:

  • <link>

         The Program Downloads all the custom objects with respect to Development class and Object type at the given work station location. Use full for the Entire Custom Object Analysis.

REPORT zuipzproggdnld NO STANDARD PAGE HEADING MESSAGE-ID 00.
{color:#0000ff}\*Table Declarations{color}
TABLES : tadir.
{color:#0000ff}\*&---------------------------------------------------------------------\*{color}

{color:#0000ff}\* Type Declarations *{color}

{color:#0000ff}\*&---------------------------------------------------------------------\*{color}
TYPES: BEGIN OF t_tadir,

pgmid LIKE tadir-pgmid, "program id

object LIKE tadir-object, "object TYPE

obj_name LIKE tadir-obj_name, "object name

author LIKE tadir-author, "person responsible

devclass LIKE tadir-devclass, "development class

END OF t_tadir,
{color:#0000ff}\*{color}
BEGIN OF t_tstc,

tcode LIKE tstc-tcode, "Transaction Code

pgmna LIKE tstc-pgmna, "Program Name

END OF t_tstc,
{color:#0000ff}\*{color}
BEGIN OF t_header,

name(80) TYPE c,

END OF t_header,
{color:#0000ff}\*{color}
BEGIN OF t_fintab,

string TYPE string,

END OF t_fintab.
{color:#0000ff}\*{color}

{color:#0000ff}\*&---------------------------------------------------------------------\*{color}

{color:#0000ff}\* Table Declarations *{color}

{color:#0000ff}\*&---------------------------------------------------------------------\*{color}
DATA : i_tadir TYPE STANDARD TABLE OF t_tadir,

i_fintab TYPE STANDARD TABLE OF t_fintab,

i_tstc TYPE STANDARD TABLE OF t_tstc,

i_header TYPE STANDARD TABLE OF t_header.
{color:#0000ff}\*{color}

{color:#0000ff}\*&---------------------------------------------------------------------\*{color}

{color:#0000ff}\* Work Area Declarations *{color}

{color:#0000ff}\*&---------------------------------------------------------------------\*{color}
DATA : wa_tadir LIKE LINE OF i_tadir,

wa_fintab LIKE LINE OF i_fintab,

wa_tstc LIKE LINE OF i_tstc,

wa_header LIKE LINE OF i_header.
{color:#0000ff}\*{color}

{color:#0000ff}\*&---------------------------------------------------------------------\*{color}

{color:#0000ff}\* Global Variable Declarations *{color}

{color:#0000ff}\*&---------------------------------------------------------------------\*{color}
DATA : v_count(5) TYPE n,

v_tab TYPE x VALUE 09.

\*

\*&---------------------------------------------------------------------\*

\* Constants Declarations *

\*&---------------------------------------------------------------------\*

CONSTANTS: c_r3tr LIKE tadir-pgmid VALUE 'R3TR'.

\*

\*&---------------------------------------------------------------------\*

\* Input parameters *

\*&---------------------------------------------------------------------\*

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

\*

PARAMETERS : p_class LIKE tadir-devclass OBLIGATORY.

\*

SELECT-OPTIONS : s_object FOR tadir-object.

\*

PARAMETERS : p_wsfile LIKE rlgrap-filename.

\*

SELECTION-SCREEN END OF BLOCK b1.

\*

\*&---------------------------------------------------------------------\*

\* INITIALIZATION

\*&---------------------------------------------------------------------\*

INITIALIZATION.

\*

\*&---------------------------------------------------------------------\*

\* AT SELECTION-SCREEN

\*&---------------------------------------------------------------------\*

\*\* Assist file Path for Download

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_wsfile.

PERFORM get_path.

\*

\*&--------------------------------------------------------------------\-

\* START-OF-SELECTION.

\*&--------------------------------------------------------------------\-

\*

START-OF-SELECTION.

\* Get all Accounting Document Details

PERFORM get_tadir.

\*

\*&--------------------------------------------------------------------\-

\* END-OF-SELECTION.

\*&--------------------------------------------------------------------\-

\*

\*END-OF-SELECTION.

IF i_tadir\[\] IS INITIAL.

MESSAGE s208(00) WITH 'No Records Found for the Selection'(003).

ELSE.

\* Prepare Download Table

PERFORM fill_download.

\*\* Submit to gui_download.

PERFORM download_csv USING p_wsfile.

\*

ENDIF.

\*&---------------------------------------------------------------------\*

\*& Form get_path

\*&---------------------------------------------------------------------\*

\* Get The File Path for Download.

\*----------------------------------------------------------------------\*

FORM get_path.

\* Provide F4 Help for Download Path Selection

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

program_name = 'ZFIPDRDGCSV'

dynpro_number = sy-dynnr

field_name = p_wsfile

CHANGING

file_name = p_wsfile

EXCEPTIONS

mask_too_long = 1

OTHERS = 2.

\*

IF sy-subrc <> 0.

MESSAGE s208(00) WITH 'Given Path Unsucessful'(010).

ENDIF.

\*

ENDFORM. " get_path

\*&---------------------------------------------------------------------\*

\*& Form download_csv

\*&---------------------------------------------------------------------\*

\* Download To Pipe CSV File

\*----------------------------------------------------------------------\*

FORM download_csv USING v_p_wsfile LIKE rlgrap-filename.

\*

DATA : v_date LIKE sy-datum,

v_fname TYPE string.

\*

v_date = sy-datum.

\*

CONCATENATE v_p_wsfile v_date INTO v_p_wsfile.

v_fname = v_p_wsfile.

\*

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = v_fname

filetype = 'ASC'

TABLES

data_tab = i_fintab\[\]

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 e435(00) WITH v_fname

'Sorry, File download Unsucessful'(008) space.

ELSE.

MESSAGE s435(00) WITH v_fname 'Download Sucessful'(009) space.

ENDIF.

\*

ENDFORM. " download_csv

\*&---------------------------------------------------------------------\*

\*& Form get_tadir

\*&---------------------------------------------------------------------\*

\* Get all the Custom Objects

\*----------------------------------------------------------------------\*

FORM get_tadir.

\*

SELECT

pgmid "program id

object "object TYPE

obj_name "object name

author "person responsible

devclass "development class

INTO TABLE i_tadir

FROM tadir

WHERE pgmid EQ c_r3tr

AND devclass EQ p_class

AND object IN s_object.

\*

IF sy-subrc = 0.

SORT i_tadir BY pgmid object author.

\*

SELECT

tcode "Transaction Code

pgmna "Program Name

INTO TABLE i_tstc

FROM tstc

FOR ALL ENTRIES IN i_tadir

WHERE pgmna EQ i_tadir-obj_name

AND ( tcode LIKE 'Z%' OR tcode LIKE 'Y%' ).

IF sy-subrc EQ 0.

SORT i_tstc BY pgmna.

ENDIF.

ENDIF.

\*

ENDFORM. " get_tadir

\*&---------------------------------------------------------------------\*

\*& Form fill_download

\*&---------------------------------------------------------------------\*

\* Prepare Download Table

\*----------------------------------------------------------------------\*

FORM fill_download.

\*

\*Fill Header Line for Download Table

\*

CONCATENATE 'S.No'

'Program ID'

'Object Type'

'Object Name'

'T.Code'

'Author'

'Development Class' INTO wa_fintab-string

SEPARATED BY v_tab.

\*

APPEND wa_fintab TO i_fintab.

\*

LOOP AT i_tadir INTO wa_tadir.

v_count = v_count + 1.

\*

READ TABLE i_tstc INTO wa_tstc WITH KEY pgmna = wa_tadir-obj_name

BINARY SEARCH.

IF sy-subrc NE 0.

wa_tstc-tcode = ' '.

ENDIF.

\*

CONCATENATE v_count

wa_tadir-pgmid

wa_tadir-object

wa_tadir-obj_name

wa_tstc-tcode

wa_tadir-author

wa_tadir-devclass INTO wa_fintab-string

SEPARATED BY v_tab.

\*

APPEND wa_fintab TO i_fintab.

\*

ENDLOOP.

\*

ENDFORM. " fill_download 

Labels

snippet snippet Delete
abap abap Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.