Friday, October 15, 2010

Method of displaying the hidden ABAPs of SAP - from the transport data files

REPORT ZREADATR NO STANDARD PAGE HEADING LINE-SIZE 132.
************************************************************************
* The program reads a transport data file, and using some simple filters
* displays the contents. To see an abap source, first create a transport
* using se01 with an entry like: LIMU REPS SAPMSYST, then analyze it.
* This program does not handle data files bigger than 65535 bytes.
* I tested a slightly different version of this program as well, that
* changed some data in the data file, and imported it back - and it
* worked. But be careful with that, it can screw your system big time!
************************************************************************
* Get the filename
PARAMETERS: FILE(40) LOWER CASE OBLIGATORY
DEFAULT '/usr/sap/trans/data/R901111.ZZZ'.

* Find out the size of the transport file
DATA: L(132), F(50) VALUE '/tmp/azaz'.
DATA: FILT(56) VALUE 'ls -l'.
DATA: A, B(10) TYPE N.
FILT+6 = FILE.
OPEN DATASET F FOR OUTPUT IN TEXT MODE FILTER FILT.
CLOSE DATASET F.
OPEN DATASET F FOR INPUT IN TEXT MODE.
READ DATASET F INTO L.
IF SY-SUBRC <> 0. WRITE: / 'File does not exist'.EXIT. ENDIF.
DELETE DATASET F.
CONDENSE L.
SPLIT L AT ' ' INTO A A A A B A A A A.
IF B IS INITIAL OR B CN '0123456789 '.
WRITE: / 'File does not exist'.
ENDIF.
IF B > 65535.
WRITE: / 'File size is too big for this program'. EXIT.
ENDIF.
B = B - 11.

* Read an process the transport file
DATA: LL(65535) TYPE C.
DATA: I TYPE I, J TYPE I, K TYPE I.
DATA: X(11), Q(83), Y(3).
DATA: BEGIN OF STRUCC,
1(5), 2(1) TYPE X, 3(2), 4(3), 5(72),
END OF STRUCC.

OPEN DATASET FILE IN BINARY MODE FOR INPUT.
READ DATASET FILE INTO LL.

DO B TIMES.
I = SY-INDEX - 1.
X = LL+I.
IF X CP '+ ++++ +++'.
Y = X+2.
IF Y NA
' abcdefghijklmnopqrstxwz1234567890ABCDEFGHIJKLMNOPQRSTXWZ+=-/?*><'.
K = I - J.
Q = LL+J(K).
STRUCC = Q.
WRITE: / STRUCC-1, STRUCC-2, STRUCC-3, STRUCC-5.
J = I.
ENDIF.
ENDIF.
ENDDO.

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites