Abap report desired format
I am working on a object with attatched details. Is it possible to have this type of format in simple report or alv report....
depending upon input , it will show no months.
Thanks
Hi,
if you really want this, you have to use the WRITE statement
WRITE : (means multi value) / (means new line) XX (position in the column
there is also the option UNDER (to put directly the value in the column of the field you have specified)
regards
Fred
Similar Messages
-
Hello friends,
In my report I have to display the details of the selection screen.
I am having some problem with the date format
HOwever when the user changes the settings in the user profile the data
format on the report should display as what the user profile settings are.
for EG -
if the user has the settings as YYYY-MM-DD
the output should be 2007-12-11.
If the user changes the date format as MM/DD/YYYY
the output should be 12/11/2007.
Any suggestions.
Ster
REPORT ZCP0A128 NO STANDARD PAGE HEADING
LINE-SIZE 80
LINE-COUNT 65(0)
MESSAGE-ID ZZ.
TABLES : ZCAST.
SELECT-OPTIONS: S_PSTTR FOR ZCAST-ZEFDAT DEFAULT SY-DATUM.
WRITE : S_PSTTR-LOW.Hi,
Check this FM DATUMSAUFBEREITUNG
I think you can also just use write statement to get the Date format as in User Profile.
Regards,
Satish -
ABAP Report - Landscape format
I need to change the report display to landscape. Right now the report gets cut off at 178 characters. How do I allow for more than 178 characters, horizontally? Also, how can I ensure that the report prints in landscape format? I used FM GET_PRINT_PARAMETERS to set the print format to landscape but it still cuts off at 178 characters, with room for more.
Regards,
DavisHi,
You need to specify Line size and Line count at statement "REPORT ZNAME".
Check below code, this report will have 60 rows and 220 columns.
REPORT ZNAME LINE-SIZE 220 LINE-COUNT 60 NO STANDARD PAGE HEADING.
More Information:
... LINE-SIZE width
Effect
This addition specifies the line width of the basic list and details list of the program to width characters, and sets the system field sy-linsz to this value. The line width determines the number of characters in the line buffer as well as the number of columns in the list displayed. The value width must be a positive numeric literal. The maximum line width is 1,023 characters.
LINE-COUNT page_lines (footer_lines)
Effect
This addition specifies the page length for the basic list of the program to page_lines lines and fills the system field sy-linct with this value. If the LINE-COUNT is not specifed, and if page_lines are less than or equal to 0 or greater than 60,000, then the page length is set internally to 60,000. This setting overwrites the passed value of the like-named LINE-SIZE addition to the statement SUBMIT and can be overwritten during list creation with the like-named LINE-COUNT addition to the statement NEW-PAGE.
Regards, -
Format question for a ABAP report
Hi experts,
Exist a way to create or use a format to print an output of an ABAP report that adjust to the screen? I have a Abap report that in the output have some subtrees for the information displayed.... but if the user expand a lot the subtrees when he or she print the document they see the leters and numbers very small or whitout some columms.... How can I create a format to fix this or what is the way ?
Thanks for the help!Please.... I need help in this topic.... any suggestions?
Thanks! -
ABAP Report WRITE, how to ouptut long lines without additional formatting?
I am developing a program, which dumps objects as XML and I need to create one big XML file at the end. I would like to start it as a background job and get this XML as spooled output at the end. The problem is that the XMLs come from CALL TRANSFORMATION as one big string without any CR LF and in the report spooled output there are additional "formatting" like header, pages etc.:
#COL0N#COL0H07.12.09 Programm EHFND_GENERATE_BO_DOCU 1
#<bopf_bo><item><KEY>gB4L/AeoHd6tl1YoR5AdIg==</KEY><PARENT_KEY/><ROOT_KEY>gB4L/A
#<bopf_bo><item><KEY>gB4L/AeoHd6tl2lLeQUKOQ==</KEY><PARENT_KEY/><ROOT_KEY>gB4L/A
#<bopf_bo><item><KEY>gB4L/AeoHd6tmEQlByTUEg==</KEY><PARENT_KEY/><ROOT_KEY>gB4L/A
#<bopf_bo><item><KEY>gB4L/AeoHd6xjRciawUXeQ==</KEY><PARENT_KEY/><ROOT_KEY>gB4L/A
#<bopf_bo><item><KEY>gB4L/AeoHe6t31MGbgZYFg==</KEY><PARENT_KEY/><ROOT_KEY>gB4L/A
P
|#COL0N#COL0H07.12.09 Programm EHFND_GENERATE_BO_DOCU 2
|#######################################################################################
|#<bopf_bo><item><KEY>gCFaXDIYHe60jgYnuB9agQ==</KEY><PARENT_KEY/><ROOT_KEY>gCFaXD
Is it possble to make the WRITE statement automatically insert CR LF so I do not loose the XML data and also do not output
any additional symbols? My purpose is to get clean XML data at the end, which can be e.g. directly loaded into explorer.
I already have a solution which fills a DB table with all XMLs and finaly I create the file with cl_gui_frontend_services=>gui_download but I would like to have a simplier solution using only the abap report output.
Edited by: Rob Burbank on Dec 8, 2009 10:56 AMBetter option would be writing this XML string to File on the application server using OPEN DATASET ... TRANSFER .... CLOSE DATASET. You can give the provision in the same program to download this application server file to Presentation.
Regards,
Naimesh Patel -
Classical List to ALV format in sap abap report
Hi All,
I have a requirement to change the existing abap report in which teh output is dispalyed in classical list format.
I want to convert this list report output into ALV format.
COuld anyone please help me how to convert this from Classical list to ALV format?
Thanks,
Komal.
Moderator message: sorry, this not the place to teach the basics, please search for available information. If you understand the classical list and how to use ALV, then you can also do the transfer yourself.
Edited by: Thomas Zloch on Aug 12, 2011 4:44 PMThis will be very difficult for you.....
Since you are getting a time out error....it looks like, you are runnning this report in foreground....................
Try running it in background it will work...
ELSE....you have to fetch in small chunks....but the question is how will you do it. Since the USR02 only has BNAME as primary key...
Either put the BNAME as part of selection screen and fetch the data.....it will solve your problem....
Only fetch for those BNAME which is entered in the selection screen...
Hope it helps! -
Convert ABAP Report's Output into PDF Format..
Hello Experts,
I want to convert the outout of an ABAP report to an PDF file. I have succedded in doing the following :
Data statistics -
Number of
Records passed ---4
After executing the program RSTXPDFT4, i can get PDF file saying number of records in the above format...
But i want to have the output of the report in PDF. suppose a list is being displayed in the output olf the ABAP report, i want to save that report in PDF format....
Please help........
Anupam...Hi Anupam,
Try this way
<font color=blue><pre>
REPORT ztest_notepad.
"Variables
DATA:
l_lay TYPE pri_params-paart,
l_lines TYPE pri_params-linct,
l_cols TYPE pri_params-linsz,
l_val TYPE c,
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname,
l_jobcount LIKE tbtcjob-jobcount,
spoolno TYPE tsp01-rqident.
*Types
TYPES:
t_pripar TYPE pri_params,
t_arcpar TYPE arc_params.
"Work areas
DATA:
lw_pripar TYPE t_pripar,
lw_arcpar TYPE t_arcpar.
DATA:
it_t100 TYPE t100 OCCURS 0 WITH HEADER LINE,
it_pdf TYPE tline OCCURS 0 WITH HEADER LINE.
"Start-of-selection.
START-OF-SELECTION.
l_lay = 'X_65_132'.
l_lines = 65.
l_cols = 132.
"Read, determine, change spool print parameters and archive parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = lw_arcpar
in_parameters = lw_pripar
layout = l_lay
line_count = l_lines
line_size = l_cols
no_dialog = 'X'
IMPORTING
out_archive_parameters = lw_arcpar
out_parameters = lw_pripar
valid = l_val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF l_val <> space AND sy-subrc = 0.
lw_pripar-prrel = space.
lw_pripar-primm = space.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS lw_pripar
ARCHIVE PARAMETERS lw_arcpar
NO DIALOG.
ENDIF.
"Get data
SELECT *
FROM t100
INTO TABLE it_t100
UP TO 100 ROWS
WHERE sprsl = sy-langu.
" Writing to Spool
LOOP AT it_t100.
WRITE:/ it_t100.
ENDLOOP.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
spoolno = sy-spono.
"Convert spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
IMPORTING
pdf_bytecount = l_no_of_bytes
pdf_spoolid = l_pdf_spoolid
btc_jobname = l_jobname
btc_jobcount = l_jobcount
TABLES
pdf = it_pdf.
"Download PDF file C Drive
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = it_pdf. </pre></font>
Thanks
Venkat.O -
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 -
Save the output of the abap report to local file in the pc
Hi ALL,
In my ABAP Report I am having a internal table with final data, right now I am moving that data to al11. but now I want to save that data in local PC as the file format given in the selection screen before executing the report.
CAn any one say how to do this or suggest me how to proceed please.
RaviHi Ravi,
You can use the function module GUI_DOWNLOAD to store in a file on PC.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = file_path
filetype = 'ASC'
* APPEND = 'X'
write_field_separator = 'X'
* CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_finaltab "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
Regards,
Chandra Sekhar -
Changing Oracle Report Output Format at runtime
Dear All,
I've custom Oracle Report in Oracle Apps., and would like to give the users an option to select the output format (XML, TEXT, PDF, etc.) whilst submitting the request.
As a SYSADMIN, we can modify the Output Format value of the concurrent program(Oracle Report in this case) to one we like.
But I would like the user to select this output format option at runtime, rather then hard coding at SYSADMIN level. For that I've to create a Value Set with the desired report output format options, and attach this to the concurrent program.
My question is, how we can make the desired output format to work at runtime?
If any one can help?
Thanks,
SandeepHi Steve,
I couldn't get it...???
I'm running an Oracle Report in Oracle Apps. release 11.5.9
The default output format of this report is TEXT, which is defined in its concurrent program.
This report is submitted using standard request submission screen, and after successful completion we can view the output by pressing "View Output" button on "Requests" screen. This will open an another window and we can view the output page by page. Using "Tools>Copy File..." menu option, we can view the same output in IE window.
Now, how does your resolution fits here and how can I view the same report in XML format?
Many Thanks,
Sandeep -
Scheduling a background abap report to run on a specific date
Hello Experts,
I have an ABAP report I want to schedule in another program.
Basically, I want to schedule it, so that it runs the next day (sy-datum + 1). I have used FM Job_open followed by submit and Job close, but the program is executed immediately.
Below is the code snippet:
v_datenext = sy-datum + 1.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = v_datenext
sdlstrttm = sy-uzeit
IMPORTING
jobcount = jobcount.
SUBMIT z_prg_spinterf
WITH i_year EQ v_subyrnext
WITH i_month EQ app->g_str_header-f_month
WITH i_dc EQ 'B'
USER sy-uname
VIA JOB jobname
NUMBER jobcount
AND RETURN.
starttime-sdlstrttm = sy-uzeit + 60.
Close job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
prddays = 1
sdlstrtdt = v_datenext
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host.
The report z_prg_spinterf is getting executed immediately, which i dont want. I wanted it to be executed the next day.
Can someone help find out the source of the error. Maybe I am missing out something.
Thanks,
Nitish.Hi
1. go to transaction sm36
2. select job wizard
2.1 press continue
2.2 Enter a job name say abc(user defined)
Enter job class:- select priority say 'high priority"
2.3press continue
2.4 Select Abap program step
2.5 press continue
2.6 Enter the correct program name say"Z_REPORT"
2.7 Enter the correct variant name say" v1" and press continue
2.8 press continue
2.9 Select job start condition: "Date/Time" radio button and press continue
3.0 Enter the scheduled date: ie, date to which the report to be executed and give the desire time
3.1 press continue
3.2 Press complete
3.3 If success the report will be executed
To see the output of the report
1. transaction sm36
2. select own jobs
3. Find ur job name .
4. Press on spool, u will find the out put. -
Hi!
There are several report print formats in an ABAP report. You can choose between them during printing, some examples: X_65_80 (80 columns, 65 lines), X_90_120 (120 columns, 90 lines) and so on...
Is there away to define more "standard" like printer formats?
I know, I can give anything after the REPORT statement (like REPORT zreport LINE-SIZE 99 LINE-COUNT 99) but these are not standard and mostly the printers don1t like them.
Thank you in advance
TamáHi Tamas,
When you run the report, the spool will be displayed on the screen. At this time, click on print,the system will show the print dialog. Click on properties, this will spool request attribites dialog. Click settings. in the next dialog box, select the required field, and the value and select the validity as required. This way you can set the standard format for all reports.
Ravi -
How to directly print PDF file(which is stored in SAP) in ABAP report?
Hi experts,
I searched SDN for printing PDF file but everything is about OTF to PDF and to use fm: CONVERT_OTF which is not the solution for my problem.
I have to build ABAP report which will take the PDF file attached to SAP document (CV02N) and print it.So, which function module or program can I use to print the PDF file?
Thank you very much.
Kind regards,
DanijelaDear
this is the code for down load smartform for PDF format. its working properly
2nd way is
set your Acrobat Printer as your default printer
when you print select printer as LOCAL
then you will file dialog box for Naming PDF
DATA : T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE.
DATA : WA_CTRLOP TYPE SSFCTRLOP.
DATA : WA_OUTOPT TYPE SSFCOMPOP.
DATA : T_OTFDATA TYPE SSFCRESCL.
DATA : T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA : V_FILESIZE TYPE I.
DATA : W_BIN_SIZE TYPE I.
WA_CTRLOP-GETOTF = 'X'.
WA_CTRLOP-NO_DIALOG = 'X'.
WA_OUTOPT-TDNOPREV = 'X'.
CALL FUNCTION P_LV_FNAME
EXPORTING
OUTPUT_OPTIONS = WA_OUTOPT
USER_SETTINGS = 'X'
CONTROL_PARAMETERS = WA_CTRLOP
IMPORTING
JOB_OUTPUT_INFO = T_OTFDATA
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
T_OTF[] = T_OTFDATA-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = W_BIN_SIZE
TABLES
OTF = T_OTF
LINES = T_PDF_TAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
DATA : LV_DOWN_FILE TYPE RLGRAP-FILENAME.
DATA : LV_TEXT TYPE STRING.
CASE SSCRFIELDS-UCOMM.
WHEN 'REPRUNMOLD'.
CONCATENATE '(' SO_SCHDT-LOW '-' SO_PLANT-LOW ')' INTO LV_TEXT.
CONCATENATE '\\lkdb01\FTP-Loadstar\0.PP_Planning\ZPP014\Run_Moulds\' SY-DATUM '-' SY-TIMLO '-' 'Running Mould' '-' LV_TEXT '.pdf' INTO LV_DOWN_FILE SEPARATED BY SPACE.
WHEN 'REPLINESIT'.
CONCATENATE '(' SO_SCHDT-LOW '-' SO_PLANT-LOW '-' SO_LINE2-LOW ')' INTO LV_TEXT.
CONCATENATE '\\lkdb01\FTP-Loadstar\0.PP_Planning\ZPP014\Line_Situation\' SY-DATUM '-' SY-TIMLO '-' 'Line Situation' '-' LV_TEXT '.pdf' INTO LV_DOWN_FILE SEPARATED BY SPACE.
ENDCASE.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_SIZE
FILENAME = LV_DOWN_FILE
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = V_FILESIZE
TABLES
DATA_TAB = T_PDF_TAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
MESSAGE 'File not downloaded succesfully' TYPE 'I'.
EXIT.
ELSE.
MESSAGE 'PDF File downloaded succesfully' TYPE 'I'.
ENDIF.
ENDFORM. " Print_PDF
Rewards if useful. -
XML file to ABAP report..gidance needed on approach
Hello All,
We have an existing ccBPM enabled interface between SAP-ECC and a 3rd party via PI. Currently after all the to-and-fro processing, 3rd party sends an XML FINAL-RESPONSE-FILE to PI, which resides on a folder in PI server. ( Interface ends here)
Now the requirement is that we need to enhance this interface or create a new one which would pick the XML FINAL_RESPONSE_FILE and format the XML data and present it in user-friendly form in terms of a report /alv.
What I want to know is:
1> Should we enhance the existing interface and ccBPM to wait for this final-response file to come and then trigger some BAPI or maybe a proxy to send this data to ECC for further processing.
OR
2> Should we create a sepaarte interface which picks this file asynchronously and sends to ECC for further processing.
OR
3> Should a create an ABAP report, which would pick this file from PI server and format the data and create an report out of it. ( Here I assume SAP must be havinga fm to convert XML to some internal table readable format)...please advise if there is such an FM.
OR
4> Is there any better approach for my scenario - I am a newbie in ccBPM.
Many thanks
ShirinHi,
1> Should we enhance the existing interface and ccBPM to wait for this final-response file to come and then trigger some BAPI or maybe a proxy to send this data to ECC for further processing.
No...if you are planning to make the ccBPM wait then avoid this design...it will keep on utilising system resources till the response gets back...
OR
2> Should we create a sepaarte interface which picks this file asynchronously and sends to ECC for further processing.
you can try this one.....rather I would have tried this one:)
If you have a guarentee that the response will come within a stipulated time-period (say X secs...not very large) and if you are not supposed to create a new interface...then go for change in BPM
Regards,
Abhishek. -
Want to have own selection screen in HR-ABAP report using LDB
Hi experts,
I am working on HR-ABAP report using LDB pnp and infotypes..But, here we get the built in selection criterion..but I want my own selection screen to be displayed..whats the solution for this??? Is it possible to create my own selection screen instead of default one..and how???
Please help me..its very urgent..Hi,
chk this out:
Create Report Categories
In this step, you define the report categories and determine the layout
of the standard selection screen for these report categories. You can
create report categories for programs or queries that are based on the
PNP or PNPCE logical databases.
The definition of report categories is divided into two sections:
o In the Change Report Category view, you define general attributes
such as sort order, input fields for date, and so on.
o In the Change Selection Criteria view, you define which selection
fields of the logical database should be avaliable on the selection
screen.
Example
You want to set up your system so that your employees can only start
evaluation reports for Payroll if they use a payroll area. Within a
payroll area, you should be able to select according to personnel
number. Additional selection criteria should not be possible and you
should not be allowed to enter a sort sequence.
Standard settings
The standard system already contains report categories. You can find the
attributes of the report categories in the table.
Note the following five report categories in particular:
o Report category ' ' is the SAP default report category for
programs that are based on the PNP logical database.
o Report category PNPCE is the SAP default category for programs that
are based on the PNPCE logical database.
o Report category '00000000' is the customer-specific default category
for programs that are based on the PNP logical database.
o Report category '0PNPCE' is the customer-specific default category
for programs that are based on the PNPCE logical database.
o Report category __X2001 is the default category for Queries that
are based on an InfoSet of the PNP LDB.
o Report category QUEPNPCE is the default category for queries that
are based on an InfoSet of the PNPCE LDB.
The default report categories are used when a report is called if
the report has not been assigned a report category.
Parameters and Options for Report Categories of the LDB PNP and PNPCE
Parameters and Options in Screen Area General Data
If you activate this parameter, you can only enter data on the data
selection period if you use reports that have been assigned. The
same date entries are then used for the person selection as for the
date selection.
o Matchcode allowed
If you activate this parameter, you have use of a Matchcode
pushbutton (search help) if you use reports that have been assigned.
This pushbutton enables you to perform the person selection.
o Sort allowed
If you activate this parameter, you have use of a Sort pushbutton if
you use report that have been assigned. This pushbutton enables you
to define a sort order before you execute the report.
o Organizational structure allowed
If you activate this parameter, you have use of an Org.Structure
pushbutton if you use reports that have been assigned. This
pushbutton enables you to perform the person selection.
Note:
For more information about these options, see the online
documentation under this path:
SAP Library -> Human Resources -> Reporting in Human Resources
Management -> Standard HR Reports -> Report Selection Screen in
Human Resources Management.
Parameters and Options in Screen Areas Data Selection Period/Person
Selection Period/Payroll Area/Period/Year
o Options for data selection period and person selection period (key
date and so on)
Here you define which options for date and person selection are
available for reports that have been assigned.
o Options for payroll area/period/year
Here you define which options for selection using payroll
area/period/year are available for reports that have been assigned.
Parameters and Options in Screen Area Selection View
o Type/Name
This parameter enables you to use selection views to define report
categories. You use the selection view selected here to determine
which fields are available in the Dynamic Selectionsy.
Note:
You create selection views for the PNP and PNPCE logical databases
in the Object Navigator (SE80):
1. Start the Object Navigator (SE80)
2. Choose Workbench -> Edit Object.
3. Choose the More... tab page and the Selection view on this tab
page.
4. Choose Create.
5. In the Create Selection View dialog box, choose the For any
tables option.
6. In the Name of view field, enter a name for your selection view.
7. In the Tables dialog box, enter the name of the table from which
you want to use fields.
Note:
When you enter the table name, observe the naming convention in
Personnel Administration:
Infotype number: nnnn -> table name: PAnnnn
8. Choose Continue.
9. In the Functional groups area, define functional groups by
assigning a name and a number.
10. Assign fields from the selected tables to the functional groups
by entering the number of the desired functional group in front of
each field.
11. Save your entries.
For more information about adjusting the dynamic selections using
your own selection views, see the online documentation under the
following menu path:
SAP Library -> Human Resources -> Reporting in Human Resources
Management -> HR Standard Reports -> Report Selection Screen in
Human Resources Management -> Enhancing the Selection Screen -
Dynamic Selections.
If you do not want to offer dynamic selections, make the following
settings:
- LDB PNP: In the Selection view field, enter PNP_NO_FREE_SEL.
- LDB PNPCE: Leave the Selection view field empty.
Parameters and Options in Screen Area Data Selection Period/Person
Selection Period/Payroll Area/Period/Year
o Available input parameters, date or period entry (today, key date,
all, and so on), and standard value.
Using the Standard value option, you define which of the selected
options is shown.
Parameters and Options in Screen Area CE Selection Fields
o CE selection fields (external person ID, grouping reason, grouping
value)
Using the options in this area, you define whether the external
person Id, grouping reason, or grouping value are available on the
selection screen.
Note:
These parameters are only relevant for you if you implement
Concurrent Employment (see also note 517071).
Parameters and Options in Screen Area Selection view
o Dynamic selections as dialog box
If this switch is set, you can call the dynamic selections as a
dialog box.
o Dynamic selections active
If this switch is set, the dynamic selections of the logical
database are active at the start of the report.
Note that the following combinations are possible for the last two
options mentioned:
Dyn.Sel. as dialog box/Dyn.Sel. active: inactive/inactive
Dyn.Sel. as dialog box/Dyn.Sel. active: inactive/active
Dyn.Sel. as dialog box/Dyn.Sel. active: active/inactive
Activities
1. Choose Edit -> New entries.
2. Enter an abbreviation and a long text for the report category.
The customer name range for report categories is 0-9.
3. Select the For the PNPCE logical database checkbox, if you want to
create a report category for a program or for queries of the PNPCE
logical database.
4. In the General Data screen area, choose the desired options.
If you want to use selection IDs, you must have first created and
grouped selection Ids. The IMG path to do this is given in the
parameter description section.
5. In the Data selection period/person selection period or Selection
period screen area, choose the desired options.
6. In the Selection view screen area, choose the desired options.
7. In the CE selection fields screen area, choose the desired (only
possible for report categories of the LDB PNPCE).
8. Save your entries.
9. Choose the subactivity Permitted selection criteria.
10. Choose Edit -> New entries.
11. In the Select option field, use the input help to select each field
that should be available on the selection screen.
12. Select the checkbox in the 1.page column, if you want this selection
field to be available directly when you call the selection screen.
Further notes
13. If you want to copy entries, you still have to enter the selection
parameters again in the subsequent screen.
o If you create the report category '000000000', a selection screen is
generated according to report category '00000000'for all reports for
which a report category has not explicitly been assigned.
Assign Report Categories
In this step, you assign a report category to your reports.
Example
You have created your own report, for example ZPCTEST1, and would like
it to have the selection screen that corresponds to that of the
evaluation report for Payroll, which is assigned to report category
'__M00001'.
Assign report category '__M00001' to the report.
Requirements
You must have defined the Report Categories.
Standard settings
SAP Standard Reports:
In the standard system, reports are assigned a report category. If you
want to override these assignments, perform the activities described
here. If you want to assign report categories to standard reports using
SE38, this represents a modification.
Customer-Specific Reports:
For reports you have developed yourself, you can either assign report
categories by performing the activities described here or directly in SE38.
Recommendation
Only assign a report category if you have created your own reports or if
the selection screens in the standard system do not meet your
requirements.
Activities
1. Choose Edit -> New entries.
2. Perform the required assignment using the Program name and Report
category fields.
3. Save your entries.
reward if helpful
regards,
madhumitha
Maybe you are looking for
-
Side-by-side 2 monitor configuration changing to top-to-bottom
Hello all, I am at work and I am running an HP PC on Windows 7 with 2 monitors that are sitting side-by-side physically. The models are: NEC EA243WM, and HP ZR2440w Both monitors connect to the same video card inside the HP PC using DisplayPort cable
-
I try to buy drake new album but when I click on it a blank page appear and I can't buy it what happen?
-
How do I get Premiere Elements to work?
Have purchased Photoshop/Premiere Elements combo package in box. Have serial numbers for both. Premier's doesn't work. (Photoshop is fine.) Have tried to download Premiere trial and access with my serial number. Download assistant only offers Premier
-
This one appeared in 10.5.6 and I was surprised when it was still there in 10.5.7. When I right-click on a file in Finder, and select "More", where the "Send File To Device" option used to be there is instead "kSendFileToDevice" - looks like somebody
-
Function module RH_GET_MANAGER_ASSIGNMENT in MSS, HR Structural auth
Hi, - Is function module RH_GET_MANAGER_ASSIGNMENT only valid when a personnel user is flagged as 'chief position' in HR Org model ? As this function module uses MANASS evaluation path and A012 (Manages...) as relationship, can it be used without men