0% found this document useful (0 votes)
692 views

ABAP-Download All Custom (Z) Objects With Respect To DEV Class - Code Gallery - Community Wiki

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
692 views

ABAP-Download All Custom (Z) Objects With Respect To DEV Class - Code Gallery - Community Wiki

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2/10/2020 ABAP-Download All Custom (Z) Objects with respect to DEV Class - Code Gallery - Community Wiki

Welcome to the new version of SAP Community Wiki: Learn What's New? and what has changed.
Dashboard

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


Created by Former Member, last modified by Former Member on Jun 21, 2013

Author: Kaleemullah
Submitted: 19/07/2007
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.
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
REPORT zuipzproggdnld NO STANDARD PAGE HEADING MESSAGE-ID 00.
*Table Declarations
TABLES : tadir.
* Type Declarations
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,
BEGIN OF t_tstc,
tcode LIKE tstc-tcode, "Transaction Code
pgmna LIKE tstc-pgmna, "Program Name
END OF t_tstc,
BEGIN OF t_header,
name(80) TYPE c,
END OF t_header,
BEGIN OF t_fintab,
string TYPE string,
END OF t_fintab.
* Table Declarations
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.
* Work Area Declarations
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.
* Global Variable Declarations
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'

https://wiki.scn.sap.com/wiki/display/Snippets/ABAP-Download+All+Custom+(Z)+Objects+with+respect+to+DEV+Class?original_fqdn=wiki.sdn.sap.com 1/3
2/10/2020 ABAP-Download All Custom (Z) Objects with respect to DEV Class - Code Gallery - Community Wiki

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'

https://wiki.scn.sap.com/wiki/display/Snippets/ABAP-Download+All+Custom+(Z)+Objects+with+respect+to+DEV+Class?original_fqdn=wiki.sdn.sap.com 2/3
2/10/2020 ABAP-Download All Custom (Z) Objects with respect to DEV Class - Code Gallery - Community Wiki

'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
abap snippet

1 Comment
Unknown User (1039ik7yk)
Hi,
I tried to created that program but it gave error at every line that begab by /
I deleted all those characters and them I managed to activated the program.
Now I executed the program and tried to download the code or a Class. In the program selection screen I placed the folowing:
P_CLASS --> Name of the class
S_OBJECT --> CLSD (Class Definition)
P_WSFILE --> the path in my PC where the file should be stored
However, if returns an error message: "No records found for the selection"
What am I doing wrong? Do you know how to solve that?
Thanks very much in advance.
Rgds
Salvador

Privacy Terms of Use Legal Disclosure Copyright Trademark Cookie Preferences

https://wiki.scn.sap.com/wiki/display/Snippets/ABAP-Download+All+Custom+(Z)+Objects+with+respect+to+DEV+Class?original_fqdn=wiki.sdn.sap.com 3/3

You might also like