ABAP/4 Samples

These samples were written by Imre Kabai and Benny G. Sørensen.
For more information, see the comments in the individual source files.

Performance Tuning Utilities
ZHEAVYLS Detects long-running ABAP programs - report
ZHEAVYPR Detects long-running ABAP programs - collector
ZSSTAT20 Display percentage of dialog steps < 1 sec for two peak business hours - report

Load Balancing Utilities
ZPROCTIM Balance services between application servers - report
RSNAPJOB Schedule reorg background jobs in a client (variants needed) - report
YPARALL Parallel execution of a given transaction in many systems from 1 calling system - report + remote function module

System Monitoring Utilities
ZBCMKZ17 Report & Transaction Starter - shows individual list of reports/transactions to start, like User Menu, but you can also start reports with it much faster. Requires a new table.
YSYSCHK2 Parallel monitoring of the most important parameters of many SAP systems - report
YSYSLG Write an entry to syslog via ABAP - report
YRDSYSLG Display yesterday's syslog entries via ABAP - report
YSYSDOCU Complete SAP/UNIX/ORACLE status documentation (HP only) - report
YCOLLECT Collect data for active SAP users - program
ZBCTCB89 Create a system user list, useful in multi-client development system - report
YOBJRES Reset access key of modified object - report
YEDULOCK Switch editor lock flag of an object - report
SysHealth ABAP code and UNIX script to report basic status of an SAP system or systems; primarily a concatenated version of SM04, SM13, SM50, ST03, and others

Transport Utilities
ZREPAIRS Find repaired objects - report
YFTP1 FTP via ABAP - report + Unix Script
YCHORIG Change originating SID of any object - program
ZMODTRP Implementation of an automatic SRM/PST golden client/test client transport landscape - transaction + UNIX script
YMASTCP Master client copy trigger - if no user activity or scheduled jobs - report

Security Utillities
YSESSCHK Limit number of logins in a client - report
ZNOLOG Prevent user logins to an application server - report
ZCPASSW Copy user's password from one client to all other clients - program
YSETPASS Reset passwords of all users in specific client to the same default - report
YUSERMOD Create SAP users with profiles, address, defaults, and parameters - BDC program
YAPPLOG Write user login data to the application log - report
YUSRLOCK Lock/unlock users, display login status, last login time - interactive report
ZCPICT1 Trojan Client: sends ABAP to Trojan Server (system B) using CPIC, and gets the result - report [1/2]
ZTRHORSE Trojan Server: runs Trojan Client ABAP (system A) and returns the result - report [2/2]

ABAP/4 Utillities
ZZBGS106 Download ABAP/4 source code and TEXTPOOL to the desktop.
ZZBGS002 Unix File Manager in ABAP/4 via Unix OS Calls
ZZBGS003 Read header and position text items from within ABAP/4.
ZZBGS022 Read transparent data from VIEWS using Select statement
ZZBGS030 List all function modules, then go to SE37 by double-clicking.
ZZBGS044 List all tables, and jump to datadic or SE16 by selecting plus F2 or F8.
XMP00001 Print table contents without knowing table name or structure before runtime.
ZUT80007 List all tables containing field defined in selection criteria; select a line and jump to SE12.
ZSTSEARC Attempt to locate C program calls SAP uses - report

Authorization Utillities
ZZBGS092 List contents of an authorization profile with hierarchy, objects and fields; example of recursive calls of form routines.
ZZBGS057 List authorization objects, fields and activities for each application (object class), and for each application function.
ZZAUT002 Create Authorizations for authorization objects. Uses Object and authorization name as input and calls the standard R/3 popup for setting up athorization fields. You don't have to know the object class.
ZZAUT004 Create Single profiles. Uses the profile name and a table of object name and authorization name as input and creates the single profile in the R/3 system.
ZBCAUTHL QAD-reports, listing Userids and authorization profiles in different clients.
ZREDUNDA Display redundant authorizations for the current user - report

Interface Utillities
ZZBGS101 Download any table to the desktop, regardless of maximum number of rows.
ZZBGS008 Example of using Field Groups, Collect, Sort and Extract
ZZBGS010 Uploading, Downloading and Executing Excel from within ABAP/4.
Convert any internal table to a comma separated file. The internal table must be defined in ABAP/4 Dictionary.
ZZBGS087 Simulate batch-input screen flow. Execute a normal online transaction within this program and you will see the batch-input screen flow.
ZUTBDCER Take information about a BDC session (name, creation date and creation time) and print any erroneous transactions.
ZZSNI001 QAD-reports, listing input file concerning sales-order direct-input.
ZZBGS700 Interface between R/3 and EXCEL using OLE2.
SAPMSYST Customized login screen - list of clients, comments, MOTD, etc. - transaction

ABAP/4 Tips, Tricks, & Misc Samples
Solitaire ABAP code that plays Solitaire
Example of using left Scroll Boundary in lists. Create scroll able report list and keep some characters left on the screen.
At line
Example on At line selection. The program list all programs in regards to the selection criteria, selecting a line and jump to the abap/4 editor with the selected program
File Browser Example of a simple file browser
File Manager Example of a simple File Manager for the Unix Environment
File Manager Example of a simple File Manager on the presentation server - report
Send E-mail Send E-mail from SAP to a specific user, to all users of a client or to all users of a system - report
Send Popup Send an instantaneous pop-up message to any active user, or when they login next
Launch Web Launch a WWW Browser from SAPGUI Help Menu - report
Launch Word Start Microsoft Word, passing data and returning changed data on exit - report
Performance Examples of optimized reading of database tables. A couple of forms encapsulating loading and reading of table T001.
ZZXMP001 Calulating Columns Total
ZZXMP002 Calculating time between clock-in clock-out
YDELAY Delay N seconds - report
YPROGIND Progress indicator - report
YGUIVERS Display SAPGUI frontend version - report
YOLE Display a picture and text stored in SAP using OLE2 - report
RSRSCAN1 R/3 Standard - Find string in program source.

UNIX Utilities
ORACLE Display ORACLE start/stop times from alert log - UNIX script
EMC Display EMC disk id, hardware path, and corresponding device file - UNIX script
DISKIO Calculate avg io, wait, etc. per disk via sar - UNIX script
SAPUSERS List active SAP users via RFC calls - C program [1/2]
ZTST Server remote function module for SAPUSERS [2/2]

vi Powered! holland@pobox.com