Translations in ABAP reports
Hi all !!!
Is there any way to export all texts from abap reports in
any standard format ?? (tab separeted etc.). I need to prepare translations of my abap reports and I have to prepare document with all text used in it for sworn translator. Standard translations tool visible from se80 doesn't have such option.
Thanx for any help.
Check out this program....
report zrich_0001
no standard page heading.
parameters: p_prog type rs38m-programm,
p_lang type sy-langu.
data: save_textpool like textpool occurs 0 with header line.
read textpool p_prog language p_lang into save_textpool.
call function 'WS_EXCEL'
exporting
filename = 'TextElements.xls'
tables
data = save_textpool.
Regards,
Rich Heilman
Similar Messages
-
hi guys,
please advise how can i download/export ABAP(report,module pool...etc) source code to client PC?
thanks.hi
this report is to export to another server...
PROGRAM ZDOWNLOAD_SAP
LINE-SIZE 132
LINE-COUNT 62
NO STANDARD PAGE HEADING.
This program up / downloads from / to a local dataset
all the components of an ABAP - i.e TEXTS, the entire CUA
including statuses and menus, DYNPROS and source code.
Program documentation and variants are not handled.
INCLUDED programs are automatically handled both on upload
or download. INCLUDE selection can be excluded or generic
e.g only handle INCLUDES starting with ZIN*
INCLUDES within INCLUDES alos handled.
The only restriction is on UPLOAD the INCLUDED programs must come
from the same directory as the main program.
On Download of course the ABAP must exist in the library.
Note for LINUX and BATCH users
This program was originally designed as a one off tool for
getting ABAPS etc from a SAP R2 (IBM MVS mainframe system) into
an R3 test system minimising the need for a large amount of
mainframe sysprogs (anybody remember what they were !!) time
and support to say nothing of access problems from TSO /JES2 /
SAP R2. At that time network connections were patchy and the
transport systems largely incompatable and not very reliable.
This program was originally designed as a one off tool for
Must run on Windows front end ---- If you are running SAP with
LINUX on your work station you will have to change the WS_UPLOAD
and WS_DOWNLOAD functions to reflect the Linux file system. The
contents of the data sets themseleves do not need to be changed
Program can easily be modified to run in batch and store
the data on a UNIX host. Change the WS_UPLOAD and WS_DOWNLOAD
to read from and write to UNIX data sets (OPEN FILE etc).
You will also need to modify the parts of the program that get
the DOS directory and display the Windows file paths.
The actual abap data sets do not need to be changed.
Rel 4.0 names can now be up to 40 bytes long
Dynpros and CUA have changed from rel 3.1
Tabstrips now loaded and unloaded in dynpros
Please note restriction on 4.6 systems for users who
have ABAP names which include '/'s in their names.
Rel 4.6b, 4.6c Abap names can include the '/' in their names
e.g /CUST1/CUST2/ORDER
This causes problems when storing to a local file.
a solution is to change the name to %CUST1%CUST2%ORDER i.e / will
be changed to %. On upload the % should be changed back to /
again. This change still needs to be implemented.
If you don't use the / in the abap name then this is not a problem.
If file to be uploaded is in rel 3 format then names are only 8
bytes long.
program uses 3 datasets per abap
1) abapname.eee source, dynpr logic, texts, CUA stuff
2) abapname.hhh dynpr header
3) abapname.fff dynpro fields.
because of varying lengths and contents 3 data sets are used. The
complexity of combining all these to 1 data set would make the
program far too complex.
NOTE: This version of the program can only be used on
release 4.0 or higher. Once an ABAP has been converted
to rel 4.0 it cannot be converted back to rel 3.0
on a release 3/3.1 system. Release 4 CUA tables
are different. Use release 3 version of this program
for releases 3.0 and 3.1. Available on SAPFANS website.
Note that data to be uploaded must have been previously downloaded
by this program (any version since rel 2.0) - except for Initial
Load -- see end of these comments.
Dynpros and CUA statuses have changed since rel 3.1
This program will handle rel 3.1 format on upload but will
download in rel 4.0 format. To upload 3.1 format specify an 'X'
in the rel3 parameter.
If you have downloaded components in rel 4.0 format and you
want to re-load to a 3.1 system you will have to load
the source via standard upload and re-create dynpros and the CUA
manually.
As names can now be longer than 8 characters you can only
use this program if the SAP front end (SAPGUI) supports
long file names (WIN 95/98 or WIN NT). Windows 3.x will not
work as the underlying DOS system cannot handle long file names.
UPLOAD function and DOS directory.
When an ABAP is selected for UPLOAD then the DOS
directory is read into a table. A file called ABAP.BAT is created,
and down loaded to the 'C' drive and executed.
This file executes a DOS DIR command and pipes the output
into a dataset which is then uploaded into an internal
table on SAP.
Note on running DOS commands from ABAP
The first time this procedure is executed you will see a DOS window
which you will have to close manually. To get round this
use windows explorer to select the file ABAP.BAT and then
right mouse click on the file name. Select the
properties window. From this click the CLOSE on EXIT box. This
will then automatically close the DOS function after it has
executed. (Windows restriction).
The DOS function has not been tested using Windows 2000 so
it might not work. OK on W95,W98,WME and Windows NT (No Thanks)
If INCLUDE programs are wanted on UPLOAD only the specified
directory is searched.
Instead of entering path name manually you can click on
the path parameter. Because of Windows restriction you will
have to select ANY file in the relevant directory.
The path will then be copied on to the selection screen.
To do still : Merge 3 files to one and compress output to .ZIP file
fix 4.5 4.6 problem of abaps containing '/' in the name
possibility to automatically up / download referenced
function modules with selection criteria like INCLUDES
To load the ist time into a system.
Create program with ABAP editor and Upload the .EEE file.
Delete ist line (????SRCE) in the ABAP EDITOR --NOT THE DISK FILE
Delete all the source from the line that starts ????TEXT (towards
the end file) till the end so the last line in your source is ENDFORM.
DO NOT ALTER THE DISK FILE. DO THESE CHANGES IN THE ABAP EDITOR.
Save file and execute
Use following parameters (Note the ist time you won't get proper
text on the selection screen).
Function U
Path full dos path containing source e.g c:\abaps\
NOTE YOU MUST ENTER THE FINAL \ as above.
REPID the program name. e.g ZZJIMHXX
note that on the DISK you will see 3 files
ZZJIMHXX.EEE, ZZJIMHXX.FFF, ZZJIMHXX.HHH
just use the name before the dos qualifier - the
program will do the rest
ignore other parameters
The program will then load itself with all the texts etc.
It should now be ready for use.
Macros
DEFINE DEFINE_TABLE.
DATA: &1 LIKE &2 OCCURS &3 WITH HEADER LINE.
END-OF-DEFINITION.
DEFINE CLS.
REFRESH &1.
CLEAR &1.
END-OF-DEFINITION.
DEFINE INIT.
IF &1 NE SPACE.
SEARCH &1 FOR '. .'.
IF SY-SUBRC = 0.
WRITE '*' TO &1+SY-FDPOS(1).
ENDIF.
TRANSLATE &1 USING '*%'.
ELSE.
MOVE '%' TO &1.
ENDIF.
END-OF-DEFINITION.
end of macros
/ SAP standard tables */
TABLES: D020S, "Dynpro header
D020T, "Dynpro title
D021T, "Screen field keyword texts
TRDIR, "Attribute table
TADIR, "Dev. class etc.
EUDB, "CUA data
TSTC, "transaction data
TITLE, "CUA titles
RSMPTEXTS. "Function texts (rel 4.0)
/ Work tables to hold ABAP source etc, and dynpro */
/ contents. */
DATA: BEGIN OF H. "Header
INCLUDE STRUCTURE D020S.
DATA: END OF H.
DATA: BEGIN OF H1 OCCURS 10, "Header
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N.
INCLUDE STRUCTURE D020S.
DATA: END OF H1.
DATA: BEGIN OF H2 OCCURS 0, "Rel 3 dynp. header
CNAME(8) TYPE C,
CNUM(4) TYPE C,
NNAME(8) TYPE C,
NNUM(4) TYPE C,
FILL(51) TYPE C,
CDAT(6) TYPE C,
CTIM(6) TYPE C,
END OF H2.
DATA: BEGIN OF F OCCURS 250. "Dynpro Fields
INCLUDE STRUCTURE D021S.
DATA: END OF F.
DATA: BEGIN OF F1 OCCURS 500, "Dynpro Fields
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N.
INCLUDE STRUCTURE D021S.
DATA: END OF F1.
DATA: BEGIN OF OLD_F1 OCCURS 0, "Dynpro Fields (rel 3)
NAME(8) TYPE C,
NUMBER(4) TYPE C.
INCLUDE STRUCTURE D021SE_OLD.
DATA: END OF OLD_F1.
DATA: BEGIN OF F2 OCCURS 0, "Dynpro Fields (rel 3)
TFIL(284) TYPE C,
END OF F2.
DATA: BEGIN OF M OCCURS 3. "Match codes (if any)
INCLUDE STRUCTURE D023S.
DATA: END OF M.
DATA: BEGIN OF E OCCURS 0. "Dynpro Logic
INCLUDE STRUCTURE D022S.
DATA: END OF E.
DATA: BEGIN OF E1 OCCURS 0, "Dynpro Logic
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N.
INCLUDE STRUCTURE D022S.
DATA: END OF E1.
DATA: BEGIN OF T OCCURS 0, "prog name and dynpro nrs
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N,
END OF T.
DATA: BEGIN OF R OCCURS 56, "prog name and language
NAME(40) TYPE C, "rel 4
LANGUAGE(1) TYPE C,
END OF R.
DATA: BEGIN OF S OCCURS 3000,
TXT(180) TYPE C, "rel 4 was 132
END OF S.
DATA: BEGIN OF R1 OCCURS 50, "for include programs
NAME(40) TYPE C, "rel 4
INSTANCE(3) TYPE P,
END OF R1.
DATA: BEGIN OF S1 OCCURS 3000,
TXT(180) TYPE C, " rel 4 was 132
END OF S1.
DATA: BEGIN OF U OCCURS 100, "Text elements
TXT(180) TYPE C, " rel 4 was 132
END OF U.
DATA: BEGIN OF DIR. "ABAP Attributes
INCLUDE STRUCTURE TRDIR.
DATA: END OF DIR.
DATA: BEGIN OF DTXT. "Dynpro field keyword texts
INCLUDE STRUCTURE D021T.
DATA: END OF DTXT.
/ This data contains all the components of the */
/ CUA such as menus, statuses, Pfkeys */
/ As from rel 4.5 Tabstrips are automatically copied as well */
/ The rel3 parameter must be set however to load the */
/ correct version of the CUA tables if uploading rel 3 */
/ data to a rel 4 system. */
/ Rel 4.0B can convert 3.1 and earlier CUA's */
/ This could change later however. */
CUA Tables.
Key of CUA tables in EUDB data set. Name is len 40 in rel 4.0
DATA BEGIN OF EU_KEY.
INCLUDE STRUCTURE RSEU1_KEY.
DATA END OF EU_KEY.
Status
DATA BEGIN OF STA OCCURS 0.
INCLUDE STRUCTURE RSMPE_STAT. " rel 4
DATA END OF STA.
Functions
DATA BEGIN OF FUN OCCURS 0.
INCLUDE STRUCTURE RSMPE_FUNT. "rel 4
DATA END OF FUN.
Menus
DATA BEGIN OF MEN OCCURS 0.
INCLUDE STRUCTURE RSMPE_MEN. "rel 4.0
DATA END OF MEN.
Menus (texts)
DATA BEGIN OF MTX OCCURS 0.
INCLUDE STRUCTURE RSMPE_MNLT. "rel 4.0
DATA END OF MTX.
Action Bar
DATA BEGIN OF ACT OCCURS 0.
INCLUDE STRUCTURE RSMPE_ACT. "rel 4.0
DATA END OF ACT.
Push Buttons
DATA BEGIN OF BUT OCCURS 0.
INCLUDE STRUCTURE RSMPE_BUT. "rel 4.0
DATA END OF BUT.
PF-Keys
DATA BEGIN OF PFK OCCURS 0.
INCLUDE STRUCTURE RSMPE_PFK. "rel 4.0
DATA END OF PFK.
Function sets
DATA BEGIN OF SET OCCURS 0.
INCLUDE STRUCTURE RSMPE_STAF. "rel 4.0
DATA END OF SET.
Documentation
DATA BEGIN OF DOC OCCURS 0.
INCLUDE STRUCTURE RSMPE_ATRT. "rel 4.0
DATA END OF DOC.
Title codes with text
DATA: BEGIN OF TIT OCCURS 0.
INCLUDE STRUCTURE RSMPE_TITT. "rel 4.0
DATA: END OF TIT.
DATA BEGIN OF FTX OCCURS 0. "rel 4.0
INCLUDE STRUCTURE RSMPTEXTS.
DATA END OF FTX.
rel 3.1 CUA components.
Status
DATA BEGIN OF OLD_STA OCCURS 0.
INCLUDE STRUCTURE RSEU1_GEN. " rel 3.1
DATA END OF OLD_STA.
Functions
DATA BEGIN OF OLD_FUN OCCURS 0.
INCLUDE STRUCTURE RSEU1_FUN. "rel 3.1
DATA END OF OLD_FUN.
Menus
DATA BEGIN OF OLD_MEN OCCURS 0.
INCLUDE STRUCTURE RSEU1_MEN. "rel 3.1
DATA END OF OLD_MEN.
Menus (texts)
DATA BEGIN OF OLD_MTX OCCURS 0.
INCLUDE STRUCTURE RSEU1_TXM. "rel 3.1
DATA END OF OLD_MTX.
Action Bar
DATA BEGIN OF OLD_ACT OCCURS 0.
INCLUDE STRUCTURE RSEU1_ACT. "rel 3.1
DATA END OF OLD_ACT.
Push Buttons
DATA BEGIN OF OLD_BUT OCCURS 0.
INCLUDE STRUCTURE RSEU1_BUT. "rel 3.1
DATA END OF OLD_BUT.
PF-Keys
DATA BEGIN OF OLD_PFK OCCURS 0.
INCLUDE STRUCTURE RSEU1_PFK. "rel 3.1
DATA END OF OLD_PFK.
Function sets
DATA BEGIN OF OLD_SET OCCURS 0.
INCLUDE STRUCTURE RSEU1_SET. "rel 3.1
DATA END OF OLD_SET.
Documentation
DATA BEGIN OF OLD_DOC OCCURS 0.
INCLUDE STRUCTURE RSEU1_ETM. "rel 3.1
DATA END OF OLD_DOC.
Title codes with text
DATA: BEGIN OF OLD_TIT OCCURS 0.
INCLUDE STRUCTURE TITLE. "rel 3.1
DATA: END OF OLD_TIT.
dynamic function text
DATA BEGIN OF FDN OCCURS 1.
INCLUDE STRUCTURE RSEU1_FDYN. "not req for rel 4.
DATA END OF FDN.
Icons
DATA BEGIN OF FIN OCCURS 1.
INCLUDE STRUCTURE RSEU1_ICON. "not req for rel 4
DATA END OF FIN.
dynamic menu texts
DATA BEGIN OF MDN OCCURS 1.
INCLUDE STRUCTURE RSEU1_MDYN. "not req for rel 4.
DATA END OF MDN.
Symbol list
DATA BEGIN OF SYM OCCURS 0.
INCLUDE STRUCTURE RSEU1_SYMB.
DATA END OF SYM.
Status Short text
DATA BEGIN OF STX OCCURS 0.
INCLUDE STRUCTURE RSEU1_CTX.
DATA END OF STX.
Attributes for function key settings (menu bars) Rel 3.0
DATA BEGIN OF ATT OCCURS 0.
INCLUDE STRUCTURE RSEU1_HAT.
DATA END OF ATT.
Include-Menus
DATA BEGIN OF INC OCCURS 3.
INCLUDE STRUCTURE RSEU1_INC.
DATA END OF INC.
Last used numbers
DATA BEGIN OF LAST.
INCLUDE STRUCTURE RSEU1_LST.
DATA END OF LAST.
data for call transaction (SE41 to re-generate the CUA)
DATA: BEGIN OF T_BDC_TAB OCCURS 0.
INCLUDE STRUCTURE BDCDATA. "BDC data
DATA: END OF T_BDC_TAB.
DATA: BEGIN OF T_MESSTAB OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF T_MESSTAB.
/ Program data */
DATA: NUMBER(4) TYPE N,
OLDNUM(4) TYPE N,
FILESIZE TYPE I,
NR_OF_BYTES TYPE I,
I(3) TYPE P,
IX(3) TYPE P,
J(3) TYPE P,
L(3) TYPE P,
CUA-FLAG(1) TYPE C,
CUA_RETURN(10) TYPE C,
DYNPRO_MESSAGE(160) TYPE C,
DYNPRO_LINE TYPE P,
DYNPRO_WORD(30) TYPE C,
NUM(3) TYPE N,
DYNNAME(44) TYPE C,
FN1(128) TYPE C,
FN2(128) TYPE C,
FN3(128) TYPE C,
W_ITERATE(1) TYPE C,
MAIN(1) TYPE C,
FUNC(1) TYPE C,
OLDNAME(40) TYPE C,
OLD-FUNC(8) TYPE C,
NEW-FUNC(8) TYPE C,
FOUND(1) TYPE C,
LANGUAGE LIKE SY-LANGU,
FIRST-TIME(1) TYPE C VALUE 'Y',
OK-CODE(5) TYPE C,
NAME(40) TYPE C, "rel 4
TXLINE(70) TYPE C,
LINE(132) TYPE C.
DATA:
UL_FILE(128) TYPE C,
DL_FILE(128) TYPE C,
DOSLINE(72) TYPE C.
DATA: BEGIN OF DOSDIR OCCURS 0,
TEXT(72),
END OF DOSDIR.
DATA: BEGIN OF I_PROG OCCURS 0,
NAME(40),
END OF I_PROG.
DATA: BEGIN OF I_PROGT OCCURS 0,
NAME(40),
END OF I_PROGT.
DATA: BEGIN OF I_INCLUDE OCCURS 0,
NAME(40),
HANDLED(1) TYPE C,
END OF I_INCLUDE.
DATA: BEGIN OF I_INCL OCCURS 0,
NAME(40),
END OF I_INCL.
DATA: BUFFER(1024).
DATA: WINSYS(3).
DATA: GLOBAL_FILEMASK_MASK(20), GLOBAL_FILEMASK_TEXT(20).
DATA: GLOBAL_FILEMASK_ALL(80).
DATA: T_FILENAME(128),
TMP_FILENAME(128),
T_MODE(1),
FIELDLN TYPE I.
DEFINE_TABLE I_DYNPFIELDS DYNPREAD 0. "dynpro fields to be updated
DATA: I_FLDS LIKE HELP_VALUE OCCURS 0 WITH HEADER LINE.
FIELD-SYMBOLS: <F>.
/ Parameters */
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS REPID FOR TRDIR-NAME OBLIGATORY .
PARAMETERS:
FUNCTION(1) TYPE C OBLIGATORY, "Function
DSNAME(40) TYPE C, "Data set name
INCLUDES(1) TYPE C DEFAULT 'N', "Resolve Includes
IMASK(40) TYPE C, "Include Mask
CLASS LIKE TRDIR-CLAS,
AUTHOR LIKE TRDIR-CNAM, "Author
APPL LIKE TRDIR-APPL,
PATH(88) TYPE C DEFAULT 'A:\',
REL3(1) TYPE C.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-005.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-002.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-003.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK A1.
/ Check users workstation is running WINDOWS, */
/ WINDOWS 95, or WINDOWS NT. OS/2 no good for */
/ this application. */
CALL FUNCTION 'WS_QUERY'
EXPORTING
QUERY = 'WS'
IMPORTING
RETURN = WINSYS.
IF WINSYS(2) NE 'WN'. "Win 3.X no good either
WRITE: / 'Windows NT or Windows 95/98 is required'.
EXIT.
ENDIF.
/ Get names of programs to be handled. */
/ Name can be a single value, many values or ranges */
/ as per standard SELECT-OPTIONS on selection screen */
/ On Download read TRDIR and store program names in a table */
/ as per selection options. */
/ On upload read the specified directory for all files of */
/ type .EEE from specified directory */
/ compare file names with selection criteria */
MOVE FUNCTION TO FUNC.
MOVE 'Y' TO MAIN.
CASE FUNC.
WHEN 'U'. "Upload required
PERFORM READ_DOS_DIRECTORY.
PERFORM GET_RANGE_UL. "Get list of progs to process
WHEN 'D'. "Download required
PERFORM GET_RANGE_DL. "Get list of progs to process
WHEN OTHERS.
WRITE: / 'Function not performed due to user request'.
EXIT.
ENDCASE.
SORT I_PROG.
DELETE ADJACENT DUPLICATES FROM I_PROG.
For download INCLUDE handling can be resolved via function
module call.
All Includes within Includes are also resolved by the function
module call.
Note that this method does not work if program itself is of type
I (it's an include)
In this case we can still search the source.
IF FUNC = 'D'.
IF INCLUDES = 'Y'.
PERFORM GET_INCLUDES_DL.
PERFORM PROCESS_INCLUDES_DL.
ENDIF.
ENDIF.
Program list from selection criteria i.e excluding INCLUDES found
LOOP AT I_PROG.
MOVE I_PROG-NAME TO R1-NAME.
APPEND R1.
DESCRIBE TABLE R1 LINES I.
WHILE I NE 0.
PERFORM EXECUTE-FUNCTION.
ENDWHILE.
REFRESH R1.
ENDLOOP.
We need to check now for INCLUDES on DOWNLOAD when the INCLUDE
program itself is of type I. In this case the function call
will not return the INCLUDES. For example we could be
downloading ZTESTTOP (an Include itself) which as an include
ZTEST01.
The process fortunately is the same as the UPLOAD function
except of course we need to read the library instead of the
DOS directory
process INCLUDE modules for Upload
On upload the procedure is more complex as Includes within
Includes can only be resolved by scanning the code and
searching if the program exists in the directory.
To get all INCLUDES within INCLUDES entries in table I_INCL
that do not exist in I_INCLUDE are copied to table I_INCLUDE
after each entire pass of table i_INCLUDE and table is then
re-looped through. Programs in table I_INCLUDE that have already
been processed have a "Y" indicator set in I_INCLUDE-AVAIL.
if func = 'U'.
IF INCLUDES = 'Y'.
DESCRIBE TABLE I_INCL LINES I.
IF I > 0.
W_ITERATE = 'Y'.
ELSE.
W_ITERATE = ' '.
ENDIF.
WHILE W_ITERATE = 'Y'.
PERFORM PROCESS_INCLUDES_UL.
PERFORM LOOP_THROUGH.
DESCRIBE TABLE I_INCL LINES I.
IF I > 0.
W_ITERATE = 'Y'.
ELSE.
W_ITERATE = ' '.
ENDIF.
ENDWHILE.
endif.
ENDIF.
DESCRIBE TABLE I_INCLUDE LINES I.
IF I > 0.
SKIP 1.
WRITE: / ' Included Programs found'.
SKIP 1.
LOOP AT I_INCLUDE.
WRITE I_INCLUDE-NAME TO LINE(40).
CONDENSE LINE.
WRITE: / LINE(80).
ENDLOOP.
ENDIF.
/ Table R contains ABAP names to up / download. */
/ Loop through table R and perform up / download */
/ for each program. */
/ Table R1 contains INCLUDE names found (if any) */
/ As each */
FORM EXECUTE-FUNCTION.
LOOP AT R1.
MOVE-CORRESPONDING R1 TO R.
APPEND R.
ENDLOOP.
REFRESH R1.
LOOP AT R.
REFRESH : T, E1, H1, F1, S, U.
PERFORM PROCESS.
MOVE 'N' TO MAIN.
ENDLOOP.
REFRESH R.
DESCRIBE TABLE R1 LINES I.
ENDFORM.
/ Build file names for UP/DOWNLOAD */
/ 3 files are generated per ABAP. */
/ 1) ABAP Path\PROGNAME.EEE (ABAP, Attr,Texts) */
/ Logic Path\PROGNAME.EEE (Dynpro Source Logic) */
/ CUA Path\PROGNAME.EEE (CUA components - keys etc) */
/ 2) Header Path\PROGNAME.HHH (Dynpro Header) */
/ 3) Fields Path\PROGNAME.FFF (Dynpro Field definitions )*/
/ ( If alternate file name specified -DSNAME- this will */
/ be used instead. This is only valid for the main program. */
/ INCLUDED programs will have file names as specified */
/ above). */
/ By using this scheme it saves the user from having to */
/ be prompted for 3 file names. */
/ If you want multiple copies / versions on disk either */
/ rename the old versions or specify a different directory in */
/ the path parameter. */
FORM PROCESS.
MOVE PATH TO FN1.
CASE MAIN.
WHEN 'Y'.
IF DSNAME NE SPACE.
WRITE DSNAME TO FN1+66. "rel 4
ELSE.
WRITE R-NAME TO FN1+66. "rel 4
ENDIF.
WHEN OTHERS.
WRITE R-NAME TO FN1+66. "rel 4
ENDCASE.
MOVE FN1 TO FN2.
MOVE FN1 TO FN3.
WRITE '.HHH' TO FN1+124(4). "rel 4
WRITE '.FFF' TO FN2+124(4). "rel 4
WRITE '.EEE' TO FN3+124(4). "rel 4
CONDENSE FN1 NO-GAPS.
CONDENSE FN2 NO-GAPS.
CONDENSE FN3 NO-GAPS.
NAME = R-NAME.
CASE FUNC.
WHEN 'D'.
PERFORM DOWNLOAD_OBJECTS.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been unloaded' TO LINE+55.
CONDENSE LINE.
WRITE: / LINE.
DESCRIBE TABLE T LINES I.
IF I = 0.
WRITE: / 'No Dynpros were found for unload function'.
ELSE.
WRITE: / 'The following Dynpros have been unloaded : '.
PERFORM LOOP_THROUGH_T.
ENDIF.
WHEN 'U'.
PERFORM UPLOAD_OBJECTS.
DESCRIBE TABLE T LINES I.
CASE I.
WHEN 0.
WRITE: / 'No Dynpros were found for restore function'.
WHEN OTHERS.
WRITE: / 'The following Dynpros have been restored : '.
PERFORM LOOP_THROUGH_T.
ENDCASE.
IF MAIN EQ 'Y'.
CASE OLDNAME.
WHEN SPACE.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been restored' TO LINE+55.
CONDENSE LINE.
WRITE: / LINE.
WHEN OTHERS.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been restored - original name :'
TO LINE+55.
WRITE OLDNAME TO LINE+92.
CONDENSE LINE.
WRITE: / LINE.
ENDCASE.
ELSE.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been restored' TO LINE+55.
CONDENSE LINE.
WRITE: / LINE.
ENDIF.
ENDCASE.
ENDFORM.
/ print progname + dynpro nrs that have been processed. */
FORM LOOP_THROUGH_T.
LOOP AT T.
CLEAR LINE.
WRITE R-NAME TO LINE.
WRITE T-NUMBER TO LINE+50.
CONDENSE LINE.
WRITE: / LINE.
ENDLOOP.
ENDFORM.
/ Download Objects */
FORM DOWNLOAD_OBJECTS.
PERFORM UNLOAD_ABAP. "ABAP source, texts, attr
SELECT SINGLE * FROM TRDIR
WHERE NAME EQ R-NAME.
IF TRDIR-SUBC = 'I'.
CASE INCLUDES. "Included file wanted
WHEN 'Y'.
PERFORM SCAN4-INCLUDES.
ENDCASE.
ENDIF.
PERFORM UNLOAD_CUA. "CUA stuff
PERFORM DOWNLOAD_DATA. "Download EEE file to PC
PERFORM BUILD_T. "Build table of all dynpros in ABAP
DESCRIBE TABLE T LINES I.
CASE I.
WHEN 0. "if no dynpros exist then cannot download any
PERFORM DOWNLOAD_DATA. "Download EEE file to PC
WHEN OTHERS.
PERFORM UNLOAD_DYNPROS. "Get Raw dynpros from SAP
PERFORM UNLOAD_DYNPRO_COMPONENTS."Convert to table
PERFORM DOWNLOAD_DATA. "Download ABAP etc. to PC
PERFORM DOWNLOAD_BIN_H1. "Download dynpro header
PERFORM DOWNLOAD_BIN_F1. "Download dynpro fields
ENDCASE.
ENDFORM.
/ Split ABAP up into its component parts */
/ A) Program source (72) */
/ B) Texts (132) */
/ C) Attributes (117) */
/ D) CUA stuff (Various) */
FORM UNLOAD_ABAP.
/ Get ABAP language. Only required on download. */
SELECT SINGLE * FROM TRDIR
WHERE NAME EQ R-NAME.
MOVE TRDIR-RLOAD TO R-LANGUAGE.
READ REPORT R-NAME INTO S. "Get source into table S
MOVE '????SRCE' TO S-TXT.
INSERT S INDEX 1.
/ Text elements, Numbered texts, headings, selection texts */
/ Read text elements with logon language. If they don't */
/ exist read with the value taken from TRDIR. */
READ TEXTPOOL R-NAME INTO U LANGUAGE SY-LANGU.
IF SY-SUBRC NE 0.
READ TEXTPOOL R-NAME INTO U LANGUAGE R-LANGUAGE.
ENDIF.
DESCRIBE TABLE U LINES I.
CASE I.
WHEN 0.
WHEN OTHERS.
MOVE '????TEXT' TO S-TXT.
APPEND S.
LOOP AT U.
MOVE U-TXT TO S-TXT.
APPEND S.
DELETE U.
ENDLOOP.
ENDCASE.
/ Retrieve Attributes from TRDIR and add to table S */
/ Change language to logged on language */
MOVE '????ATTR' TO S-TXT.
APPEND S.
SELECT SINGLE * FROM TRDIR
WHERE NAME EQ R-NAME.
MOVE SY-LANGU TO TRDIR-RLOAD.
MOVE-CORRESPONDING TRDIR TO DIR.
MOVE DIR TO S-TXT.
APPEND S.
ENDFORM.
/ retrieve CUA stuff and append to table S. */
FORM UNLOAD_CUA.
MOVE R-NAME TO EU_KEY-NAME. "Program name for CUA
MOVE 'D' TO EU_KEY-SPRSL. "CUA seems to want D as lang
MOVE R-LANGUAGE TO EU_KEY-SPRSL. "Language "rel 2.2
IMPORT STA FUN MEN MTX ACT BUT PFK SET LAST INC STX DOC "rel 2.2
IMPORT STA STX FUN MEN MTX ACT BUT PFK SET LAST INC DOC "rel 3.0
ATT FDN MDN SYM FIN "rel 3.0
FROM DATABASE EUDB(CU) ID EU_KEY.
IF SY-SUBRC NE 0. "No statuses
EXIT.
ENDIF.
read titles in logged on language. If not present use
language from TRDIR.
CASE REL3.
WHEN SPACE. "(rel 4)
SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
AND SPRSL = SY-LANGU.
MOVE-CORRESPONDING RSMPTEXTS TO FTX.
APPEND FTX.
ENDSELECT.
IF SY-SUBRC NE 0.
SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
AND SPRSL = R-LANGUAGE.
MOVE-CORRESPONDING RSMPTEXTS TO FTX.
APPEND FTX.
ENDSELECT.
ENDIF.
DESCRIBE TABLE FTX LINES I.
IF I > 0.
MOVE '????FTXT' TO S-TXT.
APPEND S.
LOOP AT FTX.
MOVE FTX TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
WHEN OTHERS.
SELECT * FROM TITLE WHERE PROGNAME EQ R-NAME
AND DDLANGUAGE EQ SY-LANGU.
MOVE-CORRESPONDING TITLE TO TIT.
APPEND TIT.
ENDSELECT.
IF SY-SUBRC NE 0.
SELECT * FROM TITLE WHERE PROGNAME EQ R-NAME
AND DDLANGUAGE EQ R-LANGUAGE.
MOVE-CORRESPONDING TITLE TO TIT.
APPEND TIT.
ENDSELECT.
ENDIF.
ENDCASE.
DESCRIBE TABLE STA LINES I.
IF I > 0.
MOVE '????STAT' TO S-TXT.
APPEND S.
LOOP AT STA.
MOVE STA TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE FUN LINES I.
IF I > 0.
MOVE '????FUNC' TO S-TXT.
APPEND S.
LOOP AT FUN.
MOVE FUN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE MEN LINES I.
IF I > 0.
MOVE '????MEN1' TO S-TXT.
APPEND S.
LOOP AT MEN.
MOVE MEN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE MTX LINES I.
IF I > 0.
MOVE '????MTX1' TO S-TXT.
APPEND S.
LOOP AT MTX.
MOVE MTX TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE ACT LINES I.
IF I > 0.
MOVE '????ACTN' TO S-TXT.
APPEND S.
LOOP AT ACT.
MOVE ACT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE BUT LINES I.
IF I > 0.
MOVE '????BUTN' TO S-TXT.
APPEND S.
LOOP AT BUT.
MOVE BUT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE PFK LINES I.
IF I > 0.
MOVE '????PFKY' TO S-TXT.
APPEND S.
LOOP AT PFK.
MOVE PFK TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE SET LINES I.
IF I > 0.
MOVE '????SETS' TO S-TXT.
APPEND S.
LOOP AT SET.
MOVE SET TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
IF LAST NE SPACE.
MOVE '????LIST' TO S-TXT.
APPEND S.
MOVE LAST TO S-TXT.
APPEND S.
ENDIF.
DESCRIBE TABLE INC LINES I.
IF I > 0.
MOVE '????INCL' TO S-TXT.
APPEND S.
LOOP AT INC.
MOVE INC TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE STX LINES I.
IF I > 0.
MOVE '????STXT' TO S-TXT.
APPEND S.
LOOP AT STX.
MOVE STX TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE DOC LINES I.
IF I > 0.
MOVE '????DOCN' TO S-TXT.
APPEND S.
LOOP AT DOC.
MOVE DOC TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE TIT LINES I.
IF I > 0.
MOVE '????TITL' TO S-TXT.
APPEND S.
LOOP AT TIT.
MOVE TIT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
Next 5 tables are rel 3.0 specific (ATT, FDN, MDN, SYM, FIN)
DESCRIBE TABLE ATT LINES I.
IF I > 0.
MOVE '????VATT' TO S-TXT.
APPEND S.
LOOP AT ATT.
MOVE ATT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE FDN LINES I.
IF I > 0.
MOVE '????VFDN' TO S-TXT.
APPEND S.
LOOP AT FDN.
MOVE FDN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE MDN LINES I.
IF I > 0.
MOVE '????VMDN' TO S-TXT.
APPEND S.
LOOP AT MDN.
MOVE MDN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE SYM LINES I.
IF I > 0.
MOVE '????VSYM' TO S-TXT.
APPEND S.
LOOP AT SYM.
MOVE SYM TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE FIN LINES I.
IF I > 0.
MOVE '????VFIN' TO S-TXT.
APPEND S.
LOOP AT FIN.
MOVE FIN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
ENDFORM.
/ Upload Objects. */
FORM UPLOAD_OBJECTS.
PERFORM UPLOAD_EEE. "ABAP,texts,attr dynpro logic
DESCRIBE TABLE E1 LINES I.
IF I > 0. "Do dynpro components exist
PERFORM UPLOAD_HHH. "dynpro header
PERFORM UPLOAD_FFF. "dynpro fields.
PERFORM RECONSTRUCT_DYNPROS. "load + gen dynpros
ENDIF.
ENDFORM.
/ Build table containing dynpro names and numbers */
FORM BUILD_T.
SELECT * FROM D020S WHERE PROG EQ R-NAME.
T-NUMBER = D020S-DNUM.
T-NAME = D020S-PROG.
APPEND T.
ENDSELECT.
ENDFORM.
/ Split dynpros into constituent parts. */
FORM UNLOAD_DYNPROS.
MOVE 'Y' TO FIRST-TIME.
LOOP AT T.
REFRESH: F, E.
CLEAR: H, F, E.
PERFORM BUILD_HHH. "Dynpro Header
PERFORM BUILD_FFF. "Dynpro Fields
PERFORM BUILD_EEE_DYNP. "Dynpro Logic
ENDLOOP.
ENDFORM.
/ Header H length 284. */
FORM BUILD_HHH.
MOVE T-NAME TO DYNNAME(40). "rel 4.
MOVE T-NUMBER TO DYNNAME+40(4). "rel 4.
IMPORT DYNPRO H F E M ID DYNNAME.
MOVE T-NAME TO H1-NAME.
MOVE T-NUMBER TO H1-NUMBER.
MOVE-CORRESPONDING H TO H1.
APPEND H1.
ENDFORM.
/ Fields D021S Len 87. */
FORM BUILD_FFF.
MOVE T-NAME TO F1-NAME.
MOVE T-NUMBER TO F1-NUMBER.
LOOP AT F.
MOVE-CORRESPONDING F TO F1.
APPEND F1.
DELETE F.
ENDLOOP.
ENDFORM.
/ Dynpro Logic D022S E */
FORM BUILD_EEE_DYNP.
MOVE T-NAME TO E1-NAME.
MOVE T-NUMBER TO E1-NUMBER.
LOOP AT E.
MOVE-CORRESPONDING E TO E1.
APPEND E1.
DELETE E.
ENDLOOP.
ENDFORM.
/ Unload Constituent parts of dynpro. */
FORM UNLOAD_DYNPRO_COMPONENTS.
MOVE '????LOGC' TO S-TXT.
APPEND S.
LOOP AT E1.
MOVE E1 TO S-TXT.
APPEND S.
DELETE E1.
ENDLOOP.
FREE E1.
LOOP AT T.
MOVE 'N' TO FOUND.
SELECT SINGLE * FROM D020T "use logged on language
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ SY-LANGU.
IF SY-SUBRC NE 0. "try original language.
SELECT SINGLE * FROM D020T
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ R-LANGUAGE.
ENDIF.
IF SY-SUBRC EQ 0.
IF FOUND = 'N'.
MOVE '????DTIT' TO S-TXT.
APPEND S.
MOVE 'Y' TO FOUND.
ENDIF.
MOVE T-NAME TO S-TXT.
WRITE T-NUMBER TO S-TXT+8(4).
WRITE D020T-DTXT TO S-TXT+12(60).
APPEND S.
ENDIF.
MOVE 'N' TO FOUND.
SELECT * FROM D021T
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ SY-LANGU. "logged on language
IF FOUND = 'N'.
MOVE '????DTXT' TO S-TXT.
APPEND S.
MOVE 'Y' TO FOUND.
ENDIF.
MOVE-CORRESPONDING D021T TO DTXT.
MOVE DTXT TO S-TXT.
APPEND S.
ENDSELECT.
CASE SY-SUBRC.
WHEN 0.
WHEN OTHERS. "try original language
SELECT * FROM D021T
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ R-LANGUAGE.
IF FOUND = 'N'.
MOVE '????DTXT' TO S-TXT.
APPEND S.
MOVE 'Y' TO FOUND.
ENDIF.
MOVE-CORRESPONDING D021T TO DTXT.
MOVE DTXT TO S-TXT.
APPEND S.
ENDSELECT.
ENDCASE.
ENDLOOP.
ENDFORM.
/ Build the original dynpro component tables. */
/ Table H1 contains 1 entry for each dynpro. H1 contains */
/ the header for the dynpro prefixed by the program name */
/ and dynpro number. */
/ By looping round this table we can re-build the F */
/ (Fields) and E (Logic) components. By stripping off the */
/ program name and dynpro number the original tables are */
/ re-created. (Tables F1 and E1 also have a prefix of */
/ Program name and dynpro nr). */
/ After the original set of tables has been re-created we */
/ use R3 - SYSTEM-CALL (rel 2.2) to generate the screen */
/ and then get the next entry in table H1 to build the */
/ next screen. For releases 3.0 and higher use generate */
/ dynpro. */
FORM RECONSTRUCT_DYNPROS.
LOOP AT H1.
CASE MAIN.
WHEN 'Y'.
if h1-name ne repid.
IF H1-NAME NE R1-NAME.
MOVE H1-NAME TO OLDNAME.
ENDIF.
ENDCASE.
PERFORM RECONSTRUCT_F.
PERFORM RECONSTRUCT_E.
MOVE-CORRESPONDING H1 TO H.
IF MAIN = 'Y'.
move repid to h-prog.
MOVE R1-NAME TO H-PROG.
move repid to dynname.
MOVE R1-NAME TO DYNNAME.
ELSE.
MOVE H1-NAME TO H-PROG.
MOVE H1-NAME TO DYNNAME.
ENDIF.
MOVE H1-NUMBER TO H-DNUM.
WRITE H1-NUMBER TO DYNNAME+40(4).
EXPORT DYNPRO H F E M ID DYNNAME.
SYSTEM-CALL GENERATE-SCREEN DYNNAME. "Up to rel 2.2
GENERATE DYNPRO H F E M ID DYNNAME "R 3.0, 4.0, 4.5
MESSAGE DYNPRO_MESSAGE
LINE DYNPRO_LINE
WORD DYNPRO_WORD.
REFRESH: M, F, E.
CLEAR: M, H, F, E.
ENDLOOP.
ENDFORM.
/ Re-build Fields table */
FORM RECONSTRUCT_F.
LOOP AT F1 WHERE NAME EQ H1-NAME AND
NUMBER EQ H1-NUMBER.
MOVE-CORRESPONDING F1 TO F.
APPEND F.
ENDLOOP.
ENDFORM.
/ Re-build Logic table */
FORM RECONSTRUCT_E.
LOOP AT E1 WHERE NAME EQ H1-NAME AND
NUMBER EQ H1-NUMBER.
MOVE-CORRESPONDING E1 TO E.
APPEND E.
ENDLOOP.
ENDFORM.
/ scan for included files (Upload) */
FORM SCAN4-INCLUDES.
IF FUNC = 'D'. "Downloads - whole table needs to be scanned
LOOP AT S.
PERFORM SEARCH-FUNC.
ENDLOOP.
ENDIF.
IF FUNC = 'U'. "On upload scan line by line as we are re-building abap
PERFORM SEARCH-FUNC.
ENDIF.
ENDFORM.
/ scan for text INCLUDE xxxxxxxx */
/ reject INCLUDE STRUCTURE as structure not a valid */
/ program name */
FORM SEARCH-FUNC.
CONDENSE S-TXT.
SEARCH S-TXT FOR '.INCLUDE .'.
CASE SY-SUBRC.
WHEN 0.
IF S-TXT+8(9) EQ 'STRUCTURE'
OR S-TXT+8(9) EQ 'structure'
OR S-TXT+8(6) EQ '<ICON>' "rel 3.0c 3.0d
OR S-TXT+8(6) EQ '<icon>'
OR S-TXT+8(6) EQ '<type>'
OR S-TXT+8(6) EQ '<TYPE>'
OR S-TXT+8(9) EQ '<methods>'
OR S-TXT+8(9) EQ '<METHODS>'.
EXIT.
ENDIF.
IF SY-FDPOS EQ 0. "INCLUDE must be in pos 1 (by reason of condense)
PERFORM VALIDATE_INCLUDE.
ELSE.
EXIT.
ENDIF.
ENDCASE.
ENDFORM.
/ Validate INCLUDES . */
FORM VALIDATE_INCLUDE.
SEARCH S-TXT FOR '...' STARTING AT 9 ENDING AT 39.
CASE SY-SUBRC.
WHEN 0.
WHEN OTHERS.
SEARCH S-TXT FOR '. .' STARTING AT 9 ENDING AT 38.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ENDCASE.
IX = SY-FDPOS.
ASSIGN S-TXT+8(IX) TO <F>.
Now check for Include Mask for example if include mask was set to
Z* then only include programs whose first letter starts with a Z.
1) get length of the INCLUDE program name. Must be less than or
equal 40.
2) Compare it with the Include mask.
3) If Ok add include program name to include table
clear i_include.
move <f> to i_include-name.
CLEAR I_INCL.
SEARCH IMASK FOR '.*.'.
IF SY-SUBRC = 0.
CONDENSE IMASK.
ENDIF.
IF ( <F> CP IMASK OR IMASK = ' ' ).
READ TABLE I_INCL WITH KEY = <F>.
IF SY-SUBRC NE 0.
MOVE <F> TO I_INCL-NAME.
move 1 to i_include-count.
collect i_include.
APPEND I_INCL.
ENDIF.
ENDIF.
ENDFORM.
/ Download table S. */
FORM DOWNLOAD_DATA.
CLEAR TXLINE.
WRITE 'Downloading ' TO TXLINE.
WRITE R1-NAME TO TXLINE+12.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TXLINE
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FN3
FILETYPE = 'ASC'
TABLES
DATA_TAB = S.
ENDFORM.
/ Download Binary files H1 */
FORM DOWNLOAD_BIN_H1.
DESCRIBE FIELD H1 LENGTH J.
DESCRIBE TABLE H1 LINES I.
NR_OF_BYTES = I * J.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FN1
FILETYPE = 'BIN'
BIN_FILESIZE = NR_OF_BYTES
IMPORTING
FILELENGTH = FILESIZE
TABLES
DATA_TAB = H1.
ENDFORM.
/ Download Binary files F1 */
FORM DOWNLOAD_BIN_F1.
DESCRIBE FIELD F1 LENGTH J.
DESCRIBE TABLE F1 LINES I.
NR_OF_BYTES = I * J.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FN2
FILETYPE = 'BIN'
BIN_FILESIZE = NR_OF_BYTES
IMPORTING
FILELENGTH = FILESIZE
TABLES
DATA_TAB = F1.
ENDFORM.
/ Upload data from file .EEE */
FORM UPLOAD_EEE.
CLEAR TXLINE.
WRITE 'Uploading ' TO TXLINE.
WRITE R1-NAME TO TXLINE+10.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TXLINE
EXCEPTIONS
OTHERS = 1.
MOVE 'Y' TO FIRST-TIME.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN3
FILETYPE = 'ASC'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = S1.
LOOP AT S1.
IF S1-TXT(4) = '????'.
MOVE S1-TXT(8) TO NEW-FUNC.
IF FIRST-TIME = 'Y'.
MOVE S1-TXT(8) TO OLD-FUNC.
MOVE 'N' TO FIRST-TIME.
ELSE.
PERFORM STORE_COMPONENT.
MOVE NEW-FUNC TO OLD-FUNC.
ENDIF.
ENDIF.
IF S1-TXT(4) NE '????'.
PERFORM REBUILD-COMPONENT.
ENDIF.
ENDLOOP.
PERFORM STORE_COMPONENT. "last component still to be processed
PERFORM REBUILD-CUA. "re-build CUA, statuses, pfk etc
ENDFORM.
/ Upload Dynpro headers (HHH) and fields (FFF) */
/ titles and dynpro logic is contained in file .EEE */
/ and has already been processed. */
FORM UPLOAD_HHH.
CASE REL3.
WHEN 'X'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN1
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = H2.
LOOP AT H2.
MOVE H2-CNAME TO H1-NAME.
MOVE H2-CNUM TO H1-NUMBER.
MOVE H2-NNAME TO H1-PROG.
MOVE H2-NNUM TO H1-DNUM.
MOVE H2-CTIM TO H1-TGEN.
WRITE '19' TO H1-DGEN(2).
WRITE H2-CDAT TO H1-DGEN+2(6).
WRITE H2-FILL TO H1+88(39).
APPEND H1.
ENDLOOP.
WHEN OTHERS.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN1
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = H1.
ENDCASE.
LOOP AT H1.
MOVE H1-NAME TO T-NAME.
MOVE H1-NUMBER TO T-NUMBER.
APPEND T.
ENDLOOP.
ENDFORM.
/ Upload Binary file F1 - Dynpro fields */
FORM UPLOAD_FFF.
CASE REL3.
WHEN 'X'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN2
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = F2.
LOOP AT F2.
OLD_F1 = F2.
APPEND OLD_F1.
ENDLOOP.
LOOP AT OLD_F1.
MOVE-CORRESPONDING OLD_F1 TO F1.
APPEND F1.
ENDLOOP.
WHEN OTHERS.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN2
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = F1.
ENDCASE.
ENDFORM.
/ Re-construct data from file .EEE */
FORM REBUILD-COMPONENT.
CASE OLD-FUNC.
WHEN '????LOGC'. "Dynpro LOGIC.
CASE REL3.
WHEN 'X'.
SHIFT S1-TXT+8 RIGHT BY 32 PLACES.
ENDCASE.
MOVE S1-TXT TO E1.
APPEND E1.
/ Load ABAP Source code, CUA, pfkeys etc to int tables */
WHEN '????SRCE'.
MOVE S1-TXT TO S-TXT.
APPEND S.
CASE INCLUDES. "Included file wanted
WHEN 'Y'.
PERFORM SCAN4-INCLUDES.
ENDCASE.
if restoring / uploading rel 3.1 or lower different cua tables
are used. At generate CUA time these will be converted by the
system to rel 4.0
WHEN '????STAT'.
CASE REL3.
WHEN 'X'.
MOVE S1-TXT TO OLD_STA.
APPEND OLD_STA.
WHEN SPACE.
MOVE S1-TXT TO STA.
APPEND STA.
ENDCASE.
MOVE 'Y' TO CUA-FLAG.
WHEN '????FUNC'.
CASE REL3.
WHEN 'X'.
MOVE S1-TXT TO OLD_FUN.
APPEND OLD_FUN.
WHEN SPACE.
MOVE S1-TXT TO FUN.
APPEND FUN.
ENDCASE.
MOVE 'Y' TO CUA-FLAG.
WHEN '????MEN1'.
CASE REL3.
WHEN 'X'.
MOVE S1-TXT TO OLD_MEN.
APPEND OLD_MEN.
WHEN SPACE.
MOVE S1-TXT TO MEN.
APPEND -
Sale order before the regeneration of ABAP report: RSM13000
Hi there,
I am just wondering about something.
After we installed support packages, users could not get any sales order without to get any error message and I we could only see an error message via SM21 which says:
Run-time error "LOAD_TYPEPOOL_VERSION_MISMATCH" occurred.
So after we regenerated the ABAP report: RSM13000 after that everythings seems to be ok.
Now the question is: When we try to find the order numbers which the users created before the regeneration we find nothing.
What about this numbers? Did they have not been created at all or what hapened? They customer is asking now.
Thanks in advance
HanseatikI still do not know. We created them again
-
Serious Performance Problems in ABAP Reports
Hi All,
We are developing ABAP reports for SAP IS-U/CCS Modules and facing Performance issues.Whole scenario is given below.Please suggest some solution.
1. Total No. Of Business Partners = 1500000
2. Reports Selection Criteria are of two types:
a) GSBER(Business Area) - Selection for atleast 200000 Business Partners
b) Cokey(Division) - Selection for around 1000 to 50000 Business Partners
3. For implementing our reports logic we have to access several tables all of which are very large.They are :
Table Name No. of records (Appx)
DBERCHV 20000000
DBERCHZ1 20000000
DBERDLB 20000000
DFKKKO 20000000
DFKKOP 20000000
EANLH 4000000
ERCH 10000000
ERCHC 10000000
ETTIFN 30000000
EVER 1500000
FKKVKP 1500000
TECOKT 500
TGSBT 12
4. Due to large no. of records we are facing problems at two levels:
a) OpenSQL Statement is taking too much time for data selection
b) Since large no. of records are selected Corresponding loops and data processing also takes much time
5. We have tried almost all ABAP Performance optimization techniques such as using Index, SQL optimization techniques,Read Table Optimization, Loop Statement Optimization etc. but there is not much improvement.
6. For example one of our Reports "R15" takes around 1500 seconds for 1000 Business Partners.
Its Code is attached below:
<b>a) ZISU_SCHL_LTR15_BAPI - Program which schedules actual R15 report in background</b>
*& Report ZISU_SCHL_LTR15_BAPI *
*& Developed By : Piyusha Kirwai *
*& Date : 02/12/2005 *
*& Purpose : To Schedule the LT R 15 prog in background and store
*& the File for Manual R-15 into server.
REPORT ZISU_SCHL_LTR15_BAPI NO STANDARD PAGE HEADING.
TABLES ZEVERFKKVKP.
DATA: DYFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
DATA: IT_TAB TYPE FILETABLE,
GD_SUBRC TYPE I.
DATA: LV_GSBER TYPE TGSBT-GSBER.
RANGES R_COKEY FOR ZEVERFKKVKP-COKEY.
DATA: BEGIN OF GT_TECOKT OCCURS 100,
COKEY TYPE TECOKT-COKEY,
LTEXT TYPE TECOKT-LTEXT,
END OF GT_TECOKT,
BEGIN OF GT_TE422 OCCURS 100,
TERMSCHL TYPE TE422-TERMSCHL,
TERMTEXT TYPE TE422-TERMTEXT,
END OF GT_TE422.
DATA: BEGIN OF GWA_MANUAL_DATA,
COL_1(5) TYPE C,
COL_2(10) TYPE C,
COL_3(40) TYPE C,
COL_4(40) TYPE C,
COL_5(10) TYPE C,
COL_6(19) TYPE C,
COL_7(19) TYPE C,
COL_8(19) TYPE C,
COL_9(19) TYPE C,
COL_10(19) TYPE C,
COL_11(19) TYPE C,
COL_12(10) TYPE C,
COL_13(19) TYPE C,
COL_14(19) TYPE C,
COL_15(19) TYPE C,
COL_16(19) TYPE C,
COL_17(19) TYPE C,
COL_18(19) TYPE C,
END OF GWA_MANUAL_DATA,
GT_MANUAL_DATA LIKE GWA_MANUAL_DATA OCCURS 0,
GT_INTERN_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*&-----FOR UPLOADING FILE TO SERVER------------------------------------*
DATA: LV_SERVER_FILE_PREFIX(60) TYPE C.
DATA: LV_SERVER_DATAFILE_NAME(60) TYPE C.
DATA: LV_SERVER_ERRFILE_NAME(60) TYPE C.
DATA: ENDT LIKE SY-UZEIT,
ENDD LIKE SY-DATUM,
JOBCOUNT TYPE TBTCJOB-JOBCOUNT.
SELECTION-SCREEN BEGIN OF BLOCK 001 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: SO_GSBER FOR ZEVERFKKVKP-GSBER OBLIGATORY,
SO_COKEY FOR ZEVERFKKVKP-COKEY OBLIGATORY,
SO_MRU FOR ZEVERFKKVKP-ABLEINH.
PARAMETERS: P_BMNTH(7) TYPE C OBLIGATORY.
SELECT-OPTIONS: SO_GPART FOR ZEVERFKKVKP-GPART.
SELECTION-SCREEN END OF BLOCK 001.
SELECTION-SCREEN BEGIN OF BLOCK 002 WITH FRAME TITLE TEXT-003.
PARAMETERS: P_COMPUT RADIOBUTTON GROUP R15,
P_INCLUD RADIOBUTTON GROUP R15,
P_FILE TYPE RLGRAP-FILENAME MODIF ID ACT.
SELECTION-SCREEN END OF BLOCK 002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(83) TEXT-004.
SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
* SELECTION-SCREEN COMMENT 8(40) TEXT-005.
*SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK 003 WITH FRAME TITLE TEXT-002.
PARAMETERS P_SCHL TYPE C AS CHECKBOX.
PARAMETERS : P_IMMED RADIOBUTTON GROUP SCH ,
P_DT_TM RADIOBUTTON GROUP SCH,
P_DATE TYPE SY-DATUM MODIF ID SHL,
P_TIME TYPE SY-UZEIT MODIF ID SHL.
SELECTION-SCREEN END OF BLOCK 003.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON SO_GSBER.
IF NOT SO_GSBER-LOW IS INITIAL.
SELECT SINGLE GSBER FROM TGSBT INTO LV_GSBER
WHERE GSBER = SO_GSBER-LOW.
IF SY-SUBRC <> 0.
MESSAGE E007(ZISU).
ENDIF.
ENDIF.
IF NOT SO_GSBER-HIGH IS INITIAL .
SELECT SINGLE GSBER FROM TGSBT INTO LV_GSBER
WHERE GSBER = SO_GSBER-HIGH.
IF SY-SUBRC <> 0.
MESSAGE E007(ZISU).
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON P_BMNTH.
**check the validity of Billing month format and for valid billing month
IF P_BMNTH CO '0123456789/'.
IF P_BMNTH CP '++++/++'.
IF P_BMNTH+5(2) > 12.
MESSAGE E002(ZISU) WITH 'from'.
ENDIF.
** current year is less than year entered
IF SY-DATUM(4) < P_BMNTH(4).
MESSAGE E003(ZISU) WITH 'from'.
ELSEIF SY-DATUM(4) = P_BMNTH(4).
** month in future
IF SY-DATUM+4(2) < P_BMNTH+5(2).
MESSAGE E004(ZISU) WITH 'from'.
ENDIF.
ENDIF.
ELSE.
MESSAGE E001(ZISU) WITH 'from'.
ENDIF.
ELSE.
** entry have some invalid char
MESSAGE E010(ZISU).
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-LOW.
**for geting the CO account assigment key of the entered Business area
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-HIGH.
**for geting the CO account assigment key of the entered Business area
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_MRU-LOW.
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM MRU_DATA_GET CHANGING SO_MRU-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_MRU-HIGH.
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM MRU_DATA_GET CHANGING SO_MRU-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
REFRESH: IT_TAB.
**Opens File Open Dialog Box for selecting input file.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Select File'
DEFAULT_FILENAME = '*.xls'
MULTISELECTION = ' '
CHANGING
FILE_TABLE = IT_TAB
RC = GD_SUBRC.
LOOP AT IT_TAB INTO P_FILE.
* so_fpath-sign = 'I'.
* so_fpath-option = 'EQ'.
* append so_fpath.
ENDLOOP.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'ACT'.
IF P_INCLUD = ' '.
SCREEN-INPUT = '0'.
ELSE.
SCREEN-INPUT = '1'.
ENDIF.
ENDIF.
IF SCREEN-GROUP1 = 'SHL'.
IF P_DT_TM = 'X'.
SCREEN-INPUT = '1'.
ELSE.
SCREEN-INPUT = '0'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
INITIALIZATION.
P_DATE = SY-DATUM.
P_TIME = SY-UZEIT + 180.
START-OF-SELECTION.
IF P_INCLUD = 'X' AND P_FILE IS INITIAL.
MESSAGE 'Enter the Manual R-15 File' TYPE 'E'.
ENDIF.
* IF P_INCLUD = 'X'.
* PERFORM UPLOAD_EXCEL_FILE.
* CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
* CONCATENATE LV_SERVER_FILE_PREFIX '-' 'LT.TMP' INTO
* LV_SERVER_DATAFILE_NAME.
* OPEN DATASET LV_SERVER_DATAFILE_NAME
* FOR OUTPUT
* IN TEXT MODE
* ENCODING DEFAULT.
* LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
* IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
* MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
* ENDIF.
* TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
* ENDLOOP.
* CLOSE DATASET LV_SERVER_DATAFILE_NAME.
* ENDIF. " P_INCLUD = 'X'.
IF P_SCHL = 'X'.
IF P_IMMED = 'X'.
CALL FUNCTION 'C14B_ADD_TIME'
EXPORTING
I_STARTTIME = SY-UZEIT
I_STARTDATE = SY-DATUM
I_ADDTIME = '000010'
IMPORTING
E_ENDTIME = ENDT
E_ENDDATE = ENDD.
ELSEIF P_DT_TM = 'X'.
ENDD = P_DATE.
ENDT = P_TIME.
ENDIF.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* DELANFREP = ' '
* JOBGROUP = ' '
JOBNAME = 'R15JOB'
* SDLSTRTDT = ENDD
* SDLSTRTTM = ENDT
* JOBCLASS =
IMPORTING
JOBCOUNT = JOBCOUNT
* CHANGING
* RET =
* EXCEPTIONS
* CANT_CREATE_JOB = 1
* INVALID_JOB_DATA = 2
* JOBNAME_MISSING = 3
* OTHERS = 4
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF P_INCLUD = 'X'.
PERFORM UPLOAD_EXCEL_FILE.
CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
CONCATENATE LV_SERVER_FILE_PREFIX '-' JOBCOUNT 'LT.TMP' INTO
LV_SERVER_DATAFILE_NAME.
CONDENSE LV_SERVER_DATAFILE_NAME.
OPEN DATASET LV_SERVER_DATAFILE_NAME
FOR OUTPUT
IN TEXT MODE
ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
ENDIF.
TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
ENDLOOP.
CLOSE DATASET LV_SERVER_DATAFILE_NAME.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
ENDIF. " P_INCLUD = 'X'.
SUBMIT ZISU_LTR15_TUNE
WITH SO_GSBER IN SO_GSBER
WITH SO_COKEY IN SO_COKEY
WITH SO_MRU IN SO_MRU
WITH SO_GPART IN SO_GPART
WITH P_BMNTH = P_BMNTH
WITH P_COMPUT = P_COMPUT
WITH P_INCLUD = P_INCLUD
WITH P_FILE = LV_SERVER_DATAFILE_NAME
USER SY-UNAME VIA JOB 'R15JOB' NUMBER JOBCOUNT AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
* AT_OPMODE = ' '
* AT_OPMODE_PERIODIC = ' '
* CALENDAR_ID = ' '
* EVENT_ID = ' '
* EVENT_PARAM = ' '
* EVENT_PERIODIC = ' '
JOBCOUNT = JOBCOUNT
JOBNAME = 'R15JOB'
* LASTSTRTDT = NO_DATE
* LASTSTRTTM = NO_TIME
* PRDDAYS = 0
* PRDHOURS = 0
* PRDMINS = 0
* PRDMONTHS = 0
* PRDWEEKS = 0
* PREDJOB_CHECKSTAT = ' '
* PRED_JOBCOUNT = ' '
* PRED_JOBNAME = ' '
SDLSTRTDT = ENDD
SDLSTRTTM = ENDT
* STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
STRTIMMED = P_IMMED
* TARGETSYSTEM = ' '
* START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
* START_ON_WORKDAY_NR = 0
* WORKDAY_COUNT_DIRECTION = 0
* RECIPIENT_OBJ =
* TARGETSERVER = ' '
* DONT_RELEASE = ' '
* TARGETGROUP = ' '
* DIRECT_START =
* IMPORTING
* JOB_WAS_RELEASED =
* CHANGING
* RET =
* EXCEPTIONS
* CANT_START_IMMEDIATE = 1
* INVALID_STARTDATE = 2
* JOBNAME_MISSING = 3
* JOB_CLOSE_FAILED = 4
* JOB_NOSTEPS = 5
* JOB_NOTEX = 6
* LOCK_FAILED = 7
* INVALID_TARGET = 8
* OTHERS = 9
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE. " IF NOT TO RUN IN BACKGROUND
IF P_INCLUD = 'X'.
PERFORM UPLOAD_EXCEL_FILE.
CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
CONCATENATE LV_SERVER_FILE_PREFIX '-' 'LT.TMP' INTO
LV_SERVER_DATAFILE_NAME.
CONDENSE LV_SERVER_DATAFILE_NAME.
OPEN DATASET LV_SERVER_DATAFILE_NAME
FOR OUTPUT
IN TEXT MODE
ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
ENDIF.
TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
ENDLOOP.
CLOSE DATASET LV_SERVER_DATAFILE_NAME.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
ENDIF. " P_INCLUD = 'X'.
IF NOT SY-BATCH IS INITIAL.
SUBMIT ZISU_LTR15_TUNE
WITH SO_GSBER IN SO_GSBER
WITH SO_COKEY IN SO_COKEY
WITH SO_MRU IN SO_MRU
WITH SO_GPART IN SO_GPART
WITH P_BMNTH = P_BMNTH
WITH P_COMPUT = P_COMPUT
WITH P_INCLUD = P_INCLUD
WITH P_FILE = LV_SERVER_DATAFILE_NAME
TO SAP-SPOOL WITHOUT SPOOL DYNPRO.
ELSE.
SUBMIT ZISU_LTR15_TUNE
WITH SO_GSBER IN SO_GSBER
WITH SO_COKEY IN SO_COKEY
WITH SO_MRU IN SO_MRU
WITH SO_GPART IN SO_GPART
WITH P_BMNTH = P_BMNTH
WITH P_COMPUT = P_COMPUT
WITH P_INCLUD = P_INCLUD
WITH P_FILE = LV_SERVER_DATAFILE_NAME.
ENDIF.
ENDIF.
*& Form divison_data_get
* text
* <--P_SO_COKEY_LOW text
FORM DIVISON_DATA_GET CHANGING P_SO_COKEY_LOW.
**to get the search help for division
DATA : LV_LINES TYPE SY-TFILL,
LT_RETURN_TAB LIKE DDSHRETVAL OCCURS 0, " with header line.
LWA_RETURN_TAB LIKE DDSHRETVAL.
DATA: LV_COKEY TYPE ZEVERFKKVKP-COKEY.
**according to the Business area entered]
* break csebdev1.
REFRESH R_COKEY[].
DESCRIBE TABLE SO_GSBER LINES LV_LINES.
** when user has neither pressed the enter key nor selected the values
**using search help
IF LV_LINES = 0.
* loop at so_gsber.
CLEAR R_COKEY.
* if so_gsber-high is initial.
* break csebdev1.
DYFIELDS-FIELDNAME = 'SO_GSBER-LOW'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
* r_cokey-sign = 'I'.
* r_cokey-option = 'CP'.
*r_cokey-low = so_gsber-low+0(2).
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '*' INTO R_COKEY-LOW.
* elseif not so_gsber-high is initial.
DYFIELDS-FIELDNAME = 'SO_GSBER-HIGH'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
IF NOT DYFIELDS-FIELDVALUE IS INITIAL.
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '99999999' INTO R_COKEY-HIGH.
ENDIF.
* endif.
IF NOT R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'BT'.
ELSEIF R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'CP'.
ENDIF.
APPEND R_COKEY.
ENDIF.
* endloop.
* APPEND DYFIELDS.
IF LV_LINES > 0.
* break-point.
IF NOT SO_GSBER[] IS INITIAL.
LOOP AT SO_GSBER.
* r_cokey-sign = 'I'.
* r_cokey-option = 'CP'.
*r_cokey-low = so_gsber-low+0(2).
CONCATENATE SO_GSBER-LOW+0(2) '*' INTO R_COKEY-LOW.
IF NOT SO_GSBER-HIGH IS INITIAL.
CONCATENATE SO_GSBER-HIGH+0(2) '99999999' INTO R_COKEY-HIGH.
ENDIF.
IF NOT R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'BT'.
ELSEIF R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'CP'.
ENDIF.
APPEND R_COKEY TO R_COKEY.
ENDLOOP.
ENDIF.
ENDIF.
IF NOT R_COKEY[] IS INITIAL.
* break csebdev1.
REFRESH GT_TECOKT[].
SELECT COKEY LTEXT
FROM TECOKT
INTO TABLE GT_TECOKT
WHERE COKEY IN R_COKEY AND SPRAS = 'EN'.
* %_HINTS ORACLE '("TECOKT","TECOKT~1")'.
ENDIF.
**now call the search help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'COKEY'
* PVALKEY = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
WINDOW_TITLE = 'Division'
VALUE = DYFIELDS-FIELDVALUE
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = GT_TECOKT
* FIELD_TAB =
RETURN_TAB = LT_RETURN_TAB
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE LT_RETURN_TAB INTO LWA_RETURN_TAB INDEX 1.
LV_COKEY = LWA_RETURN_TAB-FIELDVAL.
*break csebdev1.
ENDFORM. " divison_data_get
*& Form upload_excel_file
* text
* --> p1 text
* <-- p2 text
FORM UPLOAD_EXCEL_FILE .
DATA: LV_INDEX TYPE I.
FIELD-SYMBOLS <VAL> TYPE ANY.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 8
I_END_COL = 18
I_END_ROW = 94
TABLES
INTERN = GT_INTERN_DATA
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF NOT GT_INTERN_DATA[] IS INITIAL.
SORT GT_INTERN_DATA BY ROW COL.
LOOP AT GT_INTERN_DATA.
MOVE GT_INTERN_DATA-COL TO LV_INDEX.
ASSIGN COMPONENT LV_INDEX OF STRUCTURE GWA_MANUAL_DATA TO <VAL>.
MOVE GT_INTERN_DATA-VALUE TO <VAL>.
AT END OF ROW.
APPEND GWA_MANUAL_DATA TO GT_MANUAL_DATA.
CLEAR GWA_MANUAL_DATA.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. " upload_excel_file
*& Form MRU_DATA_GET
* text
* <--P_SO_MRU_LOW text
FORM MRU_DATA_GET CHANGING LV_MRU.
**to get the search help for Group
DATA : LV_LINES TYPE SY-TFILL,
LT_RETURN_TAB LIKE DDSHRETVAL OCCURS 0,
LWA_RETURN_TAB LIKE DDSHRETVAL.
* lv_mru_p(3) type c.
RANGES R_MRU FOR EANLH-ABLEINH.
**according to the Business area entered
** break csebdev1.
REFRESH R_MRU[].
DESCRIBE TABLE SO_GSBER LINES LV_LINES.
** when user has neither pressed the enter key nor selected the values
**using search help
IF LV_LINES = 0.
CLEAR R_MRU[].
DYFIELDS-FIELDNAME = 'SO_GSBER-LOW'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '*' INTO R_MRU-LOW.
DYFIELDS-FIELDNAME = 'SO_GSBER-HIGH'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
IF NOT DYFIELDS-FIELDVALUE IS INITIAL.
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '99999999' INTO R_MRU-HIGH.
ENDIF.
IF NOT R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'BT'.
ELSEIF R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'CP'.
ENDIF.
APPEND R_MRU.
ENDIF. " end lv_lines =0
IF LV_LINES > 0.
IF NOT SO_GSBER[] IS INITIAL.
LOOP AT SO_GSBER.
CONCATENATE SO_GSBER-LOW+0(2) '*' INTO R_MRU-LOW.
IF NOT SO_GSBER-HIGH IS INITIAL.
CONCATENATE SO_GSBER-HIGH+0(2) '99999999' INTO R_MRU-HIGH.
ENDIF.
IF R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'CP'.
ELSEIF NOT R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'BT'.
ENDIF.
APPEND R_MRU.
ENDLOOP.
ENDIF. " end so_GSBER[]
ENDIF. " end lv_lines > 0
IF NOT R_MRU[] IS INITIAL.
* break csebdev1.
REFRESH GT_TE422[].
SELECT TERMSCHL TERMTEXT FROM TE422 INTO CORRESPONDING FIELDS OF
TABLE GT_TE422 WHERE TERMSCHL IN R_MRU .
ENDIF.
**now call the search help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'TERMSCHL'
* PVALKEY = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
WINDOW_TITLE = 'Group'
VALUE = DYFIELDS-FIELDVALUE
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = GT_TE422
* FIELD_TAB =
RETURN_TAB = LT_RETURN_TAB
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE LT_RETURN_TAB INTO LWA_RETURN_TAB INDEX 1.
LV_MRU = LWA_RETURN_TAB-FIELDVAL.
ENDFORM. " MRU_DATA_GET
<b>b) ZISU_LTR15_TUNE - Actual R15 report</b>
*& Report ZISU_LTR15_TUNE *
REPORT ZISU_LTR15_TUNE NO STANDARD PAGE HEADING MESSAGE-ID ZISU
LINE-SIZE 250 LINE-COUNT 65.
**Tables
TABLES : EVER,
FKKVKP,
EANLH.
SELECTION-SCREEN BEGIN OF BLOCK SELECTION
WITH FRAME TITLE TEXT-001 . "no intervals.
SELECT-OPTIONS: SO_GSBER FOR EVER-GSBER OBLIGATORY,
SO_COKEY FOR EVER-COKEY,
SO_MRU FOR EANLH-ABLEINH.
PARAMETERS: P_BMNTH(7) TYPE C OBLIGATORY.
PARAMETERS: P_CONT TYPE EVER-VERTRAG.
SELECT-OPTIONS: SO_GPART FOR FKKVKP-GPART.
SELECTION-SCREEN END OF BLOCK SELECTION.
SELECTION-SCREEN BEGIN OF BLOCK PROCESS WITH FRAME.
PARAMETERS: P_COMPUT RADIOBUTTON GROUP R15.
PARAMETERS: P_INCLUD RADIOBUTTON GROUP R15,
P_FILE(60) TYPE C.
SELECTION-SCREEN END OF BLOCK PROCESS.
* Start of Type declaration
TYPES: BEGIN OF ST_TB024 ,
IND_SECTOR TYPE TB024-IND_SECTOR,
TEXTLONG TYPE TB024-TEXTLONG,
END OF ST_TB024,
BEGIN OF ST_TECOKT,
COKEY TYPE TECOKT-COKEY,
LTEXT TYPE TECOKT-LTEXT,
END OF ST_TECOKT,
BEGIN OF ST_TGSBT,
GSBER TYPE TGSBT-GSBER,
GTEXT TYPE TGSBT-GTEXT,
END OF ST_TGSBT,
BEGIN OF ST_TE422,
TERMSCHL TYPE TE422-TERMSCHL,
TERMTEXT TYPE TE422-TERMTEXT,
END OF ST_TE422.
* Start of data declaration
DATA: IT_TAB TYPE FILETABLE,
GD_SUBRC TYPE I.
DATA : GT_TB024 TYPE STANDARD TABLE OF ST_TB024 WITH HEADER LINE
INITIAL SIZE 0,
GT_TECOKT TYPE STANDARD TABLE OF ST_TECOKT
WITH HEADER LINE,
GT_TGSBT TYPE SORTED TABLE OF ST_TGSBT
WITH UNIQUE KEY GSBER WITH HEADER LINE,
GT_TE422 TYPE TABLE OF ST_TE422 WITH HEADER LINE INITIAL SIZE 0,
BEGIN OF GWA_EVER,
VKONT TYPE EVER-VKONTO,
ANLAGE TYPE EVER-ANLAGE,
ABRSPERR TYPE EVER-ABRSPERR,
END OF GWA_EVER,
GT_EVER LIKE TABLE OF GWA_EVER INITIAL SIZE 0,
BEGIN OF GWA_EANLH,
ANLAGE TYPE EANLH-ANLAGE,
BRANCHE TYPE EANLH-BRANCHE,
END OF GWA_EANLH,
GT_EANLH LIKE TABLE OF GWA_EANLH INITIAL SIZE 0,
BEGIN OF GWA_FKKVKP,
VKONT TYPE FKKVKP-VKONT,
KTOKL TYPE FKKVKP-KTOKL,
END OF GWA_FKKVKP,
GT_FKKVKP LIKE TABLE OF GWA_FKKVKP INITIAL SIZE 0,
BEGIN OF GWA_EVER_EANLH_FKKVKP,
VKONT TYPE FKKVKP-VKONT,
ANLAGE TYPE EVER-ANLAGE,
ABRSPERR TYPE EVER-ABRSPERR,
BRANCHE TYPE EANLH-BRANCHE,
KTOKL TYPE FKKVKP-KTOKL,
END OF GWA_EVER_EANLH_FKKVKP,
GT_EVER_EANLH_FKKVKP LIKE TABLE OF GWA_EVER_EANLH_FKKVKP
INITIAL SIZE 0,
GT_EVER_EANLH_FKKVKP_INACT LIKE STANDARD TABLE OF
GWA_EVER_EANLH_FKKVKP INITIAL SIZE 0,
BEGIN OF GWA_ERCH,
BELNR TYPE ERCH-BELNR,
VKONT TYPE ERCH-VKONT,
END OF GWA_ERCH,
GT_ERCH LIKE TABLE OF GWA_ERCH INITIAL SIZE 0,
BEGIN OF GWA_PRINTDOC,
OPBEL TYPE ERDK-OPBEL,
GPART TYPE ERDK-PARTNER,
VKONT TYPE ERDK-VKONT,
BUDAT TYPE ERDK-BUDAT,
FAEDN TYPE ERDK-FAEDN,
END OF GWA_PRINTDOC,
GT_PRINTDOC LIKE TABLE OF GWA_PRINTDOC INITIAL SIZE 0,
BEGIN OF GWA_DBERCHZ1,
BELNR TYPE DBERCHZ1-BELNR,
EIN01 TYPE DBERCHZ1-EIN01,
V_ABRMENGE TYPE DBERCHZ1-V_ABRMENGE,
END OF GWA_DBERCHZ1,
GT_DBERCHZ1 LIKE TABLE OF GWA_DBERCHZ1 INITIAL SIZE 0,
BEGIN OF GWA_ERCHC,
BELNR TYPE ERCHC-BELNR,
OPBEL TYPE ERCHC-OPBEL,
BUDAT TYPE ERCHC-BUDAT,
END OF GWA_ERCHC,
GT_ERCHC LIKE TABLE OF GWA_ERCHC INITIAL SIZE 0,
* arrears for inactive consumers.
BEGIN OF GWA_DFKKOP_INACTIVE_ARR,
OPBEL TYPE DFKKOP-OPBEL,
VKONT TYPE DFKKOP-VKONT,
BETRH TYPE DFKKOP-BETRH,
END OF GWA_DFKKOP_INACTIVE_ARR,
GT_DFKKOP_INACTIVE_ARR LIKE TABLE OF GWA_DFKKOP_INACTIVE_ARR
INITIAL SIZE 0,
BEGIN OF GWA_ETTIFN,
ANLAGE TYPE ETTIFN-ANLAGE,
OPERAND TYPE ETTIFN-OPERAND,
WERT1 TYPE ETTIFN-WERT1,
END OF GWA_ETTIFN,
GT_ETTIFN LIKE SORTED TABLE OF GWA_ETTIFN
WITH NON-UNIQUE KEY ANLAGE OPERAND INITIAL SIZE 0,
BEGIN OF GWA_DBERDLB,
PRINTDOC TYPE DBERDLB-PRINTDOC,
BILLDOC TYPE DBERDLB-BILLDOC,
BILLDOCLINE TYPE DBERDLB-BILLDOCLINE,
NETTOBTR TYPE DBERDLB-NETTOBTR,
END OF GWA_DBERDLB,
GT_DBERDLB LIKE TABLE OF GWA_DBERDLB INITIAL SIZE 0,
BEGIN OF GWA_DBERCHZ1_BILL,
BELNR TYPE DBERCHZ1-BELNR,
BELZEILE TYPE DBERCHZ1-BELZEILE,
TVORG TYPE DBERCHZ1-TVORG,
END OF GWA_DBERCHZ1_BILL,
GT_DBERCHZ1_BILL LIKE TABLE OF GWA_DBERCHZ1_BILL INITIAL SIZE 0,
BEGIN OF GWA_BILLDOC,
PRINTDOC TYPE ERDK-OPBEL,
BILLDOC TYPE DBERDLB-BILLDOC,
END OF GWA_BILLDOC,
GT_BILLDOC LIKE TABLE OF GWA_BILLDOC INITIAL SIZE 0,
BEGIN OF GWA_DBERCHV,
BELNR TYPE DBERCHV-BELNR,
OPERAND TYPE DBERCHV-OPERAND,
EZ_ABRMENGE TYPE DBERCHV-EZ_ABRMENGE,
ABLESGR TYPE DBERCHV-ABLESGR,
ABLESGRV TYPE DBERCHV-ABLESGRV,
END OF GWA_DBERCHV,
GT_DBERCHV LIKE TABLE OF GWA_DBERCHV INITIAL SIZE 0,
BEGIN OF GWA_DFKKOP_ARREAR,
OPBEL TYPE DFKKOP-OPBEL,
VKONT TYPE DFKKOP-VKONT,
HVORG TYPE DFKKOP-HVORG,
TVORG TYPE DFKKOP-TVORG,
BUDAT TYPE DFKKOP-BUDAT,
BETRH TYPE DFKKOP-BETRH,
AUGDT TYPE DFKKOP-AUGDT,
XBLNR TYPE DFKKOP-XBLNR,
END OF GWA_DFKKOP_ARREAR,
GT_DFKKOP_ARREAR LIKE TABLE OF GWA_DFKKOP_ARREAR INITIAL SIZE 0,
BEGIN OF GWA_MASTER_DATA,
SLNO(4) TYPE C,
IND_SECTOR TYPE TB024-IND_SECTOR,
TEXTLONG TYPE TB024-TEXTLONG,
AC_CODE TYPE TFK033D-FUN01,
END OF GWA_MASTER_DATA,
GT_MASTER_DATA LIKE TABLE OF GWA_MASTER_DATA INITIAL SIZE 0,
** internal table for final prepared data
BEGIN OF GWA_FINAL_DATA,
SLNO(4) TYPE C,
IND_SECTOR TYPE TB024-IND_SECTOR, " for testing
INDUSTRY TYPE TB024-TEXTLONG,
AC_CODE TYPE TFK033D-FUN01,
* *for urban partners
UPARTNER TYPE I , "(6) type n,
UBAD_METER TYPE I, "(4) type n,
UINACTIVE TYPE I,
ULOAD(8) TYPE P DECIMALS 2,
UUNITS(8) TYPE P DECIMALS 2,
UDEMANDS(8) TYPE P DECIMALS 2,
UARREARS(8) TYPE P DECIMALS 2, "FKKMAKO-Msalm,
UINACT_ARR(8) TYPE P DECIMALS 2,
BLANK(10) TYPE C,
* *for rural partners
RPARTNER TYPE I , "(6) type n,
RBAD_METER TYPE I , "(4) type n,
RINACTIVE TYPE I,
RLOAD(8) TYPE P DECIMALS 2,
RUNITS(8) TYPE P DECIMALS 2,
RDEMANDS(8) TYPE P DECIMALS 2,
RARREARS(8) TYPE P DECIMALS 2,
RINACT_ARR(8) TYPE P DECIMALS 2,
END OF GWA_FINAL_DATA,
GT_FINAL_DATA LIKE TABLE OF GWA_FINAL_DATA INITIAL SIZE 0,
BEGIN OF GWA_MANUAL_DATA,
COL_1(5) TYPE C,
COL_2(10) TYPE C,
COL_3(40) TYPE C,
COL_4(40) TYPE C,
COL_5(10) TYPE C,
COL_6(19) TYPE C,
COL_7(19) TYPE C,
COL_8(19) TYPE C,
COL_9(19) TYPE C,
COL_10(19) TYPE C,
COL_11(19) TYPE C,
COL_12(10) TYPE C,
COL_13(19) TYPE C,
COL_14(19) TYPE C,
COL_15(19) TYPE C,
COL_16(19) TYPE C,
COL_17(19) TYPE C,
COL_18(19) TYPE C,
END OF GWA_MANUAL_DATA,
GT_MANUAL_DATA LIKE TABLE OF GWA_MANUAL_DATA INITIAL SIZE 0.
** Variables for grand total of all heads.
DATA : GV_T_UPART TYPE I,
GV_T_RPART TYPE I,
GV_T_RINACTIVE TYPE I,
GV_T_UINACTIVE TYPE I,
GV_UDEF_MTR TYPE I,
GV_RDEF_MTR TYPE I,
GV_UCON_LOAD(16) TYPE P DECIMALS 2,
GV_RCON_LOAD(16) TYPE P DECIMALS 2,
GV_UUNITS(16) TYPE P DECIMALS 2,
GV_RUNITS(16) TYPE P DECIMALS 2,
GV_UDEMAND(16) TYPE P DECIMALS 2,
GV_RDEMAND(16) TYPE P DECIMALS 2,
GV_UARREAR(16) TYPE P DECIMALS 2,
GV_RARREAR(16) TYPE P DECIMALS 2,
GV_UINACT_ARR(16) TYPE P DECIMALS 2,
GV_RINACT_ARR(16) TYPE P DECIMALS 2,
GV_U_SD_DMD(16) TYPE P DECIMALS 2,
GV_R_SD_DMD(16) TYPE P DECIMALS 2,
GV_U_SD_ARR(16) TYPE P DECIMALS 2,
GV_R_SD_ARR(16) TYPE P DECIMALS 2,
GV_UR_PART TYPE I,
GV_UR_DEF_MTR TYPE I,
GV_UR_CON_LOAD(16) TYPE P DECIMALS 2,
GV_UR_UNITS(16) TYPE P DECIMALS 2,
GV_UR_DEMAND(16) TYPE P DECIMALS 2,
GV_UR_ARREARS(16) TYPE P DECIMALS 2,
GV_LOWDATE TYPE SY-DATUM,
GV_HIGHDATE TYPE SY-DATUM,
GV_YEAR LIKE DBERCHV-EZ_ABRMENGE,
GV_MONTH LIKE DBERCHZ1-V_ABRMENGE,
GV_MNTH_NAME TYPE T247-KTX.
DATA:
**total meter rent
GV_UTOTMETERRENT TYPE P LENGTH 16 DECIMALS 2,
GV_RTOTMETERRENT TYPE P LENGTH 16 DECIMALS 2,
**for total surcharge
GV_UTOTSURCHRG TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
GV_RTOTSURCHRG TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
**for total ED
GV_UTOTED TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
GV_RTOTED TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
**for total ED Cess
GV_UTOTEDCESS TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
GV_RTOTEDCESS TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
**for total other misc rev
GV_UTOTMISCREV TYPE P LENGTH 16 DECIMALS 2,
GV_RTOTMISCREV TYPE P LENGTH 16 DECIMALS 2,
**for total ED of Free agricultural pump
GV_RTOTEDAGRI TYPE P LENGTH 16 DECIMALS 2,
GV_UTOTEDAGRI TYPE P LENGTH 16 DECIMALS 2,
**for ED cess of Free agriculture pump
GV_RTOTCESSAGRI TYPE P LENGTH 16 DECIMALS 2,
GV_UTOTCESSAGRI TYPE P LENGTH 16 DECIMALS 2,
***data for selection screen data validation
GV_GSBER TYPE EVER-GSBER,
GV_COKEY TYPE EVER-COKEY,
DYFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
GT_INTERN_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
RANGES: R_COKEY FOR TECOKT-COKEY.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON SO_GSBER.
IF NOT SO_GSBER-LOW IS INITIAL.
SELECT SINGLE GSBER FROM TGSBT INTO GT_TGSBT-GSBER WHERE
GSBER = SO_GSBER-LOW.
IF SY-SUBRC <> 0.
MESSAGE E007.
ENDIF.
ENDIF.
IF NOT SO_GSBER-HIGH IS INITIAL .
SELECT SINGLE GSBER FROM TGSBT INTO GT_TGSBT-GSBER WHERE
GSBER = SO_GSBER-HIGH.
IF SY-SUBRC <> 0.
MESSAGE E007.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON P_BMNTH.
**check the validity of Billing month format and for valid billing month
IF P_BMNTH CO '0123456789/'.
IF P_BMNTH CP '++++/++'.
IF P_BMNTH+5(2) > 12.
MESSAGE E002 WITH 'from'.
ENDIF.
** current year is less than year entered
IF SY-DATUM(4) < P_BMNTH(4).
MESSAGE E003 WITH 'from'.
ELSEIF SY-DATUM(4) = P_BMNTH(4).
** month in future
IF SY-DATUM+4(2) < P_BMNTH+5(2).
MESSAGE E004 WITH 'from'.
ENDIF.
ENDIF.
ELSE.
MESSAGE E001 WITH 'from'.
ENDIF.
ELSE.
** entry have some invalid char
MESSAGE E010.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-LOW.
**for geting the CO account assigment key of the entered Business area
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-HIGH.
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-HIGH.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
* REFRESH: IT_TAB.
***Opens File Open Dialog Box for selecting input file.
* CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
* EXPORTING
* WINDOW_TITLE = 'Select File'
* DEFAULT_FILENAME = '*.xls'
* MULTISELECTION = ' '
* CHANGING
* FILE_TABLE = IT_TAB
* RC = GD_SUBRC.
* LOOP AT IT_TAB INTO P_FILE.
** so_fpath-sign = 'I'.
** so_fpath-option = 'EQ'.
** append so_fpath.
* ENDLOOP.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'ACT'.
IF P_INCLUD = ' '.
SCREEN-INPUT = '0'.
ELSE.
SCREEN-INPUT = '1'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
* End of Selection screen processing
TOP-OF-PAGE.
DATA : LV_TEXT(70) TYPE C.
FORMAT INTENSIFIED OFF.
WRITE:/50 'CHHATTISGARH STATE ELECTRICITY BOARD',
/42 'R-15 REPORT FOR LT CONSUMERS FOR THE MONTH OF',
GV_MNTH_NAME NO-GAP,'-' NO-GAP, P_BMNTH(4) NO-GAP,
180 'PAGE-NO. -', SY-PAGNO LEFT-JUSTIFIED.
SKIP.
WRITE:/2 'RAO', 15 ':'.
LOOP AT GT_TGSBT WHERE GSBER IN SO_GSBER.
IF STRLEN( LV_TEXT ) > 60.
WRITE: 16 LV_TEXT, / ''.
CLEAR LV_TEXT.
ENDIF.
CONCATENATE LV_TEXT GT_TGSBT-GSBER '-' GT_TGSBT-GTEXT
INTO LV_TEXT SEPARATED BY SPACE.
ENDLOOP.
WRITE: 16 LV_TEXT.
CLEAR LV_TEXT.
WRITE: /2 'Division',15 ':'.
LOOP AT GT_TECOKT.
IF STRLEN( LV_TEXT ) > 60.
WRITE: 16 LV_TEXT, /.
CLEAR LV_TEXT.
ENDIF.
CONCATENATE LV_TEXT GT_TECOKT-COKEY '-' GT_TECOKT-LTEXT
INTO LV_TEXT SEPARATED BY SPACE.
ENDLOOP.
WRITE: 16 LV_TEXT.
CLEAR LV_TEXT.
WRITE: /2 'Group',15 ':'.
LOOP AT GT_TE422 .
IF STRLEN( LV_TEXT ) > 60.
WRITE: 16 LV_TEXT, /.
CLEAR LV_TEXT.
ENDIF.
CONCATENATE LV_TEXT GT_TE422-TERMSCHL '-' GT_TE422-TERMTEXT
INTO LV_TEXT SEPARATED BY SPACE.
ENDLOOP.
WRITE: 16 LV_TEXT.
CLEAR LV_TEXT.
**legends
* write :/ text-028, 15 ':',16 text-029.
**now write the headings on every page
SET LEFT SCROLL-BOUNDARY COLUMN 50.
FORMAT COLOR 1 ON.
WRITE :/1(244) SY-ULINE.
WRITE :/1 SY-VLINE,6 SY-VLINE,50 SY-VLINE, 58 SY-VLINE, 59
'<----------------------------------',
'U R B A N A R E A',
'----------------------------------->'.
WRITE : 151 SY-VLINE, 152
'<----------------------------------',
'R U R A L A R E A',
'----------------------------------->',
244 SY-VLINE.
WRITE :/1 SY-VLINE,
2 'Slno',
6 SY-VLINE,
7 'Revenue Category',
50 SY-VLINE,
51 'A/C',
58 SY-VLINE,
59 'Cons-',
67 SY-VLINE,
68 'Deff',
75 SY-VLINE,
76 'Conn',
89 SY-VLINE,
90 'Sold',
108 SY-VLINE,
109 'Demand',
129 SY-VLINE,
130 'Previous',
151 SY-VLINE,
152 'Cons-',
160 SY-VLINE,
161 'Deff',
168 SY-VLINE,
169 'Conn',
182 SY-VLINE,
183 'Sold',
201 SY-VLINE,
202 'Demand',
222 SY-VLINE,
223 'Previous',
244 SY-VLINE.
WRITE :/1 SY-VLINE,
6 SY-VLINE,
50 SY-VLINE,
51 'Code',
58 SY-VLINE,
59 'umers',
67 SY-VLINE,
68 'mtrs',
75 SY-VLINE,
76 'Load-KW',
89 SY-VLINE,
90 'Units',
108 SY-VLINE,
129 SY-VLINE,
130 'Arrear',
151 SY-VLINE,
152 'umers',
160 SY-VLINE,
161 'mtrs',
168 SY-VLINE,
169 'Load-KW',
182 SY-VLINE,
183 'Units',
201 SY-VLINE,
222 SY-VLINE,
223 'Arrear',
244 SY-VLINE.
WRITE :/1(244) SY-ULINE.
SET LEFT SCROLL-BOUNDARY COLUMN 59.
* Start of Data Selection
START-OF-SELECTION.
SELECT GSBER GTEXT INTO TABLE GT_TGSBT FROM TGSBT
WHERE SPRAS = SY-LANGU.
SELECT IND_SECTOR TEXTLONG INTO TABLE GT_TB024
FROM TB024 WHERE SPRAS = SY-LANGU
AND ( ( IND_SECTOR >= '01' AND IND_SECTOR <= '55' )
OR ( IND_SECTOR = '57' OR IND_SECTOR = '58'
OR IND_SECTOR = '94' ) ).
SELECT SINGLE KTX INTO GV_MNTH_NAME FROM T247
WHERE MNR = P_BMNTH+5(2) AND SPRAS = SY-LANGU.
***master data selection
PERFORM CONSUMER_DATA_SELECTION.
*&--Get Meter Status Connected Load & MF for each installation
PERFORM OPERAND_DATA_SELECTION.
*&--Get the Demand corresponding to each Print documents selected
PERFORM BILLING_DATA_SELECTION.
*&--Get the arrears corresponding to each Print document selected
PERFORM ARREAR_DATA_SELECTION.
*&--To include Mannual R-15 into computerized R-15.
IF P_INCLUD = 'X'.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET P_FILE INTO GWA_MANUAL_DATA.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
APPEND GWA_MANUAL_DATA TO GT_MANUAL_DATA.
ENDIF.
ENDDO.
CLOSE DATASET P_FILE.
DELETE DATASET P_FILE.
ENDIF.
END-OF-SELECTION.
* End of data Selection
* Start of Data Processing
PERFORM FINAL_TABLE_PREPARE.
PERFORM FINAL_OUTPUT_PREPARE.
PERFORM FINAL_OUTPUT_DISPLAY.
* End of Data Processing
PERFORM FREE_MEMORY.
*& Form master_data_selection
* text
* --> p1 text
* <-- p2 text
FORM CONSUMER_DATA_SELECTION .
DATA: LV_MAX_DAYS TYPE I,
LV_LAST_DAY(2) TYPE C,
LV_IMONTH TYPE I,
LV_IYEAR TYPE I,
LV_BMNTH TYPE ZERDK_ERCHC-V_ABRMENGE,
LV_BYEAR TYPE ZERDK_ERCHC-EZ_ABRMENGE,
*&----Temporary tables for global internal tables.
LT_DBERCHZ1_TEMP LIKE TABLE OF GWA_DBERCHZ1,
LWA_DBERCHZ1_TEMP LIKE GWA_DBERCHZ1,
LT_ERCH LIKE TABLE OF GWA_ERCH,
LWA_ERCH LIKE GWA_ERCH,
LT_EVER LIKE TABLE OF GWA_EVER.
*DATA: lt_ever_fkkvkp like gwa_ever_eanlh_fkkvkp occurs 0.
LV_IMONTH = P_BMNTH+5(2).
LV_IYEAR = P_BMNTH(4).
LV_BMNTH = P_BMNTH+5(2).
LV_BYEAR = P_BMNTH(4).
CALL FUNCTION 'RTP_US_API_MAX_DAYS_IN_MONTH'
EXPORTING
I_DATE_MONTH = LV_IMONTH
I_DATE_YEAR = LV_IYEAR
IMPORTING
E_MAX_DAYS = LV_MAX_DAYS.
LV_LAST_DAY = LV_MAX_DAYS.
CONCATENATE P_BMNTH(4) P_BMNTH+5(2) LV_LAST_DAY INTO GV_HIGHDATE.
IF SO_GPART[] IS INITIAL.
SELECT VKONTO ANLAGE ABRSPERR
INTO TABLE GT_EVER
FROM EVER
WHERE GSBER IN SO_GSBER
AND COKEY IN SO_COKEY
AND BUKRS = 'CSEB'
AND SPARTE = '01'
AND KOFIZ = '02'.
**get installation no from contract data and check biling class in eanlh
IF GT_EVER[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered selection data' TYPE 'A'.
ENDIF.
IF NOT GT_EVER[] IS INITIAL.
SELECT VKONT KTOKL INTO TABLE GT_FKKVKP
FROM FKKVKP
FOR ALL ENTRIES IN GT_EVER
WHERE VKONT = GT_EVER-VKONT
AND GPART IN SO_GPART.
IF GT_FKKVKP[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
ENDIF.
ENDIF.
ELSE.
SELECT VKONT KTOKL INTO TABLE GT_FKKVKP
FROM FKKVKP
WHERE GPART IN SO_GPART.
IF NOT GT_FKKVKP[] IS INITIAL.
SELECT VKONTO ANLAGE INTO TABLE GT_EVER
FROM EVER
FOR ALL ENTRIES IN GT_FKKVKP
WHERE VKONTO EQ GT_FKKVKP-VKONT
AND GSBER IN SO_GSBER
AND COKEY IN SO_COKEY
AND BUKRS EQ 'CSEB'
AND SPARTE EQ '01'
AND KOFIZ EQ '02'.
ENDIF.
ENDIF.
IF GT_EVER[] IS INITIAL AND GT_FKKVKP[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
ENDIF.
SELECT ANLAGE BRANCHE INTO TABLE GT_EANLH
FROM EANLH
FOR ALL ENTRIES IN GT_EVER
WHERE ANLAGE EQ GT_EVER-ANLAGE
AND ABLEINH IN SO_MRU
AND AKLASSE EQ'0002'
AND AB <= GV_HIGHDATE
AND BIS => GV_HIGHDATE.
IF GT_EANLH[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
ENDIF.
SORT : GT_EVER BY VKONT ANLAGE,
GT_FKKVKP BY VKONT,
GT_EANLH BY ANLAGE.
LOOP AT GT_EANLH INTO GWA_EANLH.
READ TABLE GT_EVER INTO GWA_EVER WITH KEY ANLAGE = GWA_EANLH-ANLAGE.
IF SY-SUBRC = 0.
READ TABLE GT_FKKVKP INTO GWA_FKKVKP
WITH KEY VKONT = GWA_EVER-VKONT.
IF SY-SUBRC = 0.
GWA_EVER_EANLH_FKKVKP-VKONT = GWA_EVER-VKONT.
GWA_EVER_EANLH_FKKVKP-ANLAGE = GWA_EVER-ANLAGE.
GWA_EVER_EANLH_FKKVKP-ABRSPERR = GWA_EVER-ABRSPERR.
GWA_EVER_EANLH_FKKVKP-BRANCHE = GWA_EANLH-BRANCHE.
GWA_EVER_EANLH_FKKVKP-KTOKL = GWA_FKKVKP-KTOKL.
APPEND GWA_EVER_EANLH_FKKVKP TO GT_EVER_EANLH_FKKVKP.
CLEAR GWA_EVER_EANLH_FKKVKP.
ENDIF.
ENDIF.
ENDLOOP.
IF GT_EVER_EANLH_FKKVKP[] IS INITIAL.
MESSAGE 'No Business Partner exist for Selection Data' TYPE 'A'.
ENDIF.
*&----get all the billdocuments for the busines partner's contract
*&----account
SELECT BELNR VKONT INTO TABLE GT_ERCH
FROM ERCH
FOR ALL ENTRIES IN GT_EVER_EANLH_FKKVKP
WHERE VKONT EQ GT_EVER_EANLH_FKKVKP-VKONT.
*&----get the BILL MONTH & BILL YEAR FOR THE BILLDOCUMENTS.
IF NOT GT_ERCH[] IS INITIAL.
SELECT BELNR EIN01 V_ABRMENGE INTO TABLE GT_DBERCHZ1
FROM DBERCHZ1
FOR ALL ENTRIES IN GT_ERCH
WHERE BELNR EQ GT_ERCH-BELNR
AND AKLASSE = '0002'
AND ( ( EIN01 = 'BILL_MNTH1'
AND V_ABRMENGE = P_BMNTH+5(2) )
OR ( EIN01 = 'BILL_YEAR1'
AND V_ABRMENGE = P_BMNTH(4) ) ).
*&---- GET THOSE BILL DOCUMENTS WHICH ARE FOR THE ENTERED BILL MONTH
IF NOT GT_DBERCHZ1[] IS INITIAL.
LOOP AT GT_DBERCHZ1 INTO GWA_DBERCHZ1 WHERE EIN01 = 'BILL_MNTH1'
AND V_ABRMENGE = P_BMNTH+5(2).
READ TABLE GT_DBERCHZ1 INTO LWA_DBERCHZ1_TEMP
WITH KEY BELNR = GWA_DBERCHZ1-BELNR EIN01 = 'BILL_YEAR1'
V_ABRMENGE = P_BMNTH(4).
IF SY-SUBRC = 0.
APPEND LWA_DBERCHZ1_TEMP TO LT_DBERCHZ1_TEMP.
CLEAR: LWA_DBERCHZ1_TEMP.
ENDIF.
ENDLOOP.
GT_DBERCHZ1[] = LT_DBERCHZ1_TEMP[].
ENDIF.
ENDIF.
*&---NOW FIND THE PRINT DOCUMENTS FOR THE SELECTED BILLDOCUMENTS.
IF NOT GT_DBERCHZ1[] IS INITIAL.
SELECT BELNR OPBEL BUDAT FROM ERCHC
INTO TABLE GT_ERCHC
FOR ALL ENTRIES IN GT_DBERCHZ1
WHERE BELNR = GT_DBERCHZ1-BELNR
AND INTOPBEL EQ SPACE
AND SIMULATED EQ SPACE
AND INVOICED EQ 'X'.
ENDIF.
IF NOT GT_ERCHC[] IS INITIAL.
LOOP AT GT_ERCHC INTO GWA_ERCHC.
READ TABLE GT_ERCH INTO GWA_ERCH WITH KEY BELNR = GWA_ERCHC-BELNR.
IF SY-SUBRC = 0.
APPEND GWA_ERCH TO LT_ERCH.
CLEAR GWA_ERCH.
ENDIF.
CLEAR GWA_ERCHC.
ENDLOOP.
ENDIF.
GT_ERCH[] = LT_ERCH[].
FREE: LT_ERCH, LT_DBERCHZ1_TEMP,LWA_DBERCHZ1_TEMP.
LOOP AT GT_EVER_EANLH_FKKVKP INTO GWA_EVER_EANLH_FKKVKP.
* READ TABLE gt_erdk_erchc INTO gwa_erdk_erchc
* WITH KEY vkont = gwa_ever_eanlh_fkkvkp-vkont.
READ TABLE GT_ERCH INTO GWA_ERCH
WITH KEY VKONT = GWA_EVER_EANLH_FKKVKP-VKONT.
IF SY-SUBRC <> 0.
IF GWA_EVER_EANLH_FKKVKP-ABRSPERR = SPACE.
GWA_EVER_EANLH_FKKVKP-ABRSPERR = '01'.
MODIFY GT_EVER_EANLH_FKKVKP FROM GWA_EVER_EANLH_FKKVKP
TRANSPORTING ABRSPERR.
APPEND GWA_EVER_EANLH_FKKVKP TO GT_EVER_EANLH_FKKVKP_INACT.
ENDIF.
ELSE.
IF GWA_EVER_EANLH_FKKVKP-ABRSPERR <> SPACE.
GWA_EVER_EANLH_FKKVKP-ABRSPERR = SPACE.
MODIFY GT_EVER_EANLH_FKKVKP FROM GWA_EVER_EANLH_FKKVKP
TRANSPORTING ABRSPERR.
ENDIF.
ENDIF.
CLEAR GWA_ERCH.
ENDLOOP.
REFRESH GT_TECOKT[].
IF NOT SO_COKEY[] IS INITIAL.
SELECT COKEY LTEXT INTO TABLE GT_TECOKT
FROM TECOKT
WHERE COKEY IN SO_COKEY
AND SPRAS = SY-LANGU .
* %_HINTS ORACLE '("TECOKT","TECOKT~1")'.
ENDIF.
IF NOT SO_MRU[] IS INITIAL.
SELECT TERMSCHL TERMTEXT INTO TABLE GT_TE422
FROM TE422
WHERE TERMSCHL IN SO_MRU.
ENDIF.
*FREE lt_ever_fkkvkp[].
ENDFORM. " consumer_data_selection
*& Form Operand_data_selection
* text
* --> p1 text
* <-- p2 text
FORM OPERAND_DATA_SELECTION .
DATA: LT_EVER_EANLH_FKKVKP_ACT LIKE TABLE OF GWA_EVER_EANLH_FKKVKP.
* SORT gt_ever_eanlh_fkkvkp BY vkont.
CHECK NOT GT_EVER_EANLH_FKKVKP[] IS INITIAL.
**now depending upon the billing month check the time slice date
**the last date of the billing month or the range of billing month
*should fall in between the time slice of the installation
** billing month to is space
**now select operands for processed installation
LT_EVER_EANLH_FKKVKP_ACT[] = GT_EVER_EANLH_FKKVKP[].
DELETE LT_EVER_EANLH_FKKVKP_ACT WHERE ABRSPERR NE SPACE.
IF NOT LT_EVER_EANLH_FKKVKP_ACT[] IS INITIAL.
SELECT ANLAGE OPERAND WERT1
FROM ETTIFN
INTO TABLE GT_ETTIFN
FOR ALL ENTRIES IN LT_EVER_EANLH_FKKVKP_ACT
WHERE ANLAGE = LT_EVER_EANLH_FKKVKP_ACT-ANLAGE
AND OPERAND IN ('MTR_STS','CONN_LOAD','LOAD_CODE','KWH_MF')
AND ( AB <= GV_HIGHDATE AND BIS >= GV_HIGHDATE ).
* %_HINTS ORACLE '("ETTIFN","ETTIFN~003")'.
ENDIF.
ENDFORM. " Operand_data_selection
*& Form billing_data_selection
*&------------------------------Hi,
Please do run time analysis as Rob correctly mentioned or do SQL trace(ST05) to find where the program is consuming more time.
Lanka -
Hello,
I am writing a bespoke HR ABAP report. I am using logical database PNP for this.
I also need to include the Scale Proficiency Text in my report.
I have had a look at the SAP standard Qualifications Overview report and I can see that this uses the logical database PCH.
As I can only link to a single logical data, I am looking for a way of including the Scale Proficiency Text in my report.
Does anyone have any ideas on this?
Thanks,
RubyHi,
"" rp_provide_from_last p0033 space pn-begda pn-endda""
Here if u don't want subtype specific records then give space otherwise u have to specify Subtype instead of space.
""provide * from p0033 between pn-ebgda and pn-endda
endprovide.""
used as loop where all records for the employee would be selected
But if u use
""rp_provide_from_last p0033 '9001' pn-begda pn-endda""
It will fetch only latest record for particular employee whose subtype is 9001.
Hope it will help u!!!
Regards,
Aparna -
HI Gurus,
I have a ABAP report - basic list, with lot of batch data on it. based on the report they will copy the batch numbers and paste in standard transactions.
Users complaining to do a Ctrl + Y and then Ctrl + C then Ctrl + V to paste the batch numbers.
Is there anything we can do programatically using hot sopt on batch numbers so we get the selected BATCH and execute copy command programatically when they click on BATCH number on basic list.
All they need to do is Ctrl + V on standard transactions.
Is there anyway to achieve this?
Thanks GiriGiri - you would probably get more results if you mark this as a question. That way you can assign po1nts to helpful answers.
In any event why don't you just do a CALL TRANSACTION when the user double clicks on a line?
Rob -
SAP ERP 2005 SR 2 IDES installation error in step "Run ABAP Reports"
Hello,
I'm installing SAP ERP 2005 SR 2 IDES on Win2003 R2 SP2 and Oracle 10.2 to create a test-system for my diploma thesis.
During the step "Import ABAP" I got the following message:
object_checker.log
ERROR: 2008-05-21 20:50:38
1 objects have error/ignore/execute or unknown status in the task lines.
Invalid objects are saved in 'invalid_objects.txt' file.
invalid_objects.txt
package object type action status
SAPDFACT ?N pkey create
but the installation went on until "Run ABAP Reports".
Warnings and Errors in sapinst.log are:
WARNING 2008-05-27 15:09:36
Execution of the command "C:\usr\sap\IMP\SYS\exe\uc\NTI386\stopsap.exe name=IMP nr=00 SAPDIAHOST=imperia-sap" finished with return code -1. Output:
STOPSAP: execution of C:\usr\sap\IMP\SYS\exe\uc\NTI386\sapntwaitforhalt.exe name=IMP nr=00 SAPDIAHOST=imperia-sap 3600 failed
Details are written to C:\Programme\sapinst_instdir\ERP\SYSTEM\ORA\CENTRAL\AS\stopsap.log
WARNING 2008-05-27 15:09:36
Could not stop instance 'DVEBMGS00' of SAP system IMP.
WARNING 2008-05-27 15:09:38
Connect to message server (imperia-sap/3900) failed: NIECONN_REFUSED.
WARNING[E] 2008-05-27 15:12:05
FSL-06002 Error 1060 (Der angegebene Dienst ist kein installierter Dienst.) in execution of a 'OpenService' function, line (266), with parameter (sapccmsr.00).
WARNING[E] 2008-05-27 15:21:42
FRF-00007 Unable to open RFC connection.
ERROR 2008-05-27 16:30:15
FRF-00025 Unable to call function. Error message: connection closed without message (CM_NO_DATA_RECEIVED) .
INFO 2008-05-27 16:30:19
RFC connection closed.
ERROR 2008-05-27 16:30:45
MUT-03025 Caught ERfcExcept in Modulecall: connection closed without message (CM_NO_DATA_RECEIVED).
ERROR 2008-05-27 16:30:47
FCO-00011 The step runRADDBDIF with step key |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|1|0|NW_CI_Instance|ind|ind|ind|ind|11|0|NW_CI_Instance_ABAP_Reports|ind|ind|ind|ind|2|0|runRADDBDIF was executed with status ERROR .
Full log of today is available at [http://pastebin.com/f43531f97]
Has anyone an idea how I can finish this installation?
Thx
DanieleIt seems that the system did not come up and thus the RFC call fails.
What´s the output of
dev_w0
dev_disp
(in the ...work directory)?
Markus -
Error in Phase Run ABAP report
Hi All,
We are running an installation on I5/OS for ERP 6.0 EHP5. Installation is stucked at phase Run ABAP reports where it is trying to run RSWBOINS report and giving an error SQL error -7008. Log says ddic user is not able to login in the system and RFC all fails. However system is up and running fine.
I checked number of notes 116192 but it did not help. One note says to upgrade the database library and we did the same but issue still remains. Anyone phase similar errors, Please suggest.
Thanks
SunnyHi Sunny,
it sounds like some tables are not journaled. You may want to try to run AS4FIXFILE DBLIB(R3<sid>DATA) STRJRN(*YES).
If that does not help, I suggest to check SAP note 1387754, and to try the workaround described there, or to get the newest version of AS4FXIFILE and to try to run it again.
Best regards,
Dorothea Stein -
Abap Report including sales orders and delivery data.
Hi Experts,
I Want to develop a new abap report which would contain the data for sales orders and delivery.
I want to fetch all the sales orders based on the ship date (LIKP-WADAT_IST) of the delievry.
Could anyone please let me know how to fetch teh data or is their any function module which would help me to solve my problem.
<Removed by moderator>
Thanks,
Komal.
Moderator message : Spec dumping not allowed. Thread locked.
Edited by: Vinod Kumar on Aug 10, 2011 1:25 PMpost this in ABAP forum for quicker response.
Regards
Raja -
SUBMIT an ABAP report after creating the WI but before completion of WI.
Dear All,
I am having an activity which sends the approval work item.
Now my requirement is to SUBMIT an ABAP report after creating the WI but before completion of WI.
I can not call this report before approval activity because i need to pass this WI ID to this report.
Please suggest some way to solve this.
Regards,
AmarHello,
You could create a 2-from-2 fork and put the workitem in one branch and the report in the other. Have the report branch wait 1 minute and then read the workitem id from the other branch.
What is the purpose of this report? Why does it need the workitem id?
regards
Rick Bakker
hanabi technology -
One of our abap report is extremely slow, this report is used by all
branches of our company
and we are facing serious performance problem in this report. I have
analyzed the problem
and noted following things.
1) The report used "BSIS" table for a query.
2) In peak times it is observed lot of IO wait is happening on that
particular report and on
"BSIS" table.
3) After analysis of table BSIS it is noted that table has more than 12
million records and
exceeding table class limit in technical setting of tables.
4) Size of table is 4 GB.
5) Table also does not have other indexes apart from one composite PK-
unique index. This
index is composed of 9 fields.
6) Update Stats is has been taken in 10 minutes of BSIS~0.
We are closely analyzing code and where clause of our report.
I want to ask do we need other indexes specially on DATE field which is
not included in
existing index?
Do we need index rebuild as stats are gathered in 10 minutes which is
quite a long time in
my opinion?
Do we need table partition right now as BSIS has 12 million records and
4 GB of size ?
Best Regards
WaqasHi,
1) table bsis is the table for open items (GL-accounts)
-> perfect state of such a table is that there are <b>zero</b> entries,
because all open items had to be cleared and are moved to table bsas
(cleared items)
-> so 1st there is an organisational problem in your company / account dept.
why there are so many open items?
2) analyse the select statements and the abaps, which fetch bsis-table with
st05
-> check, whether key-fields BUKRS and HKONT are filled in where-clause
3)-> look to wiki- ABAP Performance and Tuning
https://wiki.sdn.sap.com/wiki/display/HOME/ABAPPerformanceand+Tuning#ABAPPerformanceandTuning-Whattoolscanbeusedtohelpwithperformancetuning%3F
regards Andreas -
Product for presenting ABAP report output in Dashboard Presentation
<u>Background</u>
Monash University environment is SAP ERP ECC6 - no BW. The University has undertaken considerable analysis of spend as part of developing a strategic approach to procurement. The data used to undertake this analysis was extracted from SAP MM and FI using a developed ABAP report which collates, categorizes and consolidates all spend information from MM (for our Purchase Order based commitment and expenditure) and FI (for direct invoices and Corporate Credit Card expenditure). This information is then currently exported to MS-Excel to produce a report containing graphs, pie charts etc.
<u>Requirement</u>
To present output from our Spend Analysis Report in a more readable dashboard type presentation. This facility should allow easy manipulation (slice and dice) and drill down of the data.. Our requirement is to have something operating within a very short time-frame, say within a month or two. Although you might suggest Web Dynpro Business Graphic or SEM /BW (as the optimal solution) we understand the set up time for either of these solutions is prohibitive. Visual Composer has been suggested as another option but we have no in-house expertise to determine if this is a viable solution.
Some colleagues visited a conference a couple of weeks ago and saw a demonstration of a product call XenoCube http://www.inlogik.com/downloads/XenoCube_Brochure.pdf
which was proposed as a quick way to present SAP 'raw' report output in a more readable form. Other solutions in this space that have been suggested include:-
Zycus - Actionable Spend Analysis Zycus.com
Emptoris Spend Analysis - emptoris.com
ONIQUA Enterprise Analytics oniqua.com.au
Ariba Buyer ariba.com
SAS Spend Analysis sas.com
Etesius SpendGuardian etesius.com
Can anyone provide advice as to their experience of SAP solution, integrated partner products or any of the about products to satisfy a similar requirement to that which I have outlined? The main selection criteria will include a product which is:
a) quick & easy to implement,
b) presentation and manipulation of ABAP extracted data
c) is scalable and
d) is reasonably priced.
Grateful for any advice regarding a solution .
Thank-youHi,
This development writes to mapped network drive in Unix. The concept will be similar.
[http://wiki.sdn.sap.com/wiki/display/SCM/APOtoMappedNetworkDrive]
cheers
Aveek -
Options for ABAP report output in Dashboard type presentation
Background
Monash University environment is SAP ERP ECC6 - no BW. The University has undertaken considerable analysis of spend as part of developing a strategic approach to procurement. The data used to undertake this analysis was extracted from SAP MM and FI using a developed ABAP report which collates, categorizes and consolidates all spend information from MM (for our Purchase Order based commitment and expenditure) and FI (for direct invoices and Corporate Credit Card expenditure). This information is then currently exported to MS-Excel to produce a report containing graphs, pie charts etc.
Requirement
To present output from our Spend Analysis Report in a more readable dashboard type presentation. This facility should allow easy manipulation (slice and dice) and drill down of the data.. Our requirement is to have something operating within a very short time-frame, say within a month or two. Although you might suggest Web Dynpro Business Graphic or SEM /BW (as the optimal solution) we understand the set up time for either of these solutions is prohibitive. Visual Composer has been suggested as another option but we have no in-house expertise to determine if this is a viable solution.
Some colleagues visited a conference a couple of weeks ago and saw a demonstration of a product call XenoCube http://www.inlogik.com/downloads/XenoCube_Brochure.pdf
which was proposed as a quick way to present SAP 'raw' report output in a more readable form. Other solutions in this space that have been suggested include:-
Zycus - Actionable Spend Analysis Zycus.com
Emptoris Spend Analysis - emptoris.com
ONIQUA Enterprise Analytics oniqua.com.au
Ariba Buyer ariba.com
SAS Spend Analysis sas.com
Etesius SpendGuardian etesius.com
Can anyone provide advice as to their experience of SAP solution, integrated partner products or any of the about products to satisfy a similar requirement to that which I have outlined? The main selection criteria will include a product which is:
a) quick & easy to implement,
b) presentation and manipulation of ABAP extracted data
c) is scalable and
d) is reasonably priced.
Grateful for any advice regarding a solution .
Thank-youHi,
This development writes to mapped network drive in Unix. The concept will be similar.
[http://wiki.sdn.sap.com/wiki/display/SCM/APOtoMappedNetworkDrive]
cheers
Aveek -
Create ABAP Report for Infoprovider
Could anyone tell me Function module to fetch Infoprovider(s) for creating ABAP report on.
The report should provide:
Input:
- Infoprovider(s)
- Date-range: default: last 6 months
Output:
- data which is shown in the requests tab as described before, preceeded with the name of the infoprovider and having the possibility to download to Excel.
ThanksHi,
you can easily use it as a template to create your own program. The program just shows what to do and how you need to populate the tables in order to pass selection parameters to the fm to get the required data back.
Here a little demo I created to do it a bit flexible from different cubes:
DATA: ref_data_tab TYPE REF TO data,
ref_data_line TYPE REF TO data,
it_sfc TYPE rsdri_th_sfc,
l_sfc TYPE rsdri_s_sfc,
it_sfc2 TYPE rsdd_th_sfc,
l_sfc2 TYPE rrsfc01,
it_sfk TYPE rsdri_th_sfk,
l_sfk TYPE rsdri_s_sfk,
it_sfk2 TYPE rsdd_th_sfk,
l_sfk2 TYPE rrsfk01,
l_first_call TYPE rs_bool,
l_end_of_data TYPE rs_bool,
l_tabname(30) TYPE c,
l_cube(30) TYPE c,
it_cobpro TYPE rsd_t_cob_pro,
l_cobpro TYPE rsd_s_cob_pro.
FIELD-SYMBOLS: <e_t_data> TYPE table,
<l_data> TYPE ANY,
<fs_field>.
PARAMETERS: pa_cube TYPE rsinfoprov OBLIGATORY DEFAULT '/NBAG/CML_C05',
pa_debug AS CHECKBOX.
IF pa_cube(1) = '0'.
CONCATENATE '/BI0/V' pa_cube '2' INTO l_tabname.
ELSE.
CONCATENATE '/BIC/V' pa_cube '2' INTO l_tabname.
ENDIF.
CREATE DATA ref_data_tab TYPE TABLE OF (l_tabname).
CREATE DATA ref_data_line TYPE (l_tabname).
ASSIGN ref_data_tab->* TO <e_t_data>.
ASSIGN ref_data_line->* TO <l_data>.
IF pa_debug = 'X'.
BREAK-POINT.
ENDIF.
CALL FUNCTION 'RSD_COB_PRO_ALL_GET'
EXPORTING
i_infocube = pa_cube
I_WITH_ATR_NAV = RS_C_FALSE
I_WITH_META_IOBJ = RS_C_FALSE
I_OBJVERS = RS_C_OBJVERS-ACTIVE
I_BYPASS_BUFFER = RS_C_FALSE
IMPORTING
e_t_cob_pro = it_cobpro
E_T_IOBJ_CMP =
E_T_ATR =
E_TLOGO =
EXCEPTIONS
infocube_not_found = 1
error_reading_infocatalog = 2
illegal_input = 3
OTHERS = 4.
IF sy-subrc <> 0.
WRITE: / sy-subrc, sy-msgno, sy-msgid, sy-msgv1, sy-msgv2, sy-msgv3.
ENDIF.
CLEAR: it_sfk[], it_sfc[].
LOOP AT it_cobpro INTO l_cobpro.
IF l_cobpro-iobjtp = 'KYF'.
IF l_cobpro-ncumfl IS INITIAL.
l_sfk-kyfnm = l_cobpro-iobjnm.
l_sfk-kyfalias = l_cobpro-iobjnm.
l_sfk-aggr = l_cobpro-aggrgen.
INSERT l_sfk INTO TABLE it_sfk.
MOVE-CORRESPONDING l_cobpro TO l_sfk2.
INSERT l_sfk2 INTO TABLE it_sfk2.
ENDIF.
ELSE.
IF l_cobpro-dimension NP '*P'.
l_sfc-chanm = l_cobpro-iobjnm.
l_sfc-chaalias = l_cobpro-iobjnm.
l_sfc-orderby = 0.
INSERT l_sfc INTO TABLE it_sfc.
MOVE-CORRESPONDING l_cobpro TO l_sfc2.
INSERT l_sfc2 INTO TABLE it_sfc2.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR l_end_of_data.
l_first_call = 'X'.
WHILE l_end_of_data = space.
CALL FUNCTION 'RSDRI_INFOPROV_READ'
EXPORTING
i_infoprov = pa_cube
i_th_sfc = it_sfc
i_th_sfk = it_sfk
I_T_RANGE =
I_TH_TABLESEL =
I_T_RTIME =
i_reference_date = sy-datum
I_T_REQUID =
I_SAVE_IN_TABLE = ' '
I_TABLENAME =
i_save_in_file = 'X'
i_filename = 'C:\test.csv'
i_packagesize = 1000
I_MAXROWS = 0
i_authority_check = ' '
I_CURRENCY_CONVERSION = RS_C_TRUE
i_use_db_aggregation = ' '
i_use_aggregates = ' '
i_rollup_only = ' '
I_READ_ODS_DELTA = RS_C_FALSE
I_CALLER = RSDRS_C_CALLER-RSDRI
I_DEBUG = RS_C_FALSE
IMPORTING
e_t_data = <e_t_data>
e_end_of_data = l_end_of_data
E_AGGREGATE =
E_SPLIT_OCCURRED =
CHANGING
c_first_call = l_first_call
EXCEPTIONS
illegal_input = 1
illegal_input_sfc = 2
illegal_input_sfk = 3
illegal_input_range = 4
illegal_input_tablesel = 5
no_authorization = 6
ncum_not_supported = 7
illegal_download = 8
illegal_tablename = 9
trans_no_write_mode = 10
inherited_error = 11
x_message = 12
OTHERS = 13.
IF sy-subrc <> 0.
WRITE: / sy-subrc, sy-msgno, sy-msgid, sy-msgv1, sy-msgv2, sy-msgv3.
EXIT.
ELSE.
LOOP AT <e_t_data> INTO <l_data>.
WRITE: / sy-tabix, ':'.
LOOP AT it_cobpro INTO l_cobpro.
IF l_cobpro-ncumfl IS INITIAL.
ASSIGN COMPONENT l_cobpro-iobjnm OF STRUCTURE <l_data>
TO <fs_field>.
IF sy-subrc = 0.
WRITE: <fs_field>.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
CLEAR: l_first_call, <e_t_data>[].
IF l_end_of_data <> space.
EXIT.
ENDIF.
ENDWHILE
Hope this helps a bit
regards
Siggi -
Status change of Single correction using Abap report
Hi Experts,
I have a requirement to change the status of Single correction CR's to "completed" and also set the preceding document to appropriate status . I am using the function module CRM_ORDER_MAINTAIN followed by ORDER_SAVE to do so.
But this does not change the status.
Please let me know if there is anything that has to be done while changing the status of CR through an ABAP Report.
Thanks in advance for ur help.
RitheshUse function CRM_STATUS_CHANGE_EXTERN and also CRM_ORDER_SAVE and commit at the end.
Maybe you are looking for
-
How can I deal with 19YY vs 20YY problem?
Hi, I have a sqlldr control file that looks something like this ... LOAD DATA INFILE * REPLACE INTO TABLE BLAH_BLAH_BLAH FIELDS TERMINATED BY '|' TRAILING NULLCOLS COL1, THE_DATE, COL2 BEGINDATA ABC|01-JAN-82|BLAHBLAH XYZ|01-AUG-00|BLAHBLAH where 01-
-
How to delete all Messages in B1-Event-Monitor
Hello, is there a way to delete all Messages from the B1-Event-Monitor. Now we have: ... But when I try the "Delete All" Function nothing happend, and the Browser hang. I found this post.B1if db unexplained growth.. and followed all steps. 1)Monitori
-
I created a form... and noticed that when I go to record and choose insert it.. insert record and then exit out of form it doesn't give me the prompt anymore to save.. I did get this message before but not anymore... what could be a possible fix for
-
MaxDB: .M760309 service fails to start
Dear Friends, The MaxDB: .M760309 service is not starting when the system starts. We are working on Netweaver 7.0. Currently the MaxDB (quick) is set to start automatically. It returns an error message : "Error2; The system could not find the file sp
-
How to create a new job for transaction MC8E ?