Bypassing Buffer
What is the advantage of using "Bypassing Buffer" in select statement ?
Message was edited by:
tangirala sriram
Hi
We have 3 types of buffering
There are the following types of buffering:
o single-record buffering
o generic area buffering
o full buffering
Single-record buffering should be selected when :
o For large tables where there are frequent single-record accesses (using SELECT SINGLE ...). The size of the records being accessed should be between 100-200 KB.
o For comparatively small tables for which the access range is large, it is normally advisable to opt for full buffering. Only one database access is required to load such a table for full buffering,
while single-record buffering calls for a very large number of table accesses.
And also check this matter.
Single-record buffering: Only the records of a table that are really accessed are loaded into the buffer
Single-record buffering should be used particularly for large tables where only a few records are accessed with SELECT SINGLE. The size of the records being accessed should be between 100 and 200 KB.
Full buffering is usually more suitable for smaller tables that are accessed frequently. This is because only one database access is necessary to load such a table with full buffering, whereas several database accesses are necessary for single-record buffering.
Check this link :
http://help.sap.com/saphelp_nw04/helpdata/en/f7/e4c5a8a84a11d194eb00a0c929b3c3/content.htm
reward if useful
regards
Anji
Similar Messages
-
Time execution using bypassing buffer
Hi!
I´m testing a performance of program. When i logon in system, I enter in SE30 and execute my program. In one select return to me 47.669.083 milisec. This select has BYPASSING BUFFER clause.
When i execute this program again in SE30, this return to me 5.452.061 milisec. in same select.
Why this happen? BYPASSING BUFFER doesn´t work?As mentioned by Thomas, the BYPASSING BUFFER addition avoids the usage of the SAP application server buffer always reading from the database.
The database itself has its own buffer (data cache) which is used to operate on data blocks. During the processing of a SELECT statement all involved data blocks are read from disk and placed into the buffer if they are not already there. Other statements will displace blocks from cache following simplier or more complex LRU-algorythms. If you execute your statement for the second time with a small delay, there is a high chance that many blocks are still in DB cache and do not have to be read from disk. That's why your second execution is much faster.
But if you wait for minutes/hours before executing the statement again, the corresponding blocks will be displaced from the cache and the next execution will be long again (due to the disk accesses). -
Reset or Bypass SQL Buffer ABAP Program
Hi,
How to bypass or reset the use of the buffer table in an ABAP program with the purpose of evaluating their performance access. I can not change the program because it is in production.
Thanx.
DiovaniHi ,
I am giving you the SAP standrad help comments here as prescriblely :
FROM clause
Specifies the database tables from which the data in the selection in the SELECT clause is to be read.
Syntax
... FROM [<tab> [INNER]|LEFT [OUTER] JOIN] <dbtab> [AS <alias>]
[ON <cond>]
[CLIENT SPECIFIED]
[BYPASSING BUFFER]
[UP TO <n> ROWS]
You can read a single table <dbtab> or more than one table, using inner and outer joins to link tables with conditions <cond>, where <tab> is a single table or itself a join condition. You can specify individual database tables either statically or dynamically, and you can replace their names with an alternative <alias>. You can bypass automatic client handling with the CLIENT SPECIFIED addition, and SAP buffering with BYPASSING BUFFER. You can also restrict the number of lines read from the table using the UP TO <n> ROWS addition.
For More Information please see this link : using keyword in find "BYPASSING BUFFER"
Link: [http://help.sap.com/saphelp_46c/helpdata/en/87/56d00722c011d2954a0000e8353423/frameset.htm]
Regards, -
When it is beter to buffer the table
hi
when it is beter to buffer the tableHi
<b>Table buffering</b>
Advantages of buffering
Concept of buffering
Buffering types
Buffer synchronization
<b>Database access using Buffer concept</b>
Buffering allows you to access data quicker by letting you
access it from the application server instead of the database.
<b>Advantages of buffering</b>
Table buffering increases the performance when the records of the table are read.
As records of a buffered table are read directly from the local buffer of the application server on which the accessing transaction is running, time required to access data is greatly reduced. The access improves by a factor of 10 to 100 depending on the structure of the table and on the exact system configuration.
If the storage requirements in the buffer increase due to further data, the data that has not been accessed for the longest time is displaced. This displacement takes place asynchronously at certain times which are defined dynamically based on the buffer accesses. Data is only displaced if the free space in the buffer is less than a predefined value or the quality of the access is not satisfactory at this time.
Entering $TAB in the command field resets the table buffers on the corresponding application server. Only use this command if there are inconsistencies in the buffer. In large systems, it can take several hours to fill the buffers. The performance is considerably reduced during this time.
<b>Concept of buffering</b>
The R/3 System manages and synchronizes the buffers on the individual application servers. If an application program accesses data of a table, the database interfaces determines whether this data lies in the buffer of the application server. If this is the case, the data is read directly from the buffer. If the data is not in the buffer of the application server, it is read from the database and loaded into the buffer. The buffer can therefore satisfy the next access to this data.
The buffering type determines which records of the table are loaded into the buffer of the application server when a record of the table is accessed. There are three different buffering types.
With full buffering, all the table records are loaded into the buffer when one record of the table is accessed.
With generic buffering, all the records whose left-justified part of the key is the same are loaded into the buffer when a table record is accessed.
With single-record buffering, only the record that was accessed is loaded into the buffer.
<b>Buffering types</b>
With full buffering, the table is either completely or not at all in the buffer. When a record of the table is accessed, all the records of the table are loaded into the buffer.
When you decide whether a table should be fully buffered, you must take the table size, the number of read accesses and the number of write accesses into consideration. The smaller the table is, the more frequently it is read and the less frequently it is written, the better it is to fully buffer the table.
Full buffering is also advisable for tables having frequent accesses to records that do not exist. Since all the records of the table reside in the buffer, it is already clear in the buffer whether or not a record exists.
The data records are stored in the buffer sorted by table key. When you access the data with SELECT, only fields up to the last specified key field can be used for the access. The left-justified part of the key should therefore be as large as possible for such accesses. For example, if the first key field is not defined, the entire table is scanned in the buffer. Under these circumstances, a direct access to the database could be more efficient if there is a suitable secondary index there.
With generic buffering, all the records whose generic key fields agree with this record are loaded into the buffer when one record of the table is accessed. The generic key is a left-justified part of the primary key of the table that must be defined when the buffering type is selected. The generic key should be selected so that the generic areas are not too small, which would result in too many generic areas. If there are only a few records for each generic area, full buffering is usually preferable for the table. If you choose too large a generic key, too much data will be invalidated if there are changes to table entries, which would have a negative effect on the performance.
A table should be generically buffered if only certain generic areas of the table are usually needed for processing.
Client-dependent, fully buffered tables are automatically generically buffered. The client field is the generic key. It is assumed that not all of the clients are being processed at the same time on one application server. Language-dependent tables are a further example of generic buffering. The generic key includes all the key fields up to and including the language field.
The generic areas are managed in the buffer as independent objects. The generic areas are managed analogously to fully buffered tables. You should therefore also read the information about full buffering.
Single-record buffering is recommended particularly for large tables in which only a few records are accessed repeatedly with SELECT SINGLE. All the accesses to the table that do not use SELECT SINGLE bypass the buffer and directly access the database.
If you access a record that was not yet buffered using SELECT SINGLE, there is a database access to load the record. If the table does not contain a record with the specified key, this record is recorded in the buffer as non-existent. This prevents a further database access if you make another access with the same key
You only need one database access to load a table with full buffering, but you need several database accesses with single-record buffering. Full buffering is therefore generally preferable for small tables that are frequently accessed.
<b>Synchronizing local buffers</b>
The table buffers reside locally on each application server in the system. However, this makes it necessary for the buffer administration to transfer all changes made to buffered objects to all the application servers of the system.
If a buffered table is modified, it is updated synchronously in the buffer of the application server from which the change was made. The buffers of the whole network, that is, the buffers of all the other application servers, are synchronized with an asynchronous procedure.
Entries are written in a central database table (DDLOG) after each table modification that could be buffered. Each application server reads these entries at fixed time intervals.
If entries are found that show a change to the data buffered by this server, this data is invalidated. If this data is accessed again, it is read directly from the database. In such an access, the table can then be loaded to the buffer again.
<b>Using buffered tables improves the performance considerably.</b>
Bypassing the buffer increases the network considerably
SELECT SINGLE * FROM T100 INTO T100_WA
BYPASSING BUFFER
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
The above mentioned code can be more optimized by using the following code
SELECT SINGLE * FROM T100 INTO T100_WA
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
<b>Optimizing the load of the database</b>
<b>Using table buffering</b>
Using buffered tables improves the performance considerably. Note that in some cases a statement can not be used with a buffered table, so when using these statements the buffer will be bypassed. These statements are:
Select DISTINCT
ORDER BY / GROUP BY / HAVING clause
Any WHERE clause that contains a sub query or IS NULL expression
JOIN s
A SELECT... FOR UPDATE
If you wan t to explicitly bypass the buffer, use the BYPASS BUFFER addition to the SELECT clause.
<b>Reward if useful</b> -
Hi all,
I am using a select statement like this.
select min ( value ) from zemployee into v_value. (There is no where clause)
In SLIN it is telling that this statement is bypassing the buffer. In my table's technical settings I made the table as Fully buffered (This is my requirement i should use this).
Can anybody tell in which way i can remove this error.
Thanks,
Mungala.i think you are getting this error due to use of aggregate fn min. Not for the where clause . just see the abap help documentation.
A SELECT statement on a table for which SAP buffering has been declared in the ABAP Dictionary usually reads data from the SAP buffer without accessing the database. This does not apply when you use:
- JOIN in the FROM clause or subqueries in the WHERE clause, for example,
- SELECT SINGLE FOR UPDATE or
- SELECT DISTINCT in the SELECT clause ,
- BYPASSING BUFFER in the FROM clause,
- ORDER BY f1 ... fn in the ORDER BY clause,
- <b>Aggregate functions in the SELECT clause,</b>
- When you use IS [NOT] NULL in the WHERE condition,
or when the table has generic buffering and the appropriate section of the key is not specified in the WHERE condition.
i think better to take all the values in an int table(if your table does not contain lots of records) and sort the itab by value and read the first line.
select value into table itab from zemployee.
sort itab.
read itab index 1.
write : / itab-value.
regards
shiba dutta -
REPORT ZCHECK .
*& TABLES/VIEWS
TABLES: mseg,
ser03,
objk,
zprealert,
vbrk,
vbrp,
zinftsalecntrl,
vbfa.
*& VARIABLES/STRUCTURES/INTERNAL TABLES
DATA: BEGIN OF it_mseg OCCURS 0,
mblnr LIKE mseg-mblnr,
mjahr LIKE mseg-mjahr,
zeile LIKE mseg-zeile,
END OF it_mseg.
DATA: BEGIN OF it_ser03 OCCURS 0,
obknr LIKE ser03-obknr,
mblnr LIKE ser03-mblnr,
zeile LIKE ser03-zeile,
bwart LIKE ser03-bwart,
charge LIKE ser03-charge,
datum LIKE ser03-datum,
werk LIKE ser03-werk,
lagerort LIKE ser03-lagerort,
END OF it_ser03.
DATA: BEGIN OF it_objk OCCURS 0,
obknr LIKE objk-obknr,
sernr LIKE objk-sernr,
matnr LIKE objk-matnr,
END OF it_objk.
DATA: BEGIN OF it_alert OCCURS 0,
rsnno LIKE zprealert-rsnno,
***kdamle-27102004-start
status LIKE zprealert-status,
***kdamle-27102004-end
END OF it_alert.
DATA: BEGIN OF it_vbrk OCCURS 0,
vbeln LIKE vbrk-vbeln,
fkdat LIKE vbrk-fkdat,
fkart LIKE vbrk-fkart,
vkorg LIKE vbrk-vkorg,
vtweg LIKE vbrk-vtweg,
spart LIKE vbrk-spart,
fksto LIKE vbrk-fksto,
END OF it_vbrk.
DATA: BEGIN OF it_vbrp OCCURS 0,
vbeln LIKE vbrp-vbeln,
matnr LIKE vbrp-matnr,
charg LIKE vbrp-charg,
END OF it_vbrp.
DATA: BEGIN OF it_inftsale OCCURS 0,
delivery LIKE zinftsalecntrl-delivery,
billingdoc LIKE zinftsalecntrl-billingdoc,
END OF it_inftsale.
DATA: BEGIN OF it_vbfa OCCURS 0,
vbelv LIKE vbfa-vbelv,
vbeln LIKE vbfa-vbeln,
END OF it_vbfa.
DATA: BEGIN OF it_vbfa_1 OCCURS 0,
vbelv LIKE vbfa-vbelv,
vbeln LIKE vbfa-vbeln,
vbtyp_v LIKE vbfa-vbtyp_v,
***kdamle-19052005-start
vbtyp_n LIKE vbfa-vbtyp_n,
***kdamle-19052005-end
END OF it_vbfa_1.
DATA: BEGIN OF it_vbfa_2 OCCURS 0,
vbelv LIKE vbfa-vbelv,
vbeln LIKE vbfa-vbeln,
vbtyp_n LIKE vbfa-vbtyp_n,
***kdamle-19052005-start
plmin LIKE vbfa-plmin,
***kdamle-19052005-end
END OF it_vbfa_2.
DATA: BEGIN OF it_out OCCURS 0,
rsnno LIKE zprealert-rsnno,
matnr LIKE objk-matnr,
charg LIKE ser03-charge,
bwart LIKE ser03-bwart,
mblnr LIKE ser03-mblnr,
vbeln LIKE vbrk-vbeln,
datum LIKE ser03-datum,
zeile LIKE ser03-zeile,
werk LIKE ser03-werk,
lagerort LIKE ser03-lagerort,
fkdat LIKE vbrk-fkdat,
fkart LIKE vbrk-fkart,
vkorg LIKE vbrk-vkorg,
vtweg LIKE vbrk-vtweg,
spart LIKE vbrk-spart,
***kdamle-27102004-start
status LIKE zprealert-status,
***kdamle-27102004-end
END OF it_out.
***kdamle-05.10.2004-start
*display table as per o/p file structure
DATA: BEGIN OF it_disp OCCURS 0,
rsnno LIKE zprealert-rsnno,
matnr LIKE objk-matnr,
charg LIKE ser03-charge,
bwart LIKE ser03-bwart,
mblnr LIKE ser03-mblnr,
zeile LIKE ser03-zeile,
werk LIKE ser03-werk,
lagerort LIKE ser03-lagerort,
datum LIKE ser03-datum,
vbeln LIKE vbrk-vbeln,
fkdat LIKE vbrk-fkdat,
fkart LIKE vbrk-fkart,
vkorg LIKE vbrk-vkorg,
vtweg LIKE vbrk-vtweg,
spart LIKE vbrk-spart,
END OF it_disp.
DATA : BEGIN OF it_formatted OCCURS 0,
record(140),
END OF it_formatted.
DATA: BEGIN OF it_dwn OCCURS 0,
text1(15),
text2(15),
text3(15),
text4(15),
text5(15),
END OF it_dwn.
*This table will contain uploaded mblnr or vbeln data
*in foreground, it will contain either mblnr or vbeln.
*in backround, it will first contain data uploaded from users machine
*and loaded on the application server.
*Then it is erased and filled with data which is read from application
*server since data from users machine cannot be read in background
DATA: BEGIN OF it_up OCCURS 0,
***kdamle-24052005-start
*positions swapped for vbeln and mblnr
vbeln LIKE vbrk-vbeln,
mblnr LIKE ser03-mblnr,
***kdamle-24052005-end
END OF it_up.
***kdamle-05.10.2004-end
DATA : it_alv LIKE STANDARD TABLE OF it_out.
DATA: cntnr TYPE REF TO cl_gui_custom_container,
grid TYPE REF TO cl_gui_alv_grid.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
s_fieldcat LIKE LINE OF gt_fieldcat,
alv_layout TYPE slis_layout_alv.
DATA: ls_alv_event TYPE slis_alv_event,
i_alv_event TYPE slis_t_event.
DATA: gt_list_top_of_page TYPE slis_t_listheader,
infotxt TYPE slis_listheader-info.
DATA: g_variant LIKE disvariant VALUE 'ZPPSALE',
gx_variant LIKE disvariant.
DATA: lin TYPE i.
DATA: wkey LIKE vbfa-vbtyp_v.
DATA: v_datum LIKE sy-datum,
v_uzeit LIKE sy-uzeit.
***kdamle-05.10.2004-start
CONSTANTS: hex(1) TYPE x VALUE '09', "tab
app_path TYPE rlgrap-filename
VALUE '/bdcusers/mmdata/'.
DATA: fnam LIKE rlgrap-filename,
l_path(100),
flag(1),
txt(500).
DATA: fnam1 LIKE rlgrap-filename.
DATA : BEGIN OF iline OCCURS 0,
line(4000),
END OF iline.
DATA : BEGIN OF i_tty OCCURS 0,
line(300),
END OF i_tty.
*required for pushbutton info
DATA: g_answer TYPE c,
g_lines_tab TYPE popuptext OCCURS 0
WITH HEADER LINE.
DATA: v_flagmtl,
v_flaginv.
***kdamle-05.10.2004-end
***kdamle-08122004-start
DATA: v_msgtxt(150).
***kdamle-08122004-end
*& SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbrk-vbeln.
SELECT-OPTIONS: s_mblnr FOR ser03-mblnr.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN SKIP 1.
***kdamle-05.10.2004-start
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-007.
PARAMETERS: p_ufname LIKE rlgrap-filename.
*pushbuttons to give info and download file format
SELECTION-SCREEN: PUSHBUTTON /1(7) help USER-COMMAND info,
PUSHBUTTON 33(25) down USER-COMMAND down.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN BEGIN OF BLOCK blk3 WITH FRAME TITLE text-002.
PARAMETERS: S_VAR LIKE DISVARIANT-VARIANT.
*SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_r1 RADIOBUTTON GROUP rbg1 DEFAULT 'X' USER-COMMAND ucomm,
s_var LIKE disvariant-variant MODIF ID pr1.
PARAMETERS: p_r2 RADIOBUTTON GROUP rbg1,
p_fname LIKE rlgrap-filename MODIF ID pr2.
PARAMETERS: p_r3 RADIOBUTTON GROUP rbg1,
p_lfname LIKE rlgrap-filename MODIF ID pr3,
p_fname1 LIKE rlgrap-filename MODIF ID pr4.
SELECTION-SCREEN END OF BLOCK blk3.
SELECTION-SCREEN BEGIN OF BLOCK blk4 WITH FRAME TITLE text-003.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(75) text-004 MODIF ID pr5.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(75) text-005 MODIF ID pr6.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(75) text-006 MODIF ID pr7.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK blk4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM get_file.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname1.
PERFORM get_lfile.
***kdamle-05.10.2004-start
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ufname.
PERFORM get_ufile.
***kdamle-05.10.2004-end
*& AT SELECTION SCREEN OUTPUT
***kdamle-05.10.2004-start
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF p_r1 = 'X'.
IF screen-group1 = 'PR1'.
screen-input = '1'.
screen-output = '1'.
screen-invisible = '0'.
ELSEIF screen-group1 = 'PR2'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR3'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR4'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR5'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR6'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR7'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ENDIF.
ELSEIF p_r2 = 'X'.
IF screen-group1 = 'PR1'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR2'.
screen-input = '1'.
screen-output = '1'.
screen-invisible = '0'.
ELSEIF screen-group1 = 'PR3'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR4'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR5'.
screen-input = '1'.
screen-output = '1'.
screen-invisible = '0'.
ELSEIF screen-group1 = 'PR6'.
screen-input = '1'.
screen-output = '1'.
screen-invisible = '0'.
ELSEIF screen-group1 = 'PR7'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ENDIF.
ELSEIF p_r3 = 'X'.
IF screen-group1 = 'PR1'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR2'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR3'.
screen-input = '1'.
screen-output = '1'.
screen-invisible = '0'.
ELSEIF screen-group1 = 'PR4'.
screen-input = '1'.
screen-output = '1'.
screen-invisible = '0'.
ELSEIF screen-group1 = 'PR5'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR6'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
ELSEIF screen-group1 = 'PR7'.
screen-input = '1'.
screen-output = '1'.
screen-invisible = '0'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
*& INITIALIZATION
INITIALIZATION.
MOVE '@0S@' TO help.
MOVE '@49@ Upload File Format' TO down.
PERFORM fill_infotext.
***kdamle-05.10.2004-end
*& AT SELECTION SCREEN
AT SELECTION-SCREEN.
IF sy-ucomm = 'ONLI'
***kdamle-08122004-start
AND p_r3 NE 'X'.
***kdamle-08122004-end
IF NOT s_vbeln IS INITIAL
AND NOT s_mblnr IS INITIAL
AND NOT p_ufname IS INITIAL.
MESSAGE e000(yw) WITH
'Enter Either Mat. Doc. Or Inv. No. Or Upload File'.
ELSEIF s_vbeln IS INITIAL
AND s_mblnr IS INITIAL
AND p_ufname IS INITIAL.
MESSAGE e000(yw) WITH
'Enter Either Mat. Doc. Or Inv. No. Or Upload File'.
ENDIF.
IF NOT s_mblnr IS INITIAL AND NOT p_ufname IS INITIAL.
MESSAGE e000(yw) WITH
'Enter Either Material Doc. Or Upload file name'.
ELSEIF NOT s_vbeln IS INITIAL AND NOT p_ufname IS INITIAL.
MESSAGE e000(yw) WITH
'Enter Either Invoice No. Or Upload file name'.
ENDIF.
ENDIF.
***kdamle-05.10.2004-start
IF sscrfields-ucomm = 'INFO'.
IF sy-ucomm = 'INFO'.
CALL FUNCTION 'DD_POPUP_WITH_INFOTEXT'
EXPORTING
titel = 'Text File Format'
start_column = 10
start_row = 12
end_column = 85
end_row = 22
infoflag = ' '
IMPORTING
answer = g_answer
TABLES
lines = g_lines_tab.
ELSEIF sscrfields-ucomm = 'DOWN'.
ELSEIF sy-ucomm = 'DOWN'.
PERFORM fill_idwn.
ENDIF.
IF sy-ucomm = 'ONLI'.
IF p_r2 = 'X'.
IF p_fname IS INITIAL.
SET CURSOR FIELD 'P_FNAME'.
MESSAGE e000(yw) WITH 'Please Enter Download File Name'.
ENDIF.
ENDIF.
IF p_r3 = 'X'.
IF p_lfname = space.
SET CURSOR FIELD 'P_LFNAME'.
MESSAGE e000(yw) WITH 'FileName on Server cannot be empty'.
ENDIF.
IF p_fname1 = space.
SET CURSOR FIELD 'P_FNAME1'.
MESSAGE e000(yw) WITH 'Local FileName cannot be empty'.
ENDIF.
ENDIF.
ELSEIF sy-ucomm = 'SJOB'.
IF p_r2 = 'X'.
IF p_fname IS INITIAL.
SET CURSOR FIELD 'P_FNAME'.
MESSAGE e000(yw) WITH 'Please Enter Download File Name'.
ENDIF.
IF p_fname CA ':' OR p_fname CA '/' OR p_fname CA '\'.
SET CURSOR FIELD 'P_FNAME'.
MESSAGE e000(yw) WITH 'Enter only File Name for Background job'.
ENDIF.
ENDIF.
IF p_r3 = 'X'.
MESSAGE e000(yw) WITH
'This option cannot be executed in Background mode'.
ENDIF.
ENDIF.
IF p_fname CA '*'.
MESSAGE e000(yw) WITH '* (star) not allowed in Filename'.
ENDIF.
IF sy-ucomm = 'ONLI' AND NOT p_ufname IS INITIAL.
*in foreground processing directly read input file from users machine
PERFORM upload_file TABLES it_up.
ELSEIF sy-ucomm = 'SJOB' AND NOT p_ufname IS INITIAL.
*download the file read input file from users machine onto the
*application server first as it cannot be read during background
*processing
PERFORM download_to_app_server.
ENDIF.
***kdamle-05.10.2004-end
*& AT SELECTION SCREEN ON VALUE REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_var.
PERFORM select_variant.
*& START OF SELECTION
START-OF-SELECTION.
***kdamle-05.10.2004-start
IF sy-batch = 'X'.
CLEAR it_up.
CLEAR it_up[].
PERFORM upload_app_server.
READ TABLE it_up INDEX 1.
ENDIF.
IF p_r3 = 'X'.
PERFORM create_local_file.
EXIT.
ENDIF.
IF NOT s_mblnr IS INITIAL.
SELECT mblnr mjahr zeile FROM mseg
INTO CORRESPONDING FIELDS OF TABLE it_mseg
WHERE mblnr IN s_mblnr
AND xauto NE 'X'.
IF sy-subrc NE 0.
MESSAGE s000(yw) WITH 'No Data Found'.
STOP.
ENDIF.
PERFORM get_data_from_mtl.
ELSEIF NOT p_ufname IS INITIAL AND NOT it_up-mblnr IS INITIAL.
v_flagmtl = 'X'.
IF NOT it_up[] IS INITIAL.
SORT it_up BY mblnr.
SELECT mblnr mjahr zeile FROM mseg
INTO CORRESPONDING FIELDS OF TABLE it_mseg
FOR ALL ENTRIES IN it_up
WHERE mblnr = it_up-mblnr
AND xauto NE 'X'.
ENDIF.
PERFORM get_data_from_mtl.
ELSEIF NOT s_vbeln IS INITIAL.
SELECT vbeln fkdat fkart vkorg vtweg spart FROM vbrk
INTO CORRESPONDING FIELDS OF TABLE it_vbrk
WHERE vbeln IN s_vbeln.
IF sy-subrc NE 0.
MESSAGE s000(yw) WITH 'No Data Found'.
STOP.
ENDIF.
PERFORM get_data_from_inv.
ELSEIF NOT p_ufname IS INITIAL AND NOT it_up-vbeln IS INITIAL.
v_flaginv = 'X'.
IF NOT it_up[] IS INITIAL.
SORT it_up BY vbeln.
SELECT vbeln fkdat fkart vkorg vtweg spart FROM vbrk
INTO CORRESPONDING FIELDS OF TABLE it_vbrk
FOR ALL ENTRIES IN it_up
WHERE vbeln = it_up-vbeln.
ENDIF.
PERFORM get_data_from_inv.
ENDIF.
***kdamle-05.10.2004-end
*& END OF SELECTION
END-OF-SELECTION.
***kdamle-05.10.2004-start
IF NOT s_mblnr IS INITIAL OR v_flagmtl = 'X'.
***kdamle-05.10.2004-end
CHECK NOT it_mseg[] IS INITIAL.
PERFORM populate_output_1.
***kdamle-05.10.2004-start
ELSEIF NOT s_vbeln IS INITIAL OR v_flaginv = 'X'.
***kdamle-05.10.2004-end
PERFORM populate_output_2.
ENDIF.
***kdamle-05.10.2004-start
IF p_r1 = 'X'.
***kdamle-05.10.2004-end
DESCRIBE TABLE it_out LINES lin.
IF lin > 0.
PERFORM create_f_catalog_0100.
PERFORM set_defaults_grid.
SET TITLEBAR 'DOC' WITH '[count ='
lin
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZDOC_SRLST'
is_layout = alv_layout
it_fieldcat = gt_fieldcat
i_default = 'X'
i_save = 'A'
is_variant = g_variant
TABLES
t_outtab = it_out.
ELSE.
MESSAGE s000(yw) WITH 'No Data Selected'.
ENDIF.
***kdamle-05.10.2004-start
ELSEIF p_r2 = 'X'.
PERFORM create_disp_table.
IF sy-batch = space.
PERFORM online_download.
ELSE.
PERFORM download_data.
ENDIF.
ENDIF.
***kdamle-05.10.2004-end
*& Form POPULATE_OUTPUT_1
FORM populate_output_1.
SORT IT_SER03 BY MBLNR.
SORT it_vbfa_1 BY vbeln.
SORT it_vbfa_2 BY vbelv.
SORT it_vbrk BY vbeln.
SORT it_objk BY obknr.
SORT it_alert BY rsnno.
LOOP AT it_ser03.
it_out-charg = it_ser03-charge.
it_out-bwart = it_ser03-bwart.
it_out-zeile = it_ser03-zeile.
it_out-mblnr = it_ser03-mblnr.
it_out-datum = it_ser03-datum.
it_out-werk = it_ser03-werk.
it_out-lagerort = it_ser03-lagerort.
IF it_ser03-bwart = '601' OR it_ser03-bwart = '602'.
wkey = 'J'.
ELSE.
wkey = 'T'.
ENDIF.
CLEAR it_vbfa_1.
READ TABLE it_vbfa_1
WITH KEY vbeln = it_ser03-mblnr
vbtyp_v = wkey.
IF sy-subrc EQ 0.
IF it_ser03-bwart = '601' OR it_ser03-bwart = '602'.
wkey = 'M'.
ELSE.
wkey = 'O'.
ENDIF.
CLEAR it_vbfa_2.
READ TABLE it_vbfa_2
WITH KEY vbelv = it_vbfa_1-vbelv
vbtyp_n = wkey.
IF sy-subrc EQ 0.
CLEAR it_vbrk.
READ TABLE it_vbrk
WITH KEY vbeln = it_vbfa_2-vbeln
BINARY SEARCH.
it_out-vbeln = it_vbrk-vbeln.
it_out-fkdat = it_vbrk-fkdat.
it_out-fkart = it_vbrk-fkart.
it_out-vkorg = it_vbrk-vkorg.
it_out-vtweg = it_vbrk-vtweg.
it_out-spart = it_vbrk-spart.
ENDIF.
ENDIF.
READ TABLE it_objk
WITH KEY obknr = it_ser03-obknr
BINARY SEARCH.
IF sy-subrc EQ 0.
LOOP AT it_objk WHERE obknr = it_ser03-obknr.
it_out-matnr = it_objk-matnr.
READ TABLE it_alert
WITH KEY rsnno = it_objk-sernr
BINARY SEARCH.
IF sy-subrc EQ 0.
it_out-rsnno = it_alert-rsnno.
***kdamle-27102004-start
it_out-status = it_alert-status.
***kdamle-27102004-end
APPEND it_out.
CLEAR: it_alert, it_objk.
ELSE.
APPEND it_out.
CLEAR: it_objk.
ENDIF.
ENDLOOP.
ELSE.
APPEND it_out.
CLEAR: it_objk, it_ser03,
it_out.
ENDIF.
ENDLOOP.
REFRESH: it_ser03, it_objk, it_alert.
ENDFORM. " POPULATE_OUTPUT_1
*& Form POPULATE_OUTPUT_2
FORM populate_output_2.
SORT it_vbrp BY vbeln.
SORT it_vbfa_1 BY vbeln.
SORT it_vbfa_2 BY vbelv.
SORT it_ser03 BY mblnr.
SORT it_objk BY obknr.
SORT it_alert BY rsnno.
LOOP AT it_vbrk.
it_out-vbeln = it_vbrk-vbeln.
it_out-fkdat = it_vbrk-fkdat.
it_out-fkart = it_vbrk-fkart.
it_out-vkorg = it_vbrk-vkorg.
it_out-vtweg = it_vbrk-vtweg.
it_out-spart = it_vbrk-spart.
READ TABLE it_vbrp
WITH KEY vbeln = it_vbrk-vbeln.
***kdamle-19042005-start
it_out-charg = it_vbrp-charg.
it_out-matnr = it_vbrp-matnr.
***kdamle-19042005-end
READ TABLE it_vbfa_1
WITH KEY vbeln = it_vbrk-vbeln
BINARY SEARCH.
IF sy-subrc EQ 0.
LOOP AT it_vbfa_1 WHERE vbeln = it_vbrk-vbeln.
READ TABLE it_vbfa_2
WITH KEY vbelv = it_vbfa_1-vbelv
BINARY SEARCH.
IF sy-subrc EQ 0.
LOOP AT it_vbfa_2 WHERE vbelv = it_vbfa_1-vbelv.
READ TABLE it_ser03
WITH KEY mblnr = it_vbfa_2-vbeln
BINARY SEARCH.
IF sy-subrc EQ 0.
LOOP AT it_ser03 WHERE mblnr = it_vbfa_2-vbeln.
it_out-bwart = it_ser03-bwart.
it_out-zeile = it_ser03-zeile.
it_out-mblnr = it_ser03-mblnr.
it_out-datum = it_ser03-datum.
it_out-werk = it_ser03-werk.
it_out-lagerort = it_ser03-lagerort.
***kdamle-19042005-start
it_out-charg = it_ser03-charge.
***kdamle-19042005-end
READ TABLE it_objk
WITH KEY obknr = it_ser03-obknr
BINARY SEARCH.
IF sy-subrc EQ 0.
LOOP AT it_objk WHERE obknr = it_ser03-obknr.
***kdamle-19042005-start
it_out-matnr = it_objk-matnr.
***kdamle-19042005-end
READ TABLE it_alert
WITH KEY rsnno = it_objk-sernr
BINARY SEARCH.
IF sy-subrc EQ 0.
it_out-rsnno = it_alert-rsnno.
APPEND it_out.
CLEAR: it_alert, it_objk.
ELSE.
APPEND it_out.
CLEAR: it_objk.
ENDIF.
ENDLOOP.
ELSE.
APPEND it_out.
CLEAR: it_objk, it_ser03, it_out.
ENDIF.
ENDLOOP.
CLEAR: it_ser03, it_objk, it_alert.
ELSE.
APPEND it_out.
ENDIF.
ENDLOOP.
ELSE.
APPEND it_out.
ENDIF.
ENDLOOP.
ELSE.
APPEND it_out.
ENDIF.
ENDLOOP.
ENDFORM. " POPULATE_OUTPUT_2
*& FORM CREATE_F_CATALOG_0100
FORM create_f_catalog_0100.
REFRESH gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'RSNNO'.
s_fieldcat-ref_tabname = 'ZPREALERT'.
s_fieldcat-ref_fieldname = 'RSNNO'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'RSN No.'.
s_fieldcat-outputlen = '20'.
s_fieldcat-fix_column = 'X'.
s_fieldcat-key = 'X'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'MATNR'.
s_fieldcat-ref_tabname = 'OBJK'.
s_fieldcat-ref_fieldname = 'MATNR'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Material'.
s_fieldcat-outputlen = '20'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'CHARG'.
s_fieldcat-ref_tabname = 'SER03'.
s_fieldcat-ref_fieldname = 'CHARG'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Batch'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'BWART'.
s_fieldcat-ref_tabname = 'SER03'.
s_fieldcat-ref_fieldname = 'BWART'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Movement'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'MBLNR'.
s_fieldcat-ref_tabname = 'SER03'.
s_fieldcat-ref_fieldname = 'MBLNR'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Mat Doc'.
s_fieldcat-outputlen = '10'.
s_fieldcat-emphasize = 'X'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'ZEILE'.
s_fieldcat-ref_tabname = 'SER03'.
s_fieldcat-ref_fieldname = 'ZEILE'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Item'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'WERK'.
s_fieldcat-ref_tabname = 'SER03'.
s_fieldcat-ref_fieldname = 'WERK'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Plant'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'LAGERORT'.
s_fieldcat-ref_tabname = 'SER03'.
s_fieldcat-ref_fieldname = 'LAGERORT'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'SLoc'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'DATUM'.
s_fieldcat-ref_tabname = 'SER03'.
s_fieldcat-ref_fieldname = 'DATUM'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Doc Date'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'VBELN'.
s_fieldcat-ref_tabname = 'VBRK'.
s_fieldcat-ref_fieldname = 'VBELN'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Invoice'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'FKDAT'.
s_fieldcat-ref_tabname = 'VBRK'.
s_fieldcat-ref_fieldname = 'FKDAT'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Inv Date'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'FKART'.
s_fieldcat-ref_tabname = 'VBRK'.
s_fieldcat-ref_fieldname = 'FKART'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Inv Type'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'VKORG'.
s_fieldcat-ref_tabname = 'VBRK'.
s_fieldcat-ref_fieldname = 'VKORG'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'S.Org'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'VTWEG'.
s_fieldcat-ref_tabname = 'VBRK'.
s_fieldcat-ref_fieldname = 'VTWEG'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'D.Chnl'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-fieldname = 'SPART'.
s_fieldcat-ref_tabname = 'VBRK'.
s_fieldcat-ref_fieldname = 'SPART'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'Div'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
***kdamle-27102004-start
s_fieldcat-fieldname = 'STATUS'.
s_fieldcat-ref_tabname = 'ZPREALERT'.
s_fieldcat-ref_fieldname = 'STATUS'.
s_fieldcat-ddictxt = 'L'.
s_fieldcat-seltext_l = s_fieldcat-seltext_m = s_fieldcat-seltext_s =
'P Sts'.
s_fieldcat-outputlen = '10'.
s_fieldcat-tabname = 'IT_OUT'.
APPEND s_fieldcat TO gt_fieldcat.
CLEAR s_fieldcat.
***kdamle-27102004-end
ENDFORM.
*& Form SET_DEFAULTS_GRID
FORM set_defaults_grid.
alv_layout-colwidth_optimize = 'X'.
alv_layout-zebra = 'X'.
ENDFORM. " SET_DEFAULTS_GRID
*& Form SELECT_VARIANT
FORM select_variant.
DATA: g_exit(1) TYPE c,
g_save(1) TYPE c.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = 'A'
IMPORTING
es_variant = g_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc EQ 0.
s_var = g_variant-variant.
ELSE.
MESSAGE s000(yw) WITH 'No Variant Found'.
ENDIF.
ENDFORM. " SELECT_VARIANT
*& Form DISP_TOP_OF_PAGE
FORM disp_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM. " DISP_TOP_OF_PAGE
*& Form FILL_ALV_EVENTS
FORM fill_alv_events.
DATA: ls_line TYPE slis_listheader.
ls_alv_event-name = 'TOP_OF_PAGE'.
ls_alv_event-form = 'DISP_TOP_OF_PAGE'.
APPEND ls_alv_event TO i_alv_event.
CLEAR: ls_alv_event,
ls_line.
ls_line-typ = 'A'.
ls_line-info = infotxt.
APPEND ls_line TO gt_list_top_of_page.
ENDFORM. " FILL_ALV_EVENTS
*& Form GET_FILE
text
--> p1 text
<-- p2 text
FORM get_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = 'ZDOC_SRLST'
field_name = p_fname
mask = '.'
CHANGING
file_name = p_fname.
IF sy-subrc <> 0.
MESSAGE e000(yw) WITH 'Error Uploading File' p_fname.
ENDIF.
ENDFORM. " GET_FILE
*& Form GET_LFILE
text
--> p1 text
<-- p2 text
FORM get_lfile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = 'ZDOC_SRLST'
field_name = p_fname1
mask = '.'
CHANGING
file_name = p_fname1.
IF sy-subrc <> 0.
MESSAGE e000(yw) WITH 'Error Uploading File' p_fname1.
ENDIF.
ENDFORM. " GET_LFILE
*& Form CREATE_LOCAL_FILE
text
--> p1 text
<-- p2 text
FORM create_local_file.
IF p_lfname IS INITIAL OR p_fname1 IS INITIAL.
MESSAGE i000(yw) WITH 'File Name on Server and Local File Name '
' are mandatory.'.
STOP.
ENDIF.
CONCATENATE app_path p_lfname INTO l_path.
CONDENSE l_path NO-GAPS.
OPEN DATASET l_path FOR INPUT IN TEXT MODE.
IF sy-subrc NE 0.
MESSAGE i000(yw) WITH 'File' p_lfname 'does not exist'.
STOP.
ENDIF.
DO.
CLEAR : iline.
READ DATASET l_path INTO iline.
IF sy-subrc = 0.
APPEND iline.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET l_path.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
filename = p_fname1
filetype = 'DAT'
ITEM = ' '
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
SILENT = 'S'
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
ACT_FILENAME =
ACT_FILETYPE =
FILESIZE =
CANCEL =
TABLES
data_tab = iline
FIELDNAMES =
EXCEPTIONS
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
CUSTOMER_ERROR = 7
OTHERS = 8
IF sy-subrc EQ 0.
***kdamle-08122004-start
CONCATENATE 'File ' p_fname1
' Downloaded Successfully'
INTO v_msgtxt SEPARATED BY space.
MESSAGE s000(yw) WITH v_msgtxt+0(50)
v_msgtxt+50(50).
***kdamle-08122004-end
Delete processed file from App Server.
IF sy-subrc EQ 0.
CONCATENATE 'rm' l_path
INTO txt SEPARATED BY space.
CALL 'SYSTEM' ID 'COMMAND' FIELD txt
ID 'TAB' FIELD i_tty[].
ENDIF.
ENDIF.
ENDFORM. " CREATE_LOCAL_FILE
*& Form ONLINE_DOWNLOAD
text
--> p1 text
<-- p2 text
FORM online_download.
CALL FUNCTION 'WS_DOWNLOAD' "#nc
EXPORTING
filename = p_fname
filetype = 'ASC'
TABLES
data_tab = it_formatted.
IF sy-subrc EQ 0.
MESSAGE s016(yw) WITH 'File '
p_fname
' Downloaded Successfully'.
ELSE.
MESSAGE i000(yw) WITH 'Error Downloading File'
p_fname.
ENDIF.
ENDFORM. " ONLINE_DOWNLOAD
*& Form DOWNLOAD_DATA
text
--> p1 text
<-- p2 text
FORM download_data.
*TRANSFERRING THE DATA TO THE FILE ON THE APPLICATION SERVER
CONCATENATE app_path p_fname INTO fnam SEPARATED BY space.
CONDENSE fnam NO-GAPS.
IF fnam IS INITIAL.
MESSAGE e000(yw) WITH 'Please Enter Download File Name'.
ENDIF.
OPEN DATASET fnam FOR OUTPUT IN TEXT MODE.
IF sy-subrc = 0.
LOOP AT it_formatted.
TRANSFER it_formatted TO fnam.
ENDLOOP.
CLOSE DATASET fnam.
IF sy-subrc = 0.
MESSAGE s016(yw) WITH 'File '
fnam+0(50)
fnam+50(50)
' Downloaded Successfully'.
ELSE.
MESSAGE i000(yw) WITH1) AVOID SELECT *
2) USE WHERE WITH AS MANY EQ AND RESTRICT DATA RETRIEVAL
3) AVOID SELECTS FROM THE SAME TABLE
4) USE BINARY SEARCH WHEN READING FROM INTERNAL TABLES
5) CHECK IF INTERNAL TABLE IS SORTED BEFORE READING WITH BINARY SRCH
6) FETCH REQUIRED FIELDS USING TRANSPORTING WHEN READING INTERNAL TABLES
7) USE AS MANY PRIMARY AND SECONDARY INDEXES WHEN RETRIEVING DATA
8) USE SELECT SINGLE INSTEAD OF UP TO 1 ROWS
9) USE BYPASSING BUFFER FOR ONE TIME USE TABLES
10) USE INSERT <DBTAB> FROM TABLE <ITAB1> INSTEAD OF INSERT INTO <DBTAB>
11) USE WITH KEY WHEN READING FROM AN INTERNAL TAB
12) SPECIFY KEYS WHEN SORTING AN INTERNAL TABLE
13) HAVE TYPE DECLARATIONS FOR PARAMETERS PASSED IN SUBROUTINES
14) HAVE TYPE DECLARATIONS FOR FIELD-SYMBOLS
15) USE WHILE ... ENDWHILE INSTEAD OF DO ... ENDDO
16) DO NOT USE CHECK CONSTRUCT WITHIN LOOP ... ENDLOOP.
17) DO NOT USE CHECK CONSTRUCT WITHIN SELECT ... ENDSELECT
18) USE CASE STATEMENT INSTEAD OF IF ... ELSEIF ... ENDIF
19) AVOID USING ORDER BY IN SELECT STATEMENTS. USE SORT BY INSTEAD
20) REMOVE BREAK-POINT FROM THE CODE
21) DO NOT USE AT EVENTS IN LOOP...ENDLOOP HAVING FROM OR TO OR WHERE CON
22) DO NOT USE ON CHANGE OF EVENTS IN SELECT...ENDSELECT
23) DO NOT USE ON CHANGE OF EVENTS IN LOOP ... ENDLOOP
24) USE %_HINTS IN THE WHERE CLAUSE TO SPECIFY THE INDEX TO BE USED.
25) AVOID USING NESTED SELECTS
26) USE GET <DTABLE> FIELDS F1 F2 F3 ... INSTEAD OF ONLY GET <DTABLE>
27) USE MODIFY <DTABLE> FROM <ITAB> INSTEAD OF WITHIN A LOOP
28) USE UPDATE <DTABLE> FROM <ITAB> INSTEAD OF WITHIN A LOOP
29) USE INSERT <DTABLE> FROM <ITAB> INSTEAD OF WITHIN A LOOP
30) USE DELETE <DTABLE> FROM <ITAB> INSTEAD OF WITHIN A LOOP
31) AVOID SELECT FROM CLUSTER AND POOL TABLES -
HI ALL ,,,
MY SELECT STATEMENT IS LIKE THIS. IN SM30 ITS SHOWING THAT ITS HAS TAKE THE MAXIMUM TIME. SO HOW CAN I REDUCE THE HITING DB TABLE TIME OR IMPROVE THE PERFORMANCE?
IF LT_JCDS[] IS NOT INITIAL.
SELECT OBJNR
WKGBTR
BELNR
WRTTP
BEKNZ
PERIO
GJAHR
VERSN
KOKRS
VRGNG
GKOAR
BUKRS
REFBZ_FI
MBGBTR
FROM COEP
INTO CORRESPONDING FIELDS OF TABLE LT_COEP
FOR ALL ENTRIES IN LT_JCDS
WHERE KOKRS EQ 'DXES'
AND OBJNR EQ LT_JCDS-OBJNR
AND GJAHR <= SO_GJAHR-LOW
AND VERSN eq '000'
AND ( VRGNG EQ 'COIN' OR VRGNG EQ 'RKU1' OR VRGNG EQ 'RKL').
IF SY-SUBRC <> 0.
MESSAGE e000(8i) WITH 'DATA NOT FOUND IN "CO Object: Line Items (by Period)"'.
ENDIF.
ENDIF.Hi
see these points
Ways of Performance Tuning
1. Selection Criteria
2. Select Statements
Select Queries
SQL Interface
Aggregate Functions
For all Entries
Select Over more than one Internal table
Selection Criteria
1. Restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code using CHECK statement.
2. Select with selection list.
Points # 1/2
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list
SELECT CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
WHERE SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
Select Statements Select Queries
1. Avoid nested selects
2. Select all the records in a single shot using into table clause of select statement rather than to use Append statements.
3. When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index.
4. For testing existence , use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit.
5. Use Select Single if all primary key fields are supplied in the Where condition .
Point # 1
SELECT * FROM EKKO INTO EKKO_WA.
SELECT * FROM EKAN INTO EKAN_WA
WHERE EBELN = EKKO_WA-EBELN.
ENDSELECT.
ENDSELECT.
The above code can be much more optimized by the code written below.
SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
FROM EKKO AS P INNER JOIN EKAN AS F
ON PEBELN = FEBELN.
Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.
Point # 2
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table
SELECT CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
WHERE SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
Point # 3
To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields . In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.
Point # 4
SELECT * FROM SBOOK INTO SBOOK_WA
UP TO 1 ROWS
WHERE CARRID = 'LH'.
ENDSELECT.
The above code is more optimized as compared to the code mentioned below for testing existence of a record.
SELECT * FROM SBOOK INTO SBOOK_WA
WHERE CARRID = 'LH'.
EXIT.
ENDSELECT.
Point # 5
If all primary key fields are supplied in the Where condition you can even use Select Single.
Select Single requires one communication with the database system, whereas Select-Endselect needs two.
Select Statements contd.. SQL Interface
1. Use column updates instead of single-row updates
to update your database tables.
2. For all frequently used Select statements, try to use an index.
3. Using buffered tables improves the performance considerably.
Point # 1
SELECT * FROM SFLIGHT INTO SFLIGHT_WA.
SFLIGHT_WA-SEATSOCC =
SFLIGHT_WA-SEATSOCC - 1.
UPDATE SFLIGHT FROM SFLIGHT_WA.
ENDSELECT.
The above mentioned code can be more optimized by using the following code
UPDATE SFLIGHT
SET SEATSOCC = SEATSOCC - 1.
Point # 2
SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
WHERE CARRID = 'LH'
AND CONNID = '0400'.
ENDSELECT.
The above mentioned code can be more optimized by using the following code
SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
WHERE MANDT IN ( SELECT MANDT FROM T000 )
AND CARRID = 'LH'
AND CONNID = '0400'.
ENDSELECT.
Point # 3
Bypassing the buffer increases the network considerably
SELECT SINGLE * FROM T100 INTO T100_WA
BYPASSING BUFFER
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
The above mentioned code can be more optimized by using the following code
SELECT SINGLE * FROM T100 INTO T100_WA
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
Select Statements contd Aggregate Functions
If you want to find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of computing the aggregates yourself.
Some of the Aggregate functions allowed in SAP are MAX, MIN, AVG, SUM, COUNT, COUNT( * )
Consider the following extract.
Maxno = 0.
Select * from zflight where airln = LF and cntry = IN.
Check zflight-fligh > maxno.
Maxno = zflight-fligh.
Endselect.
The above mentioned code can be much more optimized by using the following code.
Select max( fligh ) from zflight into maxno where airln = LF and cntry = IN.
Select Statements contd For All Entries
The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
The plus
Large amount of data
Mixing processing and reading of data
Fast internal reprocessing of data
Fast
The Minus
Difficult to program/understand
Memory could be critical (use FREE or PACKAGE size)
Points to be must considered FOR ALL ENTRIES
Check that data is present in the driver table
Sorting the driver table
Removing duplicates from the driver table
Consider the following piece of extract
Loop at int_cntry.
Select single * from zfligh into int_fligh
where cntry = int_cntry-cntry.
Append int_fligh.
Endloop.
The above mentioned can be more optimized by using the following code.
Sort int_cntry by cntry.
Delete adjacent duplicates from int_cntry.
If NOT int_cntry[] is INITIAL.
Select * from zfligh appending table int_fligh
For all entries in int_cntry
Where cntry = int_cntry-cntry.
Endif.
Select Statements contd Select Over more than one Internal table
1. Its better to use a views instead of nested Select statements.
2. To read data from several logically connected tables use a join instead of nested Select statements. Joins are preferred only if all the primary key are available in WHERE clause for the tables that are joined. If the primary keys are not provided in join the Joining of tables itself takes time.
3. Instead of using nested Select loops it is often better to use subqueries.
Point # 1
SELECT * FROM DD01L INTO DD01L_WA
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
SELECT SINGLE * FROM DD01T INTO DD01T_WA
WHERE DOMNAME = DD01L_WA-DOMNAME
AND AS4LOCAL = 'A'
AND AS4VERS = DD01L_WA-AS4VERS
AND DDLANGUAGE = SY-LANGU.
ENDSELECT.
The above code can be more optimized by extracting all the data from view DD01V_WA
SELECT * FROM DD01V INTO DD01V_WA
WHERE DOMNAME LIKE 'CHAR%'
AND DDLANGUAGE = SY-LANGU.
ENDSELECT
Point # 2
SELECT * FROM EKKO INTO EKKO_WA.
SELECT * FROM EKAN INTO EKAN_WA
WHERE EBELN = EKKO_WA-EBELN.
ENDSELECT.
ENDSELECT.
The above code can be much more optimized by the code written below.
SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
FROM EKKO AS P INNER JOIN EKAN AS F
ON PEBELN = FEBELN.
Point # 3
SELECT * FROM SPFLI
INTO TABLE T_SPFLI
WHERE CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK'.
SELECT * FROM SFLIGHT AS F
INTO SFLIGHT_WA
FOR ALL ENTRIES IN T_SPFLI
WHERE SEATSOCC < F~SEATSMAX
AND CARRID = T_SPFLI-CARRID
AND CONNID = T_SPFLI-CONNID
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
The above mentioned code can be even more optimized by using subqueries instead of for all entries.
SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
WHERE SEATSOCC < F~SEATSMAX
AND EXISTS ( SELECT * FROM SPFLI
WHERE CARRID = F~CARRID
AND CONNID = F~CONNID
AND CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK' )
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
1. Table operations should be done using explicit work areas rather than via header lines.
2. Always try to use binary search instead of linear search. But dont forget to sort your internal table before that.
3. A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
4. A binary search using secondary index takes considerably less time.
5. LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
6. Modifying selected components using MODIFY itab TRANSPORTING f1 f2.. accelerates the task of updating a line of an internal table.
Point # 2
READ TABLE ITAB INTO WA WITH KEY K = 'X BINARY SEARCH.
IS MUCH FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY K = 'X'.
If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
Point # 3
READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
Point # 5
LOOP AT ITAB INTO WA WHERE K = 'X'.
ENDLOOP.
The above code is much faster than using
LOOP AT ITAB INTO WA.
CHECK WA-K = 'X'.
ENDLOOP.
Point # 6
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
The above code is more optimized as compared to
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1.
7. Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
8. If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
9. "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to LOOP-APPEND-ENDLOOP.
10. DELETE ADJACENT DUPLICATES accelerates the task of deleting duplicate entries considerably as compared to READ-LOOP-DELETE-ENDLOOP.
11. "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to DO -DELETE-ENDDO.
Point # 7
Modifying selected components only makes the program faster as compared to Modifying all lines completely.
e.g,
LOOP AT ITAB ASSIGNING <WA>.
I = SY-TABIX MOD 2.
IF I = 0.
<WA>-FLAG = 'X'.
ENDIF.
ENDLOOP.
The above code works faster as compared to
LOOP AT ITAB INTO WA.
I = SY-TABIX MOD 2.
IF I = 0.
WA-FLAG = 'X'.
MODIFY ITAB FROM WA.
ENDIF.
ENDLOOP.
Point # 8
LOOP AT ITAB1 INTO WA1.
READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
IF SY-SUBRC = 0.
ADD: WA1-VAL1 TO WA2-VAL1,
WA1-VAL2 TO WA2-VAL2.
MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
ELSE.
INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
ENDIF.
ENDLOOP.
The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
LOOP AT ITAB1 INTO WA.
COLLECT WA INTO ITAB2.
ENDLOOP.
SORT ITAB2 BY K.
COLLECT, however, uses a hash algorithm and is therefore independent
of the number of entries (i.e. O(1)) .
Point # 9
APPEND LINES OF ITAB1 TO ITAB2.
This is more optimized as compared to
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
Point # 10
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
This is much more optimized as compared to
READ TABLE ITAB INDEX 1 INTO PREV_LINE.
LOOP AT ITAB FROM 2 INTO WA.
IF WA = PREV_LINE.
DELETE ITAB.
ELSE.
PREV_LINE = WA.
ENDIF.
ENDLOOP.
Point # 11
DELETE ITAB FROM 450 TO 550.
This is much more optimized as compared to
DO 101 TIMES.
DELETE ITAB INDEX 450.
ENDDO.
12. Copying internal tables by using ITAB2[ ] = ITAB1[ ] as compared to LOOP-APPEND-ENDLOOP.
13. Specify the sort key as restrictively as possible to run the program faster.
Point # 12
ITAB2[] = ITAB1[].
This is much more optimized as compared to
REFRESH ITAB2.
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
Point # 13
SORT ITAB BY K. makes the program runs faster as compared to SORT ITAB.
Internal Tables contd
Hashed and Sorted tables
1. For single read access hashed tables are more optimized as compared to sorted tables.
2. For partial sequential access sorted tables are more optimized as compared to hashed tables
Hashed And Sorted Tables
Point # 1
Consider the following example where HTAB is a hashed table and STAB is a sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
This runs faster for single read access as compared to the following same code for sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE STAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
Point # 2
Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
LOOP AT STAB INTO WA WHERE K = SUBKEY.
ENDLOOP.
This runs faster as compared to
LOOP AT HTAB INTO WA WHERE K = SUBKEY.
ENDLOOP. -
101. What is true about the primary index of a table? More than one answer is correct.
a) The key fields of the table make up the primary index
b) The primary index ID is designated by the Database Adminstrator
c) The developer designates the fields to be used as the primary index
d) The primary index is automatically created when the table is activated
102. Which of the following gets stored as a Runtime Object?
a) Programs
b) Tables
c) Aggregate Objects
d) Fixed Values belonging to a domain
103. When is it better to buffer the table?
a) When a table is read infrequently
b) When a table is read frequently and the data seldom changes
c) When a table is read frequently and the data is always changing
d) When a table is linked to check tables
104. Identify the different type categories in the ABAP dictionary. More than one answer is correct.
a) Data Elements
b) Structures
c) Data definitions
d) Table Types
e) Data Models
105. What is true about views? More than one answer is correct.
a) A view is automatically created on the database upon activation
b) A view contains data
c) Maintenance Views are not updateable
d) Views can be buffered
106. Identify the case where table buffering should be set off.
a) When the most current data is required
b) When the most current data is not required
c) For Small Static non volatile tables
d) For Global Master Data
107. Table T1 wants to ensure that the key field t1-fielda entered is valid against a field t2-fielda in table T2. Which is the foreign key table?
a) T1
b) T2
c) T3 from the dictionary
d) Cannot be determined
108. Identify the one addition that is not part of the interface of a method
a) Importing
b) Result
c) Exception
d) Returning
109. What is the effect when a CLEAR statement is used on an internal table without header line?
a) The work area is intitialized
b) All the lines of the table are deleted
c) All the lines of the table are initialized
d) Nothing
110. What is the default mode for passing actual parameters in a Perform?
a) By Value
b) By Reference
c) By Changing
111. In the case of a function, Identify the item that is not a valid interface element.
a) Import parameters
b) Export parameters
c) Tables
d) Source Code
e) Exceptions
112. How would you clear the body of an internal table (with a header line). More than one answer is correct.
a) Clear ITAB[]
b) Refresh ITAB []
c) Clear ITAB
d) Refresh ITAB
113. When catching errors using the CATCH ENDCATCH statement, where does the runtime error return code get placed?
a) sy-subrc
b) sy-fdpos
c) error class
d) system-exceptions
114. What is the value of ZFIELDB after the last line of the following code is executed?
Data: ZFIELDA(5) type c value 'ABCDE'.
ZFIELDB(4) type c.
ZFIELDA = XX.
Clear ZFIELDA.
ZFIELDB = ZFIELDA.
a) ABCDE
b) Spaces
c) ABCD
d) BCDE
115. Mark the valid use of the data statement. Assume that ZBOOK-ID is a dictionary object.
a) Data fielda value zbook-id
b) Data fielda type c like zbook-id
c) Data fielda(5) like zbook-id
d) Data fielda like zbook-id
116. Assuming you have created a data object of type c with the name ZFIELDA in your program. Which of the following is allowed?
a) Data: ZFIELDA type n
b) Types: ZFIELDA type I
c) Data: ZFIELDA type c
d) Constants: ZFIELDA type n
117. What do search statements REPLACE, SHIFT, CONCATENATE, SPLIT have in common? More than one answer is correct.
a) They all set sy-subrc
b) They all set sy-fdpos
c) They all distinguish between upper and lower case
d) They all treat the operands as type C regardless of their actual type
e) The actual type of each operand determines how the string processing is performed
118. What are valid uses of a variant? More than one answer is correct.
a) Hiding input fields
b) Pre-assigning values
c) Input validation
d) Security checking
119. How can you perform a direct database read from a buffered table?
a) Do not have buffering in the technical attributes
b) Add the BYPASSING BUFFER clause on the select statement
c) Buffering can be turned off on the application server by the programmer using the ABAP Workbench
120. What is the Effect of not Typing Formal parameters in a Form?
a) Conversion always occurs
b) Conversion never occurs
c) Forms are more flexible but prone to a short dump if conversion does not work
d) No effect
e) Forms are less flexible and are guaranteed no chance of a run time error
121. What requirement exists if a field is defined in the dictionary of type CURR?
a) The field must be numeric
b) Decimals must be defined in the domain
c) The field must be linked to another field of type CUKY
d) No other requirement exists
122. Which of the following is not a valid ABAP data statement?
a) Data fielda(5) type c
b) Data fielda(5) type n
c) Data fielda(5) type t
d) Data fielda(5) type x
123. What is the result of the following date calculation? Assume current date is 20001220.
Data: Today(8) type C.
Today = sy-datum.
Today = 10.
a) 10
b) 20001220
c) 10001220
d) 20011210
124. Mark the default size for a packed field
a) 1
b) 2
c) 4
d) 8
e) size must be specified
125. Refer to the following Code. What is the value of sy-fdpos and sy-subrc after the search is executed?
Data: mystring type c value 'ARAMCO'.
Search mystring for 'X'
a) sy-fdpos = 0 and sy-subrc = 0
b) sy-fdpos = 0 and sy-subrc = 4
c) sy-fdpos = 4 and sy-subrc = 0
d) sy-fdpos = 4 and sy-subrc = 4
126. What is true of passing by value and result in the following code? More than one answer is correct.
Perform calculate_sales using amount.
FORM calculate_sales changing value(f_amount)
a) Formal Parameter f_amount is allocated its own memory space
b) The address of the actual parameter is passed to the formal parameter
c) Formal parameter is copied to memory space of actual parameter at the end of the form
d) Formal parameter is not copied to memory space of actual parameter
127. Define a Logical Database.
a) An ABAP/4 Reading Program used to read and process data
b) A method to update data
c) A Reporting Tool
d) Defintion of a Relational Data Model
128. What happens if message E046 is raised?
At Selection-Screen on sales.
If sales-low < 500.
Message E046.
Endif.
a) The initialization event is fired again
b) Field Sales is open for input and all other fields are not available for input
c) All fields are open for input and cursor is positioned on field sales
d) The program ends
129. What is a structured type in the ABAP dictionary that has no physical table defintion in the underlying database referred to as?
a) table
b) structured data type
c) structure
d) table typeWhere are questions 1 to 100?
a) They've been asked in another post
b) They weren't that interesting
c) They were about the applicant's name and address
c) All of the above -
How to select the data efficiently from the table
hi every one,
i need some help in selecting data from FAGLFLEXA table.i have to select many amounts from different group of G/L accounts
(groups are predefined here which contains a set of g/L account no.).
if i select every time for each group then it will be a performance issue, in order to avoid it what should i do, can any one suggest me a method or a smaple query so that i can perform the task efficiently.Hi ,
1.select and keep the data in internal table
2.avoid select inside loop ..endloop.
3.try to use for all entries
check the below details
Hi Praveen,
Performance Notes
1.Keep the Result Set Small
You should aim to keep the result set small. This reduces both the amount of memory used in the database system and the network load when transferring data to the application server. To reduce the size of your result sets, use the WHERE and HAVING clauses.
Using the WHERE Clause
Whenever you access a database table, you should use a WHERE clause in the corresponding Open SQL statement. Even if a program containing a SELECT statement with no WHERE clause performs well in tests, it may slow down rapidly in your production system, where the data volume increases daily. You should only dispense with the WHERE clause in exceptional cases where you really need the entire contents of the database table every time the statement is executed.
When you use the WHERE clause, the database system optimizes the access and only transfers the required data. You should never transfer unwanted data to the application server and then filter it using ABAP statements.
Using the HAVING Clause
After selecting the required lines in the WHERE clause, the system then processes the GROUP BY clause, if one exists, and summarizes the database lines selected. The HAVING clause allows you to restrict the grouped lines, and in particular, the aggregate expressions, by applying further conditions.
Effect
If you use the WHERE and HAVING clauses correctly:
There are no more physical I/Os in the database than necessary
No unwanted data is stored in the database cache (it could otherwise displace data that is actually required)
The CPU usage of the database host is minimize
The network load is reduced, since only the data that is required by the application is transferred to the application server.
Minimize the Amount of Data Transferred
Data is transferred between the database system and the application server in blocks. Each block is up to 32 KB in size (the precise size depends on your network communication hardware). Administration information is transported in the blocks as well as the data.
To minimize the network load, you should transfer as few blocks as possible. Open SQL allows you to do this as follows:
Restrict the Number of Lines
If you only want to read a certain number of lines in a SELECT statement, use the UP TO <n> ROWS addition in the FROM clause. This tells the database system only to transfer <n> lines back to the application server. This is more efficient than transferring more lines than necessary back to the application server and then discarding them in your ABAP program.
If you expect your WHERE clause to return a large number of duplicate entries, you can use the DISTINCT addition in the SELECT clause.
Restrict the Number of Columns
You should only read the columns from a database table that you actually need in the program. To do this, list the columns in the SELECT clause. Note here that the INTO CORRESPONDING FIELDS addition in the INTO clause is only efficient with large volumes of data, otherwise the runtime required to compare the names is too great. For small amounts of data, use a list of variables in the INTO clause.
Do not use * to select all columns unless you really need them. However, if you list individual columns, you may have to adjust the program if the structure of the database table is changed in the ABAP Dictionary. If you specify the database table dynamically, you must always read all of its columns.
Use Aggregate Functions
If you only want to use data for calculations, it is often more efficient to use the aggregate functions of the SELECT clause than to read the individual entries from the database and perform the calculations in the ABAP program.
Aggregate functions allow you to find out the number of values and find the sum, average, minimum, and maximum values.
Following an aggregate expression, only its result is transferred from the database.
Data Transfer when Changing Table Lines
When you use the UPDATE statement to change lines in the table, you should use the WHERE clause to specify the relevant lines, and then SET statements to change only the required columns.
When you use a work area to overwrite table lines, too much data is often transferred. Furthermore, this method requires an extra SELECT statement to fill the work area. Minimize the Number of Data Transfers
In every Open SQL statement, data is transferred between the application server and the database system. Furthermore, the database system has to construct or reopen the appropriate administration data for each database access. You can therefore minimize the load on the network and the database system by minimizing the number of times you access the database.
Multiple Operations Instead of Single Operations
When you change data using INSERT, UPDATE, and DELETE, use internal tables instead of single entries. If you read data using SELECT, it is worth using multiple operations if you want to process the data more than once, other wise, a simple select loop is more efficient.
Avoid Repeated Access
As a rule you should read a given set of data once only in your program, and using a single access. Avoid accessing the same data more than once (for example, SELECT before an UPDATE).
Avoid Nested SELECT Loops
A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. You should therefore only use nested SELECT loops if the selection in the outer loop contains very few lines.
However, using combinations of data from different database tables is more the rule than the exception in the relational data model. You can use the following techniques to avoid nested SELECT statements:
ABAP Dictionary Views
You can define joins between database tables statically and systemwide as views in the ABAP Dictionary. ABAP Dictionary views can be used by all ABAP programs. One of their advantages is that fields that are common to both tables (join fields) are only transferred once from the database to the application server.
Views in the ABAP Dictionary are implemented as inner joins. If the inner table contains no lines that correspond to lines in the outer table, no data is transferred. This is not always the desired result. For example, when you read data from a text table, you want to include lines in the selection even if the corresponding text does not exist in the required language. If you want to include all of the data from the outer table, you can program a left outer join in ABAP.
The links between the tables in the view are created and optimized by the database system. Like database tables, you can buffer views on the application server. The same buffering rules apply to views as to tables. In other words, it is most appropriate for views that you use mostly to read data. This reduces the network load and the amount of physical I/O in the database.
Joins in the FROM Clause
You can read data from more than one database table in a single SELECT statement by using inner or left outer joins in the FROM clause.
The disadvantage of using joins is that redundant data is read from the hierarchically-superior table if there is a 1:N relationship between the outer and inner tables. This can considerably increase the amount of data transferred from the database to the application server. Therefore, when you program a join, you should ensure that the SELECT clause contains a list of only the columns that you really need. Furthermore, joins bypass the table buffer and read directly from the database. For this reason, you should use an ABAP Dictionary view instead of a join if you only want to read the data.
The runtime of a join statement is heavily dependent on the database optimizer, especially when it contains more than two database tables. However, joins are nearly always quicker than using nested SELECT statements.
Subqueries in the WHERE and HAVING Clauses
Another way of accessing more than one database table in the same Open SQL statement is to use subqueries in the WHERE or HAVING clause. The data from a subquery is not transferred to the application server. Instead, it is used to evaluate conditions in the database system. This is a simple and effective way of programming complex database operations.
Using Internal Tables
It is also possible to avoid nested SELECT loops by placing the selection from the outer loop in an internal table and then running the inner selection once only using the FOR ALL ENTRIES addition. This technique stems from the time before joins were allowed in the FROM clause. On the other hand, it does prevent redundant data from being transferred from the database.
Using a Cursor to Read Data
A further method is to decouple the INTO clause from the SELECT statement by opening a cursor using OPEN CURSOR and reading data line by line using FETCH NEXT CURSOR. You must open a new cursor for each nested loop. In this case, you must ensure yourself that the correct lines are read from the database tables in the correct order. This usually requires a foreign key relationship between the database tables, and that they are sorted by the foreign key. Minimize the Search Overhead
You minimize the size of the result set by using the WHERE and HAVING clauses. To increase the efficiency of these clauses, you should formulate them to fit with the database table indexes.
Database Indexes
Indexes speed up data selection from the database. They consist of selected fields of a table, of which a copy is then made in sorted order. If you specify the index fields correctly in a condition in the WHERE or HAVING clause, the system only searches part of the index (index range scan).
The primary index is always created automatically in the R/3 System. It consists of the primary key fields of the database table. This means that for each combination of fields in the index, there is a maximum of one line in the table. This kind of index is also known as UNIQUE.
If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVING clause, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
You specify the fields of secondary indexes using the ABAP Dictionary. You can also determine whether the index is unique or not. However, you should not create secondary indexes to cover all possible combinations of fields.
Only create one if you select data by fields that are not contained in another index, and the performance is very poor. Furthermore, you should only create secondary indexes for database tables from which you mainly read, since indexes have to be updated each time the database table is changed. As a rule, secondary indexes should not contain more than four fields, and you should not have more than five indexes for a single database table.
If a table has more than five indexes, you run the risk of the optimizer choosing the wrong one for a particular operation. For this reason, you should avoid indexes with overlapping contents.
Secondary indexes should contain columns that you use frequently in a selection, and that are as highly selective as possible. The fewer table entries that can be selected by a certain column, the higher that columns selectivity. Place the most selective fields at the beginning of the index. Your secondary index should be so selective that each index entry corresponds to at most five percent of the table entries. If this is not the case, it is not worth creating the index. You should also avoid creating indexes for fields that are not always filled, where their value is initial for most entries in the table.
If all of the columns in the SELECT clause are contained in the index, the system does not have to search the actual table data after reading from the index. If you have a SELECT clause with very few columns, you can improve performance dramatically by including these columns in a secondary index.
Formulating Conditions for Indexes
You should bear in mind the following when formulating conditions for the WHERE and HAVING clauses so that the system can use a database index and does not have to use a full table scan.
Check for Equality and Link Using AND
The database index search is particularly efficient if you check all index fields for equality (= or EQ) and link the expressions using AND.
Use Positive Conditions
The database system only supports queries that describe the result in positive terms, for example, EQ or LIKE. It does not support negative expressions like NE or NOT LIKE.
If possible, avoid using the NOT operator in the WHERE clause, because it is not supported by database indexes; invert the logical expression instead.
Using OR
The optimizer usually stops working when an OR expression occurs in the condition. This means that the columns checked using OR are not included in the index search. An exception to this are OR expressions at the outside of conditions. You should try to reformulate conditions that apply OR expressions to columns relevant to the index, for example, into an IN condition.
Using Part of the Index
If you construct an index from several columns, the system can still use it even if you only specify a few of the columns in a condition. However, in this case, the sequence of the columns in the index is important. A column can only be used in the index search if all of the columns before it in the index definition have also been specified in the condition.
Checking for Null Values
The IS NULL condition can cause problems with indexes. Some database systems do not store null values in the index structure. Consequently, this field cannot be used in the index.
Avoid Complex Conditions
Avoid complex conditions, since the statements have to be broken down into their individual components by the database system.
Reduce the Database Load
Unlike application servers and presentation servers, there is only one database server in your system. You should therefore aim to reduce the database load as much as possible. You can use the following methods:
Buffer Tables on the Application Server
You can considerably reduce the time required to access data by buffering it in the application server table buffer. Reading a single entry from table T001 can take between 8 and 600 milliseconds, while reading it from the table buffer takes 0.2 - 1 milliseconds.
Whether a table can be buffered or not depends its technical attributes in the ABAP Dictionary. There are three buffering types:
Resident buffering (100%) The first time the table is accessed, its entire contents are loaded in the table buffer.
Generic buffering In this case, you need to specify a generic key (some of the key fields) in the technical settings of the table in the ABAP Dictionary. The table contents are then divided into generic areas. When you access data with one of the generic keys, the whole generic area is loaded into the table buffer. Client-specific tables are often buffered generically by client.
Partial buffering (single entry) Only single entries are read from the database and stored in the table buffer.
When you read from buffered tables, the following happens:
1. An ABAP program requests data from a buffered table.
2. The ABAP processor interprets the Open SQL statement. If the table is defined as a buffered table in the ABAP Dictionary, the ABAP processor checks in the local buffer on the application server to see if the table (or part of it) has already been buffered.
3. If the table has not yet been buffered, the request is passed on to the database. If the data exists in the buffer, it is sent to the program.
4. The database server passes the data to the application server, which places it in the table buffer.
5. The data is passed to the program.
When you change a buffered table, the following happens:
1. The database table is changed and the buffer on the application server is updated. The database interface logs the update statement in the table DDLOG. If the system has more than one application server, the buffer on the other servers is not updated at once.
2. All application servers periodically read the contents of table DDLOG, and delete the corresponding contents from their buffers where necessary. The granularity depends on the buffering type. The table buffers in a distributed system are generally synchronized every 60 seconds (parameter: rsdisp/bufreftime).
3. Within this period, users on non-synchronized application servers will read old data. The data is not recognized as obsolete until the next buffer synchronization. The next time it is accessed, it is re-read from the database.
You should buffer the following types of tables:
Tables that are read very frequently
Tables that are changed very infrequently
Relatively small tables (few lines, few columns, or short columns)
Tables where delayed update is acceptable.
Once you have buffered a table, take care not to use any Open SQL statements that bypass the buffer.
The SELECT statement bypasses the buffer when you use any of the following:
The BYPASSING BUFFER addition in the FROM clause
The DISTINCT addition in the SELECT clause
Aggregate expressions in the SELECT clause
Joins in the FROM clause
The IS NULL condition in the WHERE clause
Subqueries in the WHERE clause
The ORDER BY clause
The GROUP BY clause
The FOR UPDATE addition
Furthermore, all Native SQL statements bypass the buffer.
Avoid Reading Data Repeatedly
If you avoid reading the same data repeatedly, you both reduce the number of database accesses and reduce the load on the database. Furthermore, a "dirty read" may occur with database tables other than Oracle. This means that the second time you read data from a database table, it may be different from the data read the first time. To ensure that the data in your program is consistent, you should read it once only and then store it in an internal table.
Sort Data in Your ABAP Programs
The ORDER BY clause in the SELECT statement is not necessarily optimized by the database system or executed with the correct index. This can result in increased runtime costs. You should only use ORDER BY if the database sort uses the same index with which the table is read. To find out which index the system uses, use SQL Trace in the ABAP Workbench Performance Trace. If the indexes are not the same, it is more efficient to read the data into an internal table or extract and sort it in the ABAP program using the SORT statement.
Use Logical Databases
SAP supplies logical databases for all applications. A logical database is an ABAP program that decouples Open SQL statements from application programs. They are optimized for the best possible database performance. However, it is important that you use the right logical database. The hierarchy of the data you want to read must reflect the structure of the logical database, otherwise, they can have a negative effect on performance. For example, if you want to read data from a table right at the bottom of the hierarchy of the logical database, it has to read at least the key fields of all tables above it in the hierarchy. In this case, it is more efficient to use a SELECT statement.
Work Processes
Work processes execute the individual dialog steps in R/3 applications. The next two sections describe firstly the structure of a work process, and secondly the different types of work process in the R/3 System.
Structure of a Work Process
Work processes execute the dialog steps of application programs. They are components of an application server. The following diagram shows the components of a work process:
Each work process contains two software processors and a database interface.
Screen Processor
In R/3 application programming, there is a difference between user interaction and processing logic. From a programming point of view, user interaction is controlled by screens. As well as the actual input mask, a screen also consists of flow logic. The screen flow logic controls a large part of the user interaction. The R/3 Basis system contains a special language for programming screen flow logic. The screen processor executes the screen flow logic. Via the dispatcher, it takes over the responsibility for communication between the work process and the SAPgui, calls modules in the flow logic, and ensures that the field contents are transferred from the screen to the flow logic.
ABAP Processor
The actual processing logic of an application program is written in ABAP - SAPs own programming language. The ABAP processor executes the processing logic of the application program, and communicates with the database interface. The screen processor tells the ABAP processor which module of the screen flow logic should be processed next. The following screen illustrates the interaction between the screen and the ABAP processors when an application program is running.
Database Interface
The database interface provides the following services:
Establishing and terminating connections between the work process and the database.
Access to database tables
Access to R/3 Repository objects (ABAP programs, screens and so on)
Access to catalog information (ABAP Dictionary)
Controlling transactions (commit and rollback handling)
Table buffer administration on the application server.
The following diagram shows the individual components of the database interface:
The diagram shows that there are two different ways of accessing databases: Open SQL and Native SQL.
Open SQL statements are a subset of Standard SQL that is fully integrated in ABAP. They allow you to access data irrespective of the database system that the R/3 installation is using. Open SQL consists of the Data Manipulation Language (DML) part of Standard SQL; in other words, it allows you to read (SELECT) and change (INSERT, UPDATE, DELETE) data. The tasks of the Data Definition Language (DDL) and Data Control Language (DCL) parts of Standard SQL are performed in the R/3 System by the ABAP Dictionary and the authorization system. These provide a unified range of functions, irrespective of database, and also contain functions beyond those offered by the various database systems.
Open SQL also goes beyond Standard SQL to provide statements that, in conjunction with other ABAP constructions, can simplify or speed up database access. It also allows you to buffer certain tables on the application server, saving excessive database access. In this case, the database interface is responsible for comparing the buffer with the database. Buffers are partly stored in the working memory of the current work process, and partly in the shared memory for all work processes on an application server. Where an R/3 System is distributed across more than one application server, the data in the various buffers is synchronized at set intervals by the buffer management. When buffering the database, you must remember that data in the buffer is not always up to date. For this reason, you should only use the buffer for data which does not often change.
Native SQL is only loosely integrated into ABAP, and allows access to all of the functions contained in the programming interface of the respective database system. Unlike Open SQL statements, Native SQL statements are not checked and converted, but instead are sent directly to the database system. Programs that use Native SQL are specific to the database system for which they were written. R/3 applications contain as little Native SQL as possible. In fact, it is only used in a few Basis components (for example, to create or change table definitions in the ABAP Dictionary).
The database-dependent layer in the diagram serves to hide the differences between database systems from the rest of the database interface. You choose the appropriate layer when you install the Basis system. Thanks to the standardization of SQL, the differences in the syntax of statements are very slight. However, the semantics and behavior of the statements have not been fully standardized, and the differences in these areas can be greater. When you use Native SQL, the function of the database-dependent layer is minimal.
Types of Work Process
Although all work processes contain the components described above, they can still be divided into different types. The type of a work process determines the kind of task for which it is responsible in the application server. It does not specify a particular set of technical attributes. The individual tasks are distributed to the work processes by the dispatcher.
Before you start your R/3 System, you determine how many work processes it will have, and what their types will be. The dispatcher starts the work processes and only assigns them tasks that correspond to their type. This means that you can distribute work process types to optimize the use of the resources on your application servers.
The following diagram shows again the structure of an application server, but this time, includes the various possible work process types:
The various work processes are described briefly below. Other parts of this documentation describe the individual components of the application server and the R/3 System in more detail.
Dialog Work Process
Dialog work processes deal with requests from an active user to execute dialog steps.
Update Work Process
Update work processes execute database update requests. Update requests are part of an SAP LUW that bundle the database operations resulting from the dialog in a database LUW for processing in the background.
Background Work Process
Background work processes process programs that can be executed without user interaction (background jobs).
Enqueue Work Process
The enqueue work process administers a lock table in the shared memory area. The lock table contains the logical database locks for the R/3 System and is an important part of the SAP LUW concept. In an R/3 System, you may only have one lock table. You may therefore also only have one application server with enqueue work processes.
Spool Work Process
The spool work process passes sequential datasets to a printer or to optical archiving. Each application server may contain several spool work process.
The services offered by an application server are determined by the types of its work processes. One application server may, of course, have more than one function. For example, it may be both a dialog server and the enqueue server, if it has several dialog work processes and an enqueue work process.
You can use the system administration functions to switch a work process between dialog and background modes while the system is still running. This allows you, for example, to switch an R/3 System between day and night operation, where you have more dialog than background work processes during the day, and the other way around during the night.
ABAP Application Server
R/3 programs run on application servers. They are an important component of the R/3 System. The following sections describe application servers in more detail.
Structure of an ABAP Application Server
The application layer of an R/3 System is made up of the application servers and the message server. Application programs in an R/3 System are run on application servers. The application servers communicate with the presentation components, the database, and also with each other, using the message server.
The following diagram shows the structure of an application server:
The individual components are:
Work Processes
An application server contains work processes, which are components that can run an application. Work processes are components that are able to execute an application (that is, one dialog step each). Each work process is linked to a memory area containing the context of the application being run. The context contains the current data for the application program. This needs to be available in each dialog step. Further information about the different types of work process is contained later on in this documentation.
Dispatcher
Each application server contains a dispatcher. The dispatcher is the link between the work processes and the users logged onto the application server. Its task is to receive requests for dialog steps from the SAP GUI and direct them to a free work process. In the same way, it directs screen output resulting from the dialog step back to the appropriate user.
Gateway
Each application server contains a gateway. This is the interface for the R/3 communication protocols (RFC, CPI/C). It can communicate with other application servers in the same R/3 System, with other R/3 Systems, with R/2 Systems, or with non-SAP systems.
The application server structure as described here aids the performance and scalability of the entire R/3 System. The fixed number of work processes and dispatching of dialog steps leads to optimal memory use, since it means that certain components and the memory areas of a work process are application-independent and reusable. The fact that the individual work processes work independently makes them suitable for a multi-processor architecture. The methods used in the dispatcher to distribute tasks to work processes are discussed more closely in the section Dispatching Dialog Steps.
Shared Memory
All of the work processes on an application server use a common main memory area called shared memory to save contexts or to buffer constant data locally.
The resources that all work processes use (such as programs and table contents) are contained in shared memory. Memory management in the R/3 System ensures that the work processes always address the correct context, that is the data relevant to the current state of the program that is running. A mapping process projects the required context for a dialog step from shared memory into the address of the relevant work process. This reduces the actual copying to a minimum.
Local buffering of data in the shared memory of the application server reduces the number of database reads required. This reduces access times for application programs considerably. For optimal use of the buffer, you can concentrate individual applications (financial accounting, logistics, human resources) into separate application server groups.
Database Connection
When you start up an R/3 System, each application server registers its work processes with the database layer, and receives a single dedicated channel for each. While the system is running, each work process is a user (client) of the database system (server). You cannot change the work process registration while the system is running. Neither can you reassign a database channel from one work process to another. For this reason, a work process can only make database changes within a single database logical unit of work (LUW). A database LUW is an inseparable sequence of database operations. This has important consequences for the programming model explained below.
Dispatching Dialog Steps
The number of users logged onto an application server is often many times greater than the number of available work processes. Furthermore, it is not restricted by the R/3 system architecture. Furthermore, each user can run several applications at once. The dispatcher has the important task of distributing all dialog steps among the work processes on the application server.
The following diagram is an example of how this might happen:
1. The dispatcher receives the request to execute a dialog step from user 1 and directs it to work process 1, which happens to be free. The work process addresses the context of the application program (in shared memory) and executes the dialog step. It then becomes free again.
2. The dispatcher receives the request to execute a dialog step from user 2 and directs it to work process 1, which is now free again. The work process executes the dialog step as in step 1.
3. While work process 1 is still working, the dispatcher receives a further request from user 1 and directs it to work process 2, which is free.
4. After work processes 1 and 2 have finished processing their dialog steps, the dispatcher receives another request from user 1 and directs it to work process 1, which is free again.
5. While work process 1 is still working, the dispatcher receives a further request from user 2 and directs it to work process 2, which is free.
From this example, we can see that:
A dialog step from a program is assigned to a single work process for execution.
The individual dialog steps of a program can be executed on different work processes, and the program context must be addressed for each new work process.
A work process can execute dialog steps of different programs from different users.
The example does not show that the dispatcher tries to distribute the requests to the work processes such that the same work process is used as often as possible for the successive dialog steps in an application. This is useful, since it saves the program context having to be addressed each time a dialog step is executed.
Dispatching and the Programming Model
The separation of application and presentation layer made it necessary to split up application programs into dialog steps. This, and the fact that dialog steps are dispatched to individual work processes, has had important consequences for the programming model.
As mentioned above, a work process can only make database changes within a single database logical unit of work (LUW). A database LUW is an inseparable sequence of database operations. The contents of the database must be consistent at its beginning and end. The beginning and end of a database LUW are defined by a commit command to the database system (database commit). During a database LUW, that is, between two database commits, the database system itself ensures consistency within the database. In other words, it takes over tasks such as locking database entries while they are being edited, or restoring the old data (rollback) if a step terminates in an error.
A typical SAP application program extends over several screens and the corresponding dialog steps. The user requests database changes on the individual screens that should lead to the database being consistent once the screens have all been processed. However, the individual dialog steps run on different work processes, and a single work process can process dialog steps from other applications. It is clear that two or more independent applications whose dialog steps happen to be processed on the same work process cannot be allowed to work with the same database LUW.
Consequently, a work process must open a separate database LUW for each dialog step. The work process sends a commit command (database commit) to the database at the end of each dialog step in which it makes database changes. These commit commands are called implicit database commits, since they are not explicitly written into the application program.
These implicit database commits mean that a database LUW can be kept open for a maximum of one dialog step. This leads to a considerable reduction in database load, serialization, and deadlocks, and enables a large number of users to use the same system.
However, the question now arises of how this method (1 dialog step = 1 database LUW) can be reconciled with the demand to make commits and rollbacks dependent on the logical flow of the application program instead of the technical distribution of dialog steps. Database update requests that depend on one another form logical units in the program that extend over more than one dialog step. The database changes associated with these logical units must be executed together and must also be able to be undone together.
The SAP programming model contains a series of bundling techniques that allow you to group database updates together in logical units. The section of an R/3 application program that bundles a set of logically-associated database operations is called an SAP LUW. Unlike a database LUW, a SAP LUW includes all of the dialog steps in a logical unit, including the database update.
Happy Reading...
shibu -
Headers getting repeated while running the report in background
Hi,
I have a report which uses ALV grid display for output display.
I have displayed a heder in the top_of_page option. while running the program in foregound the header gets displayed only once. but when executing in background the header is getting displayed for each and every page.
can any one tell me how to get the header displayed only once in the background also.REPORT ZBACKORD MESSAGE-ID VZ
NO STANDARD PAGE HEADING.
*& TABLES AND TYPE-POOLS *
Tables used
TABLES : VBAK, "Sales Document: Header Data
VBAP, "Sales Document: Item Data
VBPA. "Sales Document Partner
For ALV Display
TYPE-POOLS: SLIS. "Globale Typen für generische Listbausteine
*& CONSTANTS *
Constants Used
CONSTANTS:
C_X VALUE 'X', "Order status
C_TAPA(4) VALUE 'TAPA', "For Material Determination
C_0001(4) VALUE '0001', "Etenr value
C_A VALUE 'A', "Enable Save
C_US(3) VALUE 'US$', "US DOLLAR.
C_B VALUE 'B', "for Partially processed
C_E VALUE 'E', "Language
C_C VALUE 'C', "for completely processed
C_BLANK VALUE ' ', "Blank
C_IC1(4) VALUE '&IC1', "for user command
C_ZR(2) VALUE 'ZR', "Cs ReP No
C_BP(2) VALUE 'RE', "Bill to party
C_SH(2) VALUE 'WE', "Sold to party
C_6(6) VALUE '000000', "For item number
C_20(2) TYPE N VALUE '20', "For the length of the field
C_S(1) TYPE C VALUE 'S', "STOCK
C_H VALUE 'H', "Header
C_COL(1) TYPE C VALUE ':', " COLUMN FOR DATA AND TIME
C_TOP TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
"For TOP_OF_PAGE
C_USER TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
" For USER_COMMAND
*& TYPE DEFINITIONS *
*FOR Sales Document: Header Data
TYPES: BEGIN OF TP_VBAK,
VBELN TYPE VBELN_VF, "Sales Document
ERDAT TYPE ERDAT, "Date on which the record was created
AUART TYPE AUART, "Sales document type
LIFSK TYPE LIFSK, "Delivery block
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
END OF TP_VBAK.
*FOR Sales Document Business Data
TYPES :BEGIN OF TP_VBKD,
VBELN TYPE VBELN, "Sales and distribution document number
POSNR TYPE POSNR, "Item number of the SD document
INCO1 TYPE INCO1, "Incoterms
ZTERM TYPE DZTERM, "Terms of payment key
BSTKD TYPE BSTKD, "Customer purchase order number
END OF TP_VBKD.
TYPES : BEGIN OF TP_VBFA,
VBELV TYPE VBELN_VON,
POSNV TYPE POSNR_VON,
END OF TP_VBFA.
*FOR Sales Document: Partner
TYPES : BEGIN OF TP_VBPA,
VBELN TYPE VBELN, "Sales and distribution
PARVW TYPE PARVW, "Partner function
KUNNR TYPE KUNNR, "Customer Number 1
ADRNR TYPE ADRNR, "address
END OF TP_VBPA.
*FOR Addresses (Business Address Services)
TYPES : BEGIN OF TP_ADRC,
ADDRNUMBER TYPE AD_ADDRNUM, "Address
DATE_FROM TYPE AD_DATE_FR, "Date valid from
NATION TYPE AD_NATION, "International address
NAME1 TYPE AD_NAME1, "name
END OF TP_ADRC.
*FOR Sales Document: Item Data
TYPES: BEGIN OF TP_VBAP,
VBELN TYPE VBELN_VA, "Sales document
POSNR TYPE POSNR_VA, "Sales document item
MATNR TYPE MATNR, "Material Number
PSTYV TYPE PSTYV, "Sales document item category
KDMAT TYPE MATNR_KU, "Material number used by customer
VRKME TYPE VRKME, "Sales unit
WERKS TYPE WERKS_EXT, "Plant (Own or External)
VSTEL TYPE VSTEL, "Shipping point /Receiving point
NETPR TYPE NETPR, "Net p
NETWR TYPE NETWR_AP,
WAERK TYPE VBAP-WAERK,"Target outline doc currency
END OF TP_VBAP.
*for Sales Document: Schedule Line Data
TYPES: BEGIN OF TP_VBEP,
VBELN TYPE VBELN_VA, "Sales document
POSNR TYPE POSNR_VA, "Sales Document Item
ETENR TYPE ETENR, "Schedule line
EDATU TYPE EDATU, "Schedule line data
WMENG TYPE WMENG, "Order quantity in sales unit
BMENG TYPE BMENG, "Confirmed quantity
LMENG TYPE LMENG, "Required quantity
WADAT TYPE WADAT, "Goods issue date
LIFSP TYPE LIFSP_EP, "Schedule line blocked for delivery
END OF TP_VBEP.
*For Sales Document: Header Status and Administrative Data
TYPES : BEGIN OF TP_VBUK,
VBELN TYPE VBELN, "Sales and Distribution Document Number
SPSTG TYPE SPSTG, "Overall blocked status
CMGST TYPE CMGST,
END OF TP_VBUK.
TYPES : BEGIN OF TP_TVLST,
LIFSP TYPE LIFSP, "Default delivery block
VTEXT TYPE BEZEI_LIFSP, "Description
END OF TP_TVLST.
*FOR Sales Document: Item Status
TYPES : BEGIN OF TP_VBUP,
VBELN TYPE VBELN, "Sales and distribution
POSNR TYPE POSNR, "Item number of the SD
LFGSA TYPE LFGSA, "Overall delivery status of item
END OF TP_VBUP.
For ALV Display-if cs rep is checked
TYPES: BEGIN OF TP_DISPC,
VBELN TYPE VBELN, "Sales and distribution Doc
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
AUART TYPE AUART, "Sales document type
BSTKD TYPE BSTKD, "Customer purchase order
KUNNR_1 TYPE KUNNR, "Cs Rep Number
NAME1_1 TYPE NAME1, "Cs Rep Name
KUNNR_2 TYPE KUNNR, "Bill to Number
NAME1_2 TYPE NAME1, "Bill to Party
KUNNR_3 TYPE KUNNR, "Ship to Number
NAME1_3 TYPE NAME1, "Ship to Party
POSNR TYPE POSNR_VA, "Item number of the SD
MATNR TYPE MATNR, "Material Number
KDMAT TYPE MATNR_KU, "Material number used by
VSTEL TYPE VSTEL, "Shipping point /Receiving
NETPR TYPE NETPR, "Net price
NETWR TYPE NETWR_AP,
WAERK TYPE WAERK, "Currency
ZTERM TYPE DZTERM, "Terms of payment key
WMENG TYPE WMENG, "Order quantity in sales unit
LOGIC_1 TYPE WMENG, "BackOrder Quantity
VRKME TYPE STRING, "Sales Unit
WADAT TYPE EDATU, "Goods issue date
WADAT1 TYPE EDATU,
EDATU TYPE EDATU, "Schedule line data
VRKME_1 TYPE STRING, "Sales Unit
INCO1 TYPE INCO1, "Incoterms
LFGSA TYPE STRING, "Overall delivery status of item
LIFSP TYPE STRING, "Line Item Block
LIFSK TYPE STRING, "Header block
SPSTG TYPE STRING, "Overall blocked status
END OF TP_DISPC.
For ALV Display-if plant is checked
TYPES: BEGIN OF TP_DISPP,
VBELN TYPE VBELN, "Sales and distribution Doc
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
AUART TYPE AUART, "Sales document type
BSTKD TYPE BSTKD, "Customer purchase order
KUNNR_2 TYPE KUNNR, "Cs rep number
NAME1_2 TYPE NAME1, "Cs rep Name
KUNNR_3 TYPE KUNNR, "Ship to Number
NAME1_3 TYPE NAME1, "Ship to Party Name
POSNR TYPE POSNR_VA, "Item number of the SD
MATNR TYPE MATNR, "Material Number
KDMAT TYPE MATNR_KU, "Material number used by customer
VSTEL TYPE VSTEL, "Shipping point /Receiving point
NETPR TYPE NETPR, "Net price
NETWR TYPE NETWR_AP,
*}MOD02
WAERK TYPE WAERK, "Currency
ZTERM TYPE DZTERM, "Terms of payment key
WMENG TYPE WMENG, "Order quantity in sales unit
LOGIC_1 TYPE WMENG, "Backorder Quantity
VRKME TYPE STRING, "Sales unit
WADAT TYPE EDATU, "Goods issue date
WADAT1 TYPE EDATU,
EDATU TYPE EDATU, "Schedule line data
VRKME_1 TYPE STRING, "Sales Unit
INCO1 TYPE INCO1, "Incoterms
LFGSA TYPE STRING, "Overall delivery status of item
LIFSP TYPE STRING, "Line Item Block
LIFSK TYPE STRING, "Header block
SPSTG TYPE STRING, "Overall blocked status
WERKS TYPE WERKS_EXT, "Plant (Own or External)
END OF TP_DISPP.
For ALV Display-if cs rep and palnt is checked
TYPES: BEGIN OF TP_DISP,
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
AUART TYPE AUART, "Sales document type
VBELN TYPE VBELN, "Sales and distribution Doc no
BSTKD TYPE BSTKD, "Customer purchase order number
KUNNR_1 TYPE KUNNR, "Cs Rep Number
NAME1_1 TYPE NAME1, "Cs Rep Name
KUNNR_2 TYPE KUNNR, "Bill to Number
NAME1_2 TYPE NAME1, "Bill to Name
KUNNR_3 TYPE KUNNR, "Ship to Number
NAME1_3 TYPE NAME1, "Ship to Name
POSNR TYPE POSNR_VA, "Item number of the SD
MATNR TYPE MATNR, "Material Number
KDMAT TYPE MATNR_KU, "Material number used
VSTEL TYPE VSTEL, "Shipping point /Receiving
NETPR TYPE NETPR, "Net price
NETWR TYPE NETWR_AP,
WAERK TYPE WAERK, "Currency
ZTERM TYPE DZTERM, "Terms of payment key
WMENG TYPE WMENG, "Order quantity in sales
LOGIC_1 TYPE WMENG, "Backorder Quantity
VRKME TYPE STRING, "Sales unit
WADAT TYPE EDATU, "Goods issue date
WADAT1 TYPE EDATU,
VRKME_1 TYPE STRING, "Sales Unit
EDATU TYPE EDATU, "Schedule line date
INCO1 TYPE INCO1, "Incoterms
LFGSA TYPE STRING, "Overall delivery status of
LIFSP TYPE STRING, "Line Item Block
LIFSK TYPE STRING, "Header block
SPSTG TYPE STRING, "Overall blocked status
WERKS TYPE WERKS_EXT, "Plant (Own or External)
END OF TP_DISP.
*& INTERNAL TABLES *
Internal Tables used for Data Selection
DATA: T_VBAK TYPE STANDARD TABLE OF TP_VBAK WITH HEADER LINE,
T_VBPA TYPE STANDARD TABLE OF TP_VBPA WITH HEADER LINE,
T_VBAP TYPE STANDARD TABLE OF TP_VBAP WITH HEADER LINE,
T_VBKD TYPE STANDARD TABLE OF TP_VBKD WITH HEADER LINE,
T_VBEP TYPE STANDARD TABLE OF TP_VBEP WITH HEADER LINE,
T_VBEP1 TYPE STANDARD TABLE OF TP_VBEP WITH HEADER LINE,
T_VBUP TYPE STANDARD TABLE OF TP_VBUP WITH HEADER LINE,
T_ADRC TYPE STANDARD TABLE OF TP_ADRC WITH HEADER LINE,
T_DISPC TYPE STANDARD TABLE OF TP_DISPC WITH HEADER LINE,
T_DISPP TYPE STANDARD TABLE OF TP_DISPP WITH HEADER LINE,
T_DISP TYPE STANDARD TABLE OF TP_DISP WITH HEADER LINE.
{23-8-2007
DATA: T_VBUK TYPE STANDARD TABLE OF TP_VBUK WITH HEADER LINE,
T_TVLST TYPE STANDARD TABLE OF TP_TVLST WITH HEADER LINE,
T_TVLST1 TYPE STANDARD TABLE OF TP_TVLST WITH HEADER LINE,
T_VBFA TYPE STANDARD TABLE OF TP_VBFA WITH HEADER LINE.
Variables used for ALV Display *
DATA:
W_REPID TYPE SY-REPID, " Report name
W_POS TYPE I VALUE 0, " Column position indicator
W_LAYOUT TYPE SLIS_LAYOUT_ALV, " Layout
W_DATUM(10) TYPE C, " Run date
W_TIME(8) TYPE C. " Run time
Tables used for ALV Display *
DATA : T_GROUP TYPE SLIS_T_SP_GROUP_ALV WITH HEADER LINE,
"Grouping of field
T_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
"sorting of the field
T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
" Field description
T_TOP TYPE SLIS_T_LISTHEADER. " Header for the ALV
Work Area used for ALV Display
DATA : WA_TOP LIKE LINE OF T_TOP. " Work Area for Header
*& SELECTION SCREEN *
Selection
SELECTION-SCREEN BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-T01.
"Sales Organization details
SELECT-OPTIONS: S_VKORG FOR VBAK-VKORG OBLIGATORY.
"Sales Organization
SELECT-OPTIONS: S_VTWEG FOR VBAK-VTWEG .
"Distribution Channel
SELECT-OPTIONS: S_KUNNR1 FOR VBPA-KUNNR . "CS Rep Number
SELECT-OPTIONS: S_WERKS FOR VBAP-WERKS. "Plant
SELECTION-SCREEN END OF BLOCK B01.
SELECTION-SCREEN BEGIN OF BLOCK B02 WITH FRAME TITLE TEXT-T02.
"Additional Selections
SELECT-OPTIONS: S_KUNNR2 FOR VBPA-KUNNR . "Bill to party
SELECT-OPTIONS: S_KUNNR3 FOR VBPA-KUNNR . "Ship to party
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN . "Saler Order
SELECT-OPTIONS: S_MATNR FOR VBAP-MATNR . "Material Number
SELECT-OPTIONS: S_KDMAT FOR VBAP-KDMAT . "Customer Material Number
SELECT-OPTIONS: S_AUART FOR VBAK-AUART . "Sales Order Type
SELECTION-SCREEN END OF BLOCK B02.
SELECTION-SCREEN BEGIN OF BLOCK B03 WITH FRAME TITLE TEXT-T03.
"Date Selection
SELECT-OPTIONS: S_ERDAT FOR VBAK-ERDAT OBLIGATORY.
"Order Creation Date
PARAMETER: P_PLANT AS CHECKBOX. "Backorder Plant
PARAMETER: P_CSREP AS CHECKBOX. "Backorder CSREP number
SELECTION-SCREEN END OF BLOCK B03.
*& AT SELECTION SCREEN *
*Validation Sales Organisation
AT SELECTION-SCREEN ON S_VKORG.
IF NOT S_VKORG[] IS INITIAL.
SELECT VKORG UP TO 1 ROWS FROM TVKO
BYPASSING BUFFER
INTO S_VKORG
WHERE VKORG IN S_VKORG.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E01.
"Enter a valid Sales Organization
ENDIF.
ENDIF.
*Validation Distribution Channel
AT SELECTION-SCREEN ON S_VTWEG.
IF NOT S_VTWEG[] IS INITIAL.
SELECT VTWEG UP TO 1 ROWS FROM TVTW
BYPASSING BUFFER
INTO S_VTWEG
WHERE VTWEG IN S_VTWEG.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E02.
"Enter a valid Distribution channel
ENDIF.
ENDIF.
*Validation Customer service rep number
AT SELECTION-SCREEN ON S_KUNNR1.
IF NOT S_KUNNR1[] IS INITIAL.
SELECT KUNNR UP TO 1 ROWS FROM KNA1
INTO S_KUNNR1
WHERE KUNNR IN S_KUNNR1.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E03.
"Enter a valid Customer Service rep number
ENDIF.
ENDIF.
*Validation Plant
AT SELECTION-SCREEN ON S_WERKS.
IF NOT S_WERKS[] IS INITIAL.
SELECT WERKS UP TO 1 ROWS
FROM T001W
INTO S_WERKS
BYPASSING BUFFER
WHERE WERKS IN S_WERKS.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E04. "Enter a valid Plant
ENDIF.
ENDIF.
*Validation Bill to number
AT SELECTION-SCREEN ON S_KUNNR2.
IF NOT S_KUNNR2[] IS INITIAL.
SELECT KUNNR UP TO 1 ROWS FROM KNA1
INTO S_KUNNR2
WHERE KUNNR IN S_KUNNR2.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E05. "Enter a valid Bill to number
ENDIF.
ENDIF.
*Validation Ship to Number
AT SELECTION-SCREEN ON S_KUNNR3.
IF NOT S_KUNNR3[] IS INITIAL.
SELECT KUNNR UP TO 1 ROWS FROM KNA1
INTO S_KUNNR3
WHERE KUNNR IN S_KUNNR3.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E06. "Enter a valid Ship to number
ENDIF.
ENDIF.
*Validation Order Number
AT SELECTION-SCREEN ON S_VBELN.
IF NOT S_VBELN[] IS INITIAL.
SELECT VBELN UP TO 1 ROWS FROM VBUK
INTO S_VBELN
WHERE VBELN IN S_VBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E07. "Enter a valid Order number
ENDIF.
ENDIF.
*Validation Material Number
AT SELECTION-SCREEN ON S_MATNR.
IF NOT S_MATNR[] IS INITIAL.
SELECT MATNR UP TO 1 ROWS FROM MARA
INTO S_MATNR
WHERE MATNR IN S_MATNR.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E08. "Enter a valid Material number
ENDIF.
ENDIF.
*Validation Customer Material Number
AT SELECTION-SCREEN ON S_KDMAT.
IF NOT S_KDMAT[] IS INITIAL.
SELECT KDMAT UP TO 1 ROWS
FROM KNMT
INTO S_KDMAT
WHERE VKORG IN S_VKORG AND
VTWEG IN S_VTWEG AND
KDMAT IN S_KDMAT.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E09.
"Enter a valid Customer Material number
ENDIF.
ENDIF.
*Validation Salea order type
AT SELECTION-SCREEN ON S_AUART.
IF NOT S_AUART[] IS INITIAL.
SELECT AUART UP TO 1 ROWS FROM TVAK
INTO S_AUART
BYPASSING BUFFER
WHERE AUART IN S_AUART.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E10.
"Enter a valid Sales Order type
ENDIF.
ENDIF.
*Validation for Plant / CS rep .
AT SELECTION-SCREEN .
IF NOT ( ( P_PLANT = C_X ) OR ( P_CSREP = C_X ) ).
MESSAGE E000 WITH TEXT-E12. "Choose the Plant or CSrep
ENDIF.
IF ( P_PLANT = C_X ) AND S_WERKS IS INITIAL.
MESSAGE E000 WITH TEXT-E13. "Enter Plant
ENDIF.
IF ( P_CSREP = C_X ) AND S_KUNNR1 IS INITIAL.
MESSAGE E000 WITH TEXT-E14. " Enter CSREP number
ENDIF.
*& START OF SELECTION *
START-OF-SELECTION.
Clear Work Areas/Variables and Clear/Refresh Internal Tables
PERFORM CLEAR_REFRESH.
Selection of Data as per inputs
PERFORM DATA_SELECTION.
Populate Internal table for display
PERFORM DATA_FILL_FOR_DISPLAY.
*& END OF SELECTION *
END-OF-SELECTION.
IF NOT T_DISP[] IS INITIAL.
*Populating the field catalog for ALV Display if plant and csrep is
*checked.
PERFORM POPULATE_FIELD_CATALOG.
PERFORM DISPLAY.
ELSEIF T_DISPP[] IS NOT INITIAL.
*Populating the field catalog for ALV Display if plant is checked.
PERFORM POPULATE_FIELD_CATALOG.
PERFORM DISPLAY.
ELSEIF T_DISPC[] IS NOT INITIAL.
*Populating the field catalog for ALV Display if csrep is checked.
PERFORM POPULATE_FIELD_CATALOG.
PERFORM DISPLAY.
ELSE.
MESSAGE I000 WITH TEXT-E15. "No Data found for Selection Criteria
ENDIF.
Clear Work Areas/Variables and Clear/Refresh Internal Tables
PERFORM CLEAR_REFRESH.
*& Form CLEAR_REFRESH
Clear Work Areas/Variables and Clear/Refresh Internal Tables
FORM CLEAR_REFRESH .
Clear Variables/Work Areas/Internal Tables
CLEAR: W_REPID,
W_POS,
W_LAYOUT,
W_DATUM,
W_TIME,
T_VBAK,
T_VBKD,
T_VBPA,
T_VBAP,
T_VBEP,
T_VBUP,
T_DISPC,
T_DISPP,
T_DISP,
T_VBUK,
T_TVLST,
T_TVLST1.
Refresh Internal Tables
REFRESH: T_VBAK,
T_VBKD,
T_VBPA,
T_VBAP,
T_VBEP,
T_VBUP,
T_DISPC,
T_DISPP,
T_DISP,
T_VBUK,
T_TVLST,
T_TVLST1.
ENDFORM. " CLEAR_REFRESH
*& Form DATA_SELECTION
Selection of Data as per inputs
FORM DATA_SELECTION .
*Obtain Sales and distribution document number,Date on which the record
*was created
*Sales document type,Delivery block,Sales organisation,
Distribution channel based on selection criteria
SELECT VBELN "Sales and distribution Doc no
ERDAT
"Date on which the record was created
AUART "Sales document type
LIFSK "Delivery block
VKORG "Sales organisation
VTWEG "Distribution channel
FROM VBAK
INTO TABLE T_VBAK
WHERE VBELN IN S_VBELN AND
ERDAT IN S_ERDAT AND
AUART IN S_AUART AND
VKORG IN S_VKORG AND
VTWEG IN S_VTWEG.
IF SY-SUBRC EQ 0.
SORT T_VBAK BY VBELN .
*Obtain Sales document ,Sales document item,Material Number,Material
*number used by customer
Safer point ,Plant (Own or External),Shipping point /Receiving point
Net price based on selection criteria
SELECT A~VBELN "Sales document
A~POSNR "Sales document item
MATNR "Material Number
PSTYV "Sales document item category
KDMAT "Material number used by customer
VRKME "Sales unit
WERKS "Plant (Own or External)
VSTEL "Shipping point /Receiving point
NETPR "Net price
*MOD02 {
NETWR
*}MOD02
WAERK "Target outline doc currency
FROM VBAP AS A JOIN VBUP AS B
ON ( AVBELN = BVBELN
AND APOSNR = BPOSNR )
INTO TABLE T_VBAP
FOR ALL ENTRIES IN T_VBAK
WHERE A~VBELN = T_VBAK-VBELN AND
A~MATNR IN S_MATNR AND
A~PSTYV NE C_TAPA AND
A~KDMAT IN S_KDMAT AND
A~WERKS IN S_WERKS AND
A~ABGRU EQ SPACE AND
B~LFSTA NE 'C'.
IF SY-SUBRC EQ 0.
SORT T_VBAP BY VBELN POSNR.
ENDIF.
SELECT VBELV
POSNV
FROM VBFA
INTO TABLE T_VBFA
FOR ALL ENTRIES IN T_VBAP
WHERE VBELV = T_VBAP-VBELN
AND POSNV = T_VBAP-POSNR
AND VBTYP_N = 'J'.
IF SY-SUBRC = 0.
SORT T_VBFA BY VBELV POSNV.
LOOP AT T_VBAP.
*READ TABLE T_VBFA WITH KEY VBELV = T_VBAP-VBELN POSNV = T_VBAP-POSNR.
IF SY-SUBRC = 0.
DELETE T_VBAP.
ENDIF.
ENDLOOP.
ENDIF.
{ 23-8-2007
SELECT LIFSP
VTEXT
FROM TVLST
INTO TABLE T_TVLST
FOR ALL ENTRIES IN T_VBAK
WHERE SPRAS EQ C_E AND
LIFSP = T_VBAK-LIFSK.
IF SY-SUBRC EQ 0.
SORT T_TVLST BY LIFSP.
ENDIF.
*Obtain Sales and distribution document number,Item number of the SD
*document ,Incoterms,Terms of payment key,Customer purchase order number
*based on selection criteria
SELECT VBELN "Sales and distribution document number
POSNR "Item number of the SD document
INCO1 "Incoterms
ZTERM "Terms of payment key
BSTKD "Customer purchase order number
FROM VBKD INTO TABLE T_VBKD
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBKD BY VBELN .
ENDIF.
*Obtain Sales document,Sales Document Item,Schedule line,Schedule line
*data, Order quantity in sales unit,Confirmed quantity,Goods issue date,
*Schedule line blocked for delivery based on selection criteria
SELECT VBELN "Sales document
POSNR "Sales Document Item
ETENR "Schedule line
EDATU "Schedule line data
CMENG "Order quantity in sales unit
BMENG "Confirmed quantity
LMENG
WADAT "Goods issue date
LIFSP "Schedule line blocked for delivery
FROM VBEP INTO TABLE T_VBEP
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN AND
ETENR = C_0001.
IF SY-SUBRC EQ 0.
SORT T_VBEP BY VBELN POSNR ETENR.
{ 23-8-2007
SELECT LIFSP
VTEXT
FROM TVLST
INTO TABLE T_TVLST1
FOR ALL ENTRIES IN T_VBEP
WHERE SPRAS EQ C_E AND
LIFSP = T_VBEP-LIFSP.
IF SY-SUBRC EQ 0.
SORT T_TVLST1 BY LIFSP.
ENDIF.
ENDIF.
SELECT VBELN "Sales document
POSNR "Sales Document Item
ETENR "Schedule line
EDATU "Schedule line data
CMENG "Order quantity in sales unit
BMENG "Confirmed quantity
LMENG
WADAT "Goods issue date
LIFSP
"Schedule line blocked for delivery
FROM VBEP INTO TABLE T_VBEP1
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN .
IF SY-SUBRC EQ 0.
SORT T_VBEP1 BY VBELN POSNR .
ENDIF.
{ 23-8-2007
SELECT VBELN "Sales and Distribution Document Number
SPSTG "Overall blocked status
*MOD02 {
CMGST
*}MOD02
FROM VBUK
INTO TABLE T_VBUK
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN
AND ( CMGST = 'A' OR CMGST = 'D' ).
IF SY-SUBRC EQ 0.
SORT T_VBUK BY VBELN .
ENDIF.
*Obtain Sales and distribution Doc no,Item number of the SD document
Overall delivery status of item
SELECT VBELN "Sales and distribution Doc no
POSNR "Item number of the SD document
LFGSA "Overall delivery status of item
FROM VBUP
INTO TABLE T_VBUP
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBUP BY VBELN POSNR.
ENDIF.
*Obtain Sales and distribution document number,Partner function
Customer Number 1,address based on selection criteria
SELECT VBELN "Sales and distribution Doc no
PARVW " Patner function
KUNNR "Customer No1
ADRNR "address
FROM VBPA
INTO TABLE T_VBPA
FOR ALL ENTRIES IN T_VBAP
WHERE VBELN = T_VBAP-VBELN AND
( ( KUNNR IN S_KUNNR1 ) OR
( KUNNR IN S_KUNNR2 ) OR
( KUNNR IN S_KUNNR3 ) ) AND
( ( PARVW = C_ZR ) OR
( PARVW = C_BP ) OR
( PARVW = C_SH ) ).
IF SY-SUBRC EQ 0.
SORT T_VBPA BY VBELN PARVW.
IF NOT T_VBPA[] IS INITIAL.
*Obtain Address number ,name
SELECT ADDRNUMBER "Address number
DATE_FROM "Date valid from
NATION "International address version ID
NAME1 "name
FROM ADRC
INTO TABLE T_ADRC
FOR ALL ENTRIES IN T_VBPA
WHERE ADDRNUMBER = T_VBPA-ADRNR.
IF SY-SUBRC EQ 0.
SORT T_ADRC BY ADDRNUMBER.
ENDIF.
ENDIF.
ELSE.
MESSAGE I000 WITH TEXT-S02."No Data For the Entered CS rep number
STOP.
ENDIF.
ELSE.
MESSAGE I000 WITH TEXT-S01.
"No data found for the selection criteria
STOP.
ENDIF.
ENDFORM. " DATA_SELECTION
*& Form DATA_FILL_FOR_DISPLAY
Populate Internal table for display
FORM DATA_FILL_FOR_DISPLAY .
DATA: L_NETPR TYPE NETPR. "For net amount
DATA: L_DATE TYPE EDATU. "For Date Field
DATA: L_WMENG TYPE WMENG. "For Confirmed Quantity
DATA: L_BMENG TYPE BMENG. "For Delivered Quantity
DATA : L_LAST_DATE TYPE EDATU.
DATA : W_FG TYPE C.
DATA : L_TABIX TYPE SY-TABIX.
DATA: L_CNT TYPE I,
L_NETWR TYPE NETWR.
*If plant and csrep are selected.
IF ( ( P_PLANT = C_X ) AND ( P_CSREP = C_X ) ).
LOOP AT T_VBAP.
CLEAR W_FG.
CLEAR L_CNT.
*MOD02 {
READ TABLE T_VBUK WITH KEY VBELN = T_VBAP-VBELN.
IF SY-SUBRC = 0.
*}MOD02
LOOP AT T_VBEP1 WHERE VBELN = T_VBAP-VBELN AND POSNR =
T_VBAP-POSNR.
L_CNT = L_CNT + 1.
IF L_LAST_DATE IS NOT INITIAL AND W_FG NE 'X'.
IF L_LAST_DATE NE T_VBEP1-WADAT.
W_FG = 'X'.
ENDIF.
ENDIF.
L_LAST_DATE = T_VBEP1-WADAT.
ENDLOOP.
IF L_CNT = 1 AND T_VBEP1-BMENG = 0.
W_FG = 'X'.
ENDIF.
IF W_FG = 'X'.
READ TABLE T_VBEP WITH KEY VBELN = T_VBAP-VBELN
POSNR = T_VBAP-POSNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
*Move Order quantity in sales unit to final internal table
MOVE T_VBEP-WMENG TO T_DISP-WMENG.
MOVE T_VBEP-WADAT TO T_DISP-WADAT1.
*Move Goods issue date to final internal table
MOVE T_VBEP-EDATU TO T_DISP-WADAT.
{ 23-8-2007
READ TABLE T_TVLST1 WITH KEY LIFSP = T_VBEP-LIFSP
BINARY SEARCH.
IF SY-SUBRC EQ 0.
CONCATENATE T_VBEP-LIFSP
T_TVLST1-VTEXT
INTO T_DISP-LIFSP
SEPARATED BY SPACE.
ENDIF.
*Move the Schedule line blocked for delivery
to final internal table.
ENDIF.
*LOOP AT T_VBEP1 WHERE VBELN = T_VBAP-VBELN AND POSNR = T_VBAP-POSNR.
LOOP AT T_VBEP1 WHERE VBELN = T_VBAP-VBELN AND POSNR =
T_VBAP-POSNR.
L_WMENG = T_VBEP1-WMENG + L_WMENG.
L_BMENG = T_VBEP1-BMENG + L_BMENG.
IF NOT L_DATE IS INITIAL.
IF ( L_DATE < T_VBEP1-EDATU ).
L_DATE = T_VBEP1-EDATU.
ENDIF.
ELSE.
L_DATE = T_VBEP1-EDATU.
ENDIF.
AT END OF POSNR.
READ TABLE T_VBEP1 INDEX SY-TABIX.
IF SY-SUBRC = 0.
L_DATE = T_VBEP1-EDATU.
ENDIF.
ENDAT.
ENDLOOP.
IF T_VBEP1-WMENG EQ T_VBEP1-BMENG.
T_DISP-LOGIC_1 = 0.
T_DISP-EDATU = T_VBEP1-EDATU.
ELSEIF L_WMENG EQ L_BMENG .
T_DISP-EDATU = L_DATE.
T_DISP-LOGIC_1 = L_WMENG.
ELSE.
T_DISP-EDATU = C_BLANK.
T_DISP-LOGIC_1 = L_WMENG.
ENDIF.
*Move the Sales document item to final internal table.
MOVE T_VBAP-POSNR TO T_DISP-POSNR.
*Move the Material Number to final internal table.
MOVE T_VBAP-MATNR TO T_DISP-MATNR.
*Move the Material number used by customer to final internal table.
MOVE T_VBAP-KDMAT TO T_DISP-KDMAT.
*Move the Shipping point to final internal table.
MOVE T_VBAP-VSTEL TO T_DISP-VSTEL.
*Move the Sales unit to final internal table.
PERFORM UNIT1 USING T_VBAP-VRKME CHANGING T_VBAP-VRKME.
MOVE T_VBAP-VRKME TO T_DISP-VRKME.
MOVE T_VBAP-VRKME TO T_DISP-VRKME_1.
*Move the Plant (Own or External) to final internal table.
MOVE T_VBAP-WERKS TO T_DISP-WERKS.
MOVE T_VBAP-WAERK TO T_DISP-WAERK.
*Move the Net price to final internal table.
IF T_VBAP-WAERK = C_US .
L_NETPR = T_VBAP-NETPR.
L_NETPR = L_NETPR / 100.
T_DISP-NETPR = L_NETPR.
CLEAR L_NETPR.
ELSE.
MOVE T_VBAP-NETPR TO T_DISP-NETPR.
ENDIF.
CLEAR L_NETPR.
*MOD02{
IF T_VBAP-WAERK = C_US .
L_NETWR = T_VBAP-NETWR.
L_NETWR = L_NETWR / 100.
T_DISP-NETWR = L_NETWR.
CLEAR L_NETWR.
ELSE.
MOVE T_VBAP-NETWR TO T_DISP-NETWR.
ENDIF.
CLEAR L_NETWR.
*}MOD02
*READ THE TABLE VBAK TO FETCH Sales Order Number,sales
*organisation,distribution channel,Document type,Delivery block
READ TABLE T_VBAK WITH KEY VBELN = T_VBEP-VBELN BINARY SEARCH.
IF SY-SUBRC EQ 0.
*Move the Sales order number to final internal table.
MOVE T_VBAK-VBELN TO T_DISP-VBELN.
PERFORM DELETE_LEADING_ZEROES CHANGING T_DISP-VBELN.
*Move the Sales organisation to final internal table.
MOVE T_VBAK-VKORG TO T_DISP-VKORG.
*Move the Distribution channel to final internal table.
MOVE T_VBAK-VTWEG TO T_DISP-VTWEG.
*Move the Document type to final internal table.
MOVE T_VBAK-AUART TO T_DISP-AUART.
{23-8-2007
READ TABLE T_TVLST WITH KEY LIFSP = T_VBAK-LIFSK
BINARY SEARCH.
IF SY-SUBRC EQ 0.
CONCATENATE T_VBAK-LIFSK
T_TVLST-VTEXT
INTO T_DISP-LIFSK
SEPARATED BY SPACE.
ENDIF.
ENDIF.
*READ THE TABLE VBKD TO FETCH Incoterms,Terms of payment key,Customer
*purchase order number
READ TABLE T_VBKD WITH KEY VBELN = T_VBAP-VBELN
BINARY SEARCH.
IF SY-SUBRC EQ 0.
*Move the Customer purchase order number to final internal table.
MOVE T_VBKD-BSTKD TO T_DISP-BSTKD.
*Move the Incoterms to final internal table.
MOVE T_VBKD-INCO1 TO T_DISP-INCO1.
*Move the Terms of payment to final internal table.
MOVE T_VBKD-ZTERM TO T_DISP-ZTERM.
ENDIF.
{ 23-8-2007
READ TABLE T_VBUK WITH KEY VBELN = T_VBEP-VBELN
BINARY SEARCH.
IF SY-SUBRC EQ 0.
IF T_VBUK-SPSTG EQ SPACE.
T_DISP-SPSTG = TEXT-TE1. "Not Blocked
ELSEIF T_VBUK-SPSTG EQ C_C.
T_DISP-SP -
Hi,
can any one guide me in soving this issue. The issue is when i executing the gate entry table in se16 in getting dump error "DBIF RSQLSQL_ERROR"
Runtime Error DBIF_RSQL_SQL_ERROR
Except. CX_SY_OPEN_SQL_DB
Date and Time 28.04.2008 11:03:32
ShrtText
An SQL error occurred when accessing a table.
What can you do?
Make a note of the actions and input which caused the error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
How to correct the error
Database error text........: "Column COMINV not in specified tables. MSGID=
Job=055461/BDP00/WP00"
Internal call code.........: "[RSQL/OPEN//CVS/TA_GTHDR ]"
Please check the entries in the system log (Transaction SM21).
You may able to find an interim solution to the problem
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:
"DBIF_RSQL_SQL_ERROR" CX_SY_OPEN_SQL_DBC
"/1BCDWB/DB/CVS/TA_GTHDR" or "/1BCDWB/DB/CVS/TA_GTHDR"
"START-OF-SELECTION"
If you cannot solve the problem yourself and you wish to send
an error message to SAP, include the following documents:
1. A printout of the problem description (short dump)
To obtain this, select in the current display "System->List->
Save->Local File (unconverted)".
2. A suitable printout of the system log
To obtain this, call the system log through transaction SM21.
Limit the time interval to 10 minutes before and 5 minutes
after the short dump. In the display, then select the function
"System->List->Save->Local File (unconverted)".
3. If the programs are your own programs or modified SAP programs,
supply the source code.
To do this, select the Editor function "Further Utilities->
Upload/Download->Download".
4. Details regarding the conditions under which the error occurred
or which actions and input led to the error.
System environment
SAP Release.............. "640"
Application server....... "PRDSAPBD"
Network address.......... "131.0.0.15"
Operating system......... "OS400"
Release.................. "5.3"
Hardware type............ "0065000655EC"
Character length......... 8 Bits
Pointer length........... 64 Bits
Work process number...... 0
Short dump setting....... "full"
Database server.......... "PRDSAPBD"
Database type............ "DB400"
Database name............ "BDP"
Database owner........... "R3BDPDATA"
Character set............ "en_US.ISO8859-1"
SAP kernel............... "640"
Created on............... "Jul 9 2006 22:10:13"
Created in............... "AIX 1 5 00538A4A4C00 (iSeries)"
Database version......... "DB4_52"
Patch level.............. "137"
Patch text............... " "
Supported environment....
Database................. "V5R2, V5R3, V5R4"
SAP database version..... "640"
Operating system......... "OS400 2 5, OS400 3 5, OS400 4 5"
Memory usage.............
Roll..................... 16128
EM....................... 12569784
Heap..................... 0
Page..................... 49152
MM Used.................. 1508288
MM Free.................. 2679120
SAP Release.............. "640"
User and Transaction
Client.............. 009
User................ "INTBASIS"
Language key........ "E"
Transaction......... "SE16 "
Program............. "/1BCDWB/DB/CVS/TA_GTHDR"
Screen.............. "SAPMSSY0 1000"
Screen line......... 6
Information on where terminated
The termination occurred in the ABAP program "/1BCDWB/DB/CVS/TA_GTHDR" in
"START-OF-SELECTION".
The main program was "/1BCDWB/DB/CVS/TA_GTHDR ".
The termination occurred in line 547 of the source code of the (Include)
program "/1BCDWB/DB/CVS/TA_GTHDR"
of the source code of program "/1BCDWB/DB/CVS/TA_GTHDR" (when calling the
editor 5470).
Source Code Extract
Line
SourceCde
517
RSEUMOD-TBMAXSEL = MAX_SEL.
518
ELSEIF MAX_SEL = 0.
519
CLEAR RSEUMOD-TBMAXSEL.
520
ENDIF.
521
IMPORT G_DATA_EXIT FROM MEMORY ID MEM_ID.
522
IF SY-BATCH IS INITIAL AND G_DATA_EXIT IS INITIAL.
523
IMPORT ACTION FROM MEMORY ID MEM_ID.
524
ELSE.
525
ACTION = 'ANZE'.
526
concatenate '/1BCDWB/DB' '/CVS/TA_GTHDR' into g_dbdatakey-eu_name.
527
g_dbdatakey-username = c_all.
528
import sort_NAME_TAB to %_TAB2_sort
529
field_name_tab to %_TAB2_field
530
from database dbdata(DB) id g_dbdatakey.
531
if sy-subrc = 0.
532
delete from dbdata
533
where relid = 'DB' and
534
eu_name = g_dbdatakey-eu_name and
535
username = c_all.
536
describe table %_tab2_field lines %_l_lines.
537
if not %_l_lines is initial.
538
%_TAB2[] = %_tab2_field[].
539
endif.
540
endif.
541
ENDIF.
542
CASE ACTION.
543
WHEN 'ANZE'.
544
try.
545
SELECT * FROM /CVS/TA_GTHDR "client specified
546
APPENDING TABLE I/CVS/TA_GTHDR
>>>>>
UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
548
WHERE GTNUM IN I1
549
AND MJAHR IN I2.
550
551
CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS INTO xref.
552
IF xref->kernel_errid = 'SAPSQL_ESCAPE_WITH_POOLTABLE'.
553
message i412(mo).
554
exit.
555
ELSE.
556
RAISE EXCEPTION xref.
557
ENDif.
558
ENDTRY.
559
IF NOT G_DATA_EXIT IS INITIAL.
560
DATEN NICHT ANZEIGEN, SONDERN NACH AUßEN GEBEN
561
CALL FUNCTION G_DATA_EXIT
562
EXPORTING
563
TABNAME = /CVS/TA_GTHDR
564
TABLES
565
DATA = I/CVS/TA_GTHDR.
566
LEAVE.
Contents of system fields
Name
Val.
SY-SUBRC
0
SY-INDEX
0
SY-TABIX
1
SY-DBCNT
1
SY-FDPOS
0
SY-LSIND
0
SY-PAGNO
0
SY-LINNO
1
SY-COLNO
1
SY-PFKEY
SY-UCOMM
SY-TITLE
SY-MSGTY
I
SY-MSGID
SF
SY-MSGNO
616
SY-MSGV1
/1BCDWB/DB/CVS/TA_GTHDR
SY-MSGV2
RE
SY-MSGV3
EN
SY-MSGV4
Active Calls/Events
No. Ty. Program Include Line
Name
1 EVENT /1BCDWB/DB/CVS/TA_GTHDR /1BCDWB/DB/CVS/TA_GTHDR 547
START-OF-SELECTION
Chosen variables
Name
Val.
No. 1 Ty. EVENT
Name START-OF-SELECTION
%_SPACE
2
0
SY-REPID
/1BCDWB/DB/CVS/TA_GTHDR
2344454244245525454544522222222222222222
F123472F42F363F41F7484200000000000000000
RSEUMOD-TBMAXSEL
200
000C
0008
/CVS/TA_GTHDR
0000 000000000000000000000000000000000000
2222222222222333322222222222222222222222333333333333333333333333333333333333222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
<%_TABLE_/CVS/TA_GTHDR>
ENTRIES
0
0000
0000
SYST-REPID
/1BCDWB/DB/CVS/TA_GTHDR
2344454244245525454544522222222222222222
F123472F42F363F41F7484200000000000000000
%_DUMMY$$
2222
0000
INPUT_ENTRY
2
0
I1[]
Table IT_105[0x23]
PROGRAM=/1BCDWB/DB/CVS/TA_GTHDRDATA=I1[]
Table reference: 22
TABH+ 0(20) = 0000000000000000000000000000000000000000
TABH+ 20(20) = 00000016000000690000000000000017FFFFFFFF
TABH+ 40(16) = 0400000000002830000A249001000000
store = 0x0000000000000000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 22 (0x00000016)
label = 105 (0x00000069)
fill = 0 (0x00000000)
leng = 23 (0x00000017)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000174
occu = 10 (0x0000000A)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 0
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
SUBRC
0
0000
0000
I2[]
Table IT_107[0x11]
PROGRAM=/1BCDWB/DB/CVS/TA_GTHDRDATA=I2[]
Table reference: 24
TABH+ 0(20) = 0000000000000000000000000000000000000000
TABH+ 20(20) = 000000180000006B000000000000000BFFFFFFFF
TABH+ 40(16) = 04000000000028D8000A249001000000
store = 0x0000000000000000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 24 (0x00000018)
label = 107 (0x0000006B)
fill = 0 (0x00000000)
leng = 11 (0x0000000B)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000177
occu = 10 (0x0000000A)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 0
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
C_ALL
%_ALL
254442222222
5F1CC0000000
ULINE_LENGTH
0
0000
0000
I3[]
Table IT_108[0x23]
PROGRAM=/1BCDWB/DB/CVS/TA_GTHDRDATA=I3[]
Table reference: 25
TABH+ 0(20) = 0000000000000000000000000000000000000000
TABH+ 20(20) = 000000190000006C0000000000000017FFFFFFFF
TABH+ 40(16) = 0400000000002948000A249001000000
store = 0x0000000000000000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 25 (0x00000019)
label = 108 (0x0000006C)
fill = 0 (0x00000000)
leng = 23 (0x00000017)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000179
occu = 10 (0x0000000A)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 0
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
I/CVS/TA_GTHDR[]
Table IT_124[0x834]
PROGRAM=/1BCDWB/DB/CVS/TA_GTHDRDATA=I/CVS/TA_GTHDR[]
Table reference: 44
TABH+ 0(20) = 0000000000000000000000000000000000000000
TABH+ 20(20) = 0000002C0000007C0000000000000342FFFFFFFF
TABH+ 40(16) = 04000000000017C8001024C401000000
store = 0x0000000000000000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 44 (0x0000002C)
label = 124 (0x0000007C)
fill = 0 (0x00000000)
leng = 834 (0x00000342)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000099
occu = 16 (0x00000010)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
XREF
F0000000
F0000000
XREF->KERNEL_ERRID
SY-XPROG
SAPCNVE
5454454222222222222222222222222222222222
3103E65000000000000000000000000000000000
SY-MSGID
SF
54222222222222222222
36000000000000000000
PAGNO
0
0000
0000
Internal notes
The termination occurred in the function "HandleRsqlErrors" of the SAP
Basis System, specifically in line 759 of the module
"//bas/640_REL/src/krn/runt/absapsql.c#16".
The internal operation just processed is "SQLS".
The internal session was started at 20080428110327.
Internal call code.........: "[RSQL/OPEN//CVS/TA_GTHDR ]"
Active Calls in SAP Kernel
Lines of C Stack in Kernel (Structure Differs on Each Platform)
=> 64 bit R/3 Kernel
=> 64 bit OS400 Kernel
=> Heap limit = unlimited
=> Stack limit = unlimited
=> Core limit = unlimited
=> File size limit = unlimited
=> Heap address = 0x40000000000000009DF46B87C8DACBA0
=> Stack address = 0xfffffffffffb4a0
=> Stack low = 0xfffffffffffb4a0
=> Stack high = 0xffffffffffffa10
=> Stack Trace:
AixStack() at 0x10008ca60
CTrcStack2() at 0x10008cb58
rabax_CStackSave__Fv() at 0x100071c74
ab_rabax() at 0x10006eaa4
ab_rsqlerr__FPCciT1P11RS_HEADER94T1Pv() at 0x10086d218
HandleRsqlErrors__F9RsqlError9CloseMode() at 0x100ff8810
SqlsExecuteCall__FUcP11DynCallInfo() at 0x100ff6fac
ab_jsqls__Fv() at 0x100ff17dc
ab_extri__Fv() at 0x10090bb68
ab_xevent__FPCc() at 0x100928be4
ab_trigg__Fv() at 0x10092872c
ab_run() at 0x10108211c
N_ab_run() at 0x10107539c
dynpmcal() at 0x1010740e4
dynppai0() at 0x1010719e4
dynprctl() at 0x10107b590
dynpen00() at 0x10022b2c4
Thdynpen00() at 0x1000a71d0
TskhLoop() at 0x1000aba14
tskhstart() at 0x1000c046c
DpMain() at 0x10174f654
nlsui_main() at 0x101722dc8
__start() at 0x100000344
!!! Invalid stack address encountered: 0x0
!!! Stack corrupted.
Mon Apr 28 11:03:32 2008
Library
(SRV)PGM
Module
Function/Statement No.
QSYS
QP2USER
QP2API
__Qp2Fork 13
QSYS
QP2USER
QP2API
runpase_common__FiPvT2 5
R3640AOPT
O4PRTLIBC
AS4STACK
As4Stack_From_PASE 3
R3640AOPT
O4PRTLIBC
AS4STACK
As4StackOut 10
R3640AOPT
O4PRTLIBC
AS4STACK
MATINVS2_8O4_StackFv 8
List of ABAP programs affected
Index
Ty.
Program
Group
Date
Time
Size
Lang.
0
Prg
/1BCDWB/DB/CVS/TA_GTHDR
0
25.04.2008
17:54:15
114688
E
1
Prg
SAPMSSY0
1
24.01.2007
03:59:44
68608
E
2
Prg
SAPMSSYD
1
24.01.2007
03:59:44
17408
E
3
Prg
SAPFSYSCALLS
1
06.11.2003
20:52:59
6144
E
4
Prg
RSDBRUNT
0
24.01.2007
03:59:32
227328
E
5
Typ
RSSCR
0
: m:15
5120
6
Prg
RSDBSPBL
0
06.11.2003
20:56:48
59392
E
7
Prg
SAPDBD$S
0
06.11.2003
20:52:58
16384
E
8
Typ
VARID
0
12.05.1997
16:51:30
4096
9
Prg
%_CSYDB0
0
06.11.2003
20:52:42
28672
E
10
Prg
RSDBSPVA
0
24.01.2007
03:38:36
112640
E
11
Typ
RSVAMEMKEY
0
07.05.1997
13:07:49
2048
12
Prg
RSDBSPMC
0
24.01.2007
03:38:36
66560
E
13
Typ
DDSHDESCR
0
03.09.1997
03:05:16
3072
14
Typ
SPPARAMS
0
07.05.1997
13:10:38
2048
15
Typ
SPPARAMS
0
07.05.1997
13:10:38
2048
16
Prg
SAPLICON
16
12.11.2004
13:50:21
23552
E
17
Prg
%_CICON
16
16.03.2004
20:13:52
73728
E
18
Prg
SAPLSABE
18
06.11.2003
20:53:04
11264
E
19
Prg
SAPLSECU
19
24.01.2007
03:30:48
66560
E
20
Typ
RSSUBINFO
0
14.10.1999
22:01:03
3072
21
Prg
SAPLSETB
21
24.01.2007
03:51:50
259072
E
22
Prg
SAPLSLDB
22
31.08.2006
16:14:51
70656
E
23
Prg
SAPLSDIFRUNTIME
23
12.11.2004
13:45:30
82944
E
24
Typ
DDFIXVALUE
0
27.08.1999
18:04:56
2048
25
Typ
X031L
0
15.11.2000
18:03:28
5120
26
Typ
DFIES
0
09.11.2000
14:07:05
8192
27
Prg
SAPLSDNT
27
31.08.2006
14:37:01
201728
E
28
Prg
SAPLSUGS
28
30.08.2006
19:31:11
29696
E
29
Typ
DDFTX
0
05.11.1997
02:52:59
4096
30
Typ
X031L
0
15.11.2000
18:03:28
5120
31
Typ
DD03L
0
19.11.2001
15:49:29
5120
32
Prg
SAPLSDIF
32
12.11.2004
13:45:30
180224
E
33
Typ
DD03P
0
19.11.2001
15:46:27
11264
34
Typ
DD08V
0
20.08.1998
11:35:49
3072
35
Typ
DD12V
0
20.08.1998
11:35:57
4096
36
Typ
DD17V
0
20.08.1998
10:50:57
2048
37
Typ
DD35V
0
01.03.2001
12:21:53
2048
38
Typ
DD36M
0
01.03.2001
12:38:06
4096
39
Typ
DD02V
0
19.11.2001
15:50:56
6144
40
Typ
DD09V
0
27.08.1999
18:04:52
4096
41
Prg
SAPLSDTB
41
31.08.2006
14:13:30
386048
E
42
Typ
DDCACHE
0
30.03.1995
13:12:06
2048
43
Typ
DCTABDGET
0
13.05.1997
12:49:28
2048
44
Prg
SAPLSDSG
44
12.11.2004
13:45:30
112640
E
45
Prg
RADBTDDO
44
12.11.2004
13:45:30
34816
E
46
Prg
RADBTDDF
44
12.11.2004
13:45:30
237568
E
47
Typ
DD02L
0
19.11.2001
15:49:25
6144
48
Typ
DD02T
0
05.11.1997
02:52:47
2048
49
Typ
DDSTATE
0
07.05.1997
12:49:07
2048
50
Typ
DD05M
0
09.11.2000
14:06:49
3072
51
Typ
DD08L
0
05.11.1997
02:52:51
3072
52
Typ
DD08T
0
05.11.1997
02:52:51
2048
53
Prg
SAPLSDFK
53
06.11.2003
20:53:04
23552
E
54
Typ
DD05S
0
05.11.1997
02:52:51
3072
55
Typ
DD05V
0
05.11.1997
02:52:51
2048
56
Typ
DD03K
0
09.11.2000
14:25:24
2048
57
Typ
DCTABLGET
0
04.06.1997
19:16:24
2048
58
Typ
DD05Q
0
20.08.1998
11:35:44
2048
59
Typ
DD05Q
0
20.08.1998
11:35:44
2048
60
Typ
DD02V
0
19.11.2001
15:50:56
6144
61
Typ
DD02V
0
19.11.2001
15:50:56
6144
62
Typ
RSEUMOD
0
06.11.2003
20:36:53
36864
63
Prg
SAPLALDB
63
31.08.2006
16:20:50
264192
E
64
Typ
NODE_STRUC
0
10.11.1999
17:41:51
2048
65
Typ
TRDIR
0
02.11.1998
09:59:17
5120
66
Typ
RSEL_PARAS
0
05.09.1997
16:13:02
2048
67
Prg
SAPLDSYA
67
06.11.2003
20:53:01
39936
E
68
Prg
SAPFSDS1
67
06.11.2003
20:53:24
47104
E
69
Typ
TDCLD
0
02.11.1998
09:51:35
5120
70
Prg
SAPLSDOD
70
31.08.2006
16:19:53
39936
E
71
Typ
DOKIL
0
12.05.1997
16:46:17
3072
72
Prg
SAPCNVE
72
06.11.2003
20:52:58
6144
E
73
Prg
SAPLLANG
73
06.11.2003
20:53:03
8192
E
74
Typ
T002
0
14.02.1998
10:24:58
2048
75
Typ
RSEXFCODE
0
13.08.1997
12:52:57
1024
76
Prg
SAPFSPOR
0
31.08.2006
19:27:43
12288
E
77
Typ
RSSELINT
0
04.04.1995
16:12:37
2048
78
Prg
SAPLKGJH
78
06.11.2003
20:53:03
8192
E
79
Typ
RSPARINT
0
10.04.1995
09:58:38
1024
80
Prg
SAPLSCNT
80
06.11.2003
20:53:04
24576
E
81
Typ
DYCBOX
0
20.08.1998
11:16:53
2048
82
Prg
SAPLSVSM
82
31.08.2006
16:12:13
24576
E
83
Prg
SAPLSGUI
83
12.11.2004
13:59:56
61440
E
84
Prg
SAPLSTTM
84
31.08.2006
14:23:56
75776
E
85
Prg
SAPLSBDC
85
31.08.2006Hi,
as described in the error message:
The column COMINV is missing in table /CVS/TA_GTHDR !
You should check this table in SE11 for consistency of the DB object and the nametab - one of them will be wrong ...
Regards
Volker Gueldenpfennig, consolut international ag
http://www.consolut.de - http://www.4soi.de - http://www.easymarketplace.de -
Data source based on BI Cube (TCode CRMD_MKTDS)
Hi
We have a requirement to segment customers based on BI queries. This is done in transaction CRMD_MKTDS using Origin type Business Intelligence Cube. The problem is that the RFC-destination of the BI system does not show up in the list of possible entries. The only possible entry that is shown is the RFC destination for our interactive reporting client. The RFC-destination for the BI system does exist in CRM and it's working fine. If we choose InfoSet as the origin type all the RFCs show up (including the one to BI), but when the origin type Business Intelligence Cube is used the RFC is missing. Any ideas?Hi,
The
Function Module : CRM_MKTTG_DS_RFC_F4
For Datasource = Infoset/ External list the RFC destinations are read directly from the table.
select RFCs
SELECT * FROM rfcdes
INTO CORRESPONDING FIELDS OF TABLE lt_f4_com_rfc
BYPASSING BUFFER
WHERE RFCTYPE = '3'.
For BW datasource it is read as follows , the Function module 'RSA_RSBASIDOC_READ'gets data from statement
'SELECT * FROM RSBASIDOC INTO TABLE BASIDOC'
IF lv_sds_type = sourcetypes-bw_cube OR lv_sds_type = sourcetypes-el
only RFC-Dest from BW: check if destination is aconnected BW
CALL FUNCTION 'RSA_RSBASIDOC_READ'
TABLES
basidoc = lt_basidoc.
LOOP AT lt_f4_com_rfc INTO ls_f4_com_rfc.
READ TABLE lt_basidoc WITH KEY rlogsys = ls_f4_com_rfc-rfcdest
INTO ls_basidoc.
====== Hope this information provided ansers your query. -
Exception Error:"INFOCUBE_NOT_FOUND"
Hi,
I need one help in getting a virtual cube to be available for executing queries.
I have created some queries on virtual cube 0BCS_VC11 and transported to quality.But that cube is not working properly.When i selected that query for displaying data it is giving tha following exception error:
Like....,
*Short text*
*Exception condition "INFOCUBE_NOT_FOUND" raised.*
*What happened?*
*The current ABAP/4 program encountered an unexpected*
*situation.*
*Error analysis*
*A RAISE statement in the program "SAPLRSMDATASTATE" raised the exception*
*condition "INFOCUBE_NOT_FOUND".*
*Since the exception was not intercepted by a superior*
*program, processing was terminated.*
*Short description of exception condition:*
*For detailed documentation of the exception condition, use*
*Transaction SE37 (Function Library). You can take the called*
*function module from the display of active calls.*
Trigger Location of Runtime Error
Program SAPLRSMDATASTATE
Include LRSMDATASTATEU01
Row 25
Module type (FUNCTION)
Module Name RSM_DATASTATE_GET
Source Code Extract
Line SourceCde
1 FUNCTION RSM_DATASTATE_GET.
2 *"----
3 ""Lokale Schnittstelle:
4 *" IMPORTING
5 *" VALUE(I_INFOCUBE) TYPE RSD_INFOCUBE
6 *" VALUE(I_BYPASS_BUFFER) TYPE RS_BOOL DEFAULT RS_C_FALSE
7 *" EXPORTING
8 *" REFERENCE(E_S_DATASTATE) TYPE RRSM_S_DATASTATE
9 *" REFERENCE(E_REPORTING_RNSID) TYPE RSSID
10 *" EXCEPTIONS
11 *" INFOCUBE_NOT_FOUND
12 *"----
13
14 IF I_BYPASS_BUFFER = RS_C_FALSE.
15 SELECT SINGLE * FROM RSMDATASTATE
16 INTO E_S_DATASTATE
17 WHERE INFOCUBE = I_INFOCUBE.
18 ELSE.
SELECT SINGLE * BYPASSING BUFFER
FROM RSMDATASTATE
INTO E_S_DATASTATE
WHERE INFOCUBE = I_INFOCUBE.
ENDIF.
IF SY-SUBRC <> 0.
RAISE INFOCUBE_NOT_FOUND.
ENDIF.
if e_s_datastate-aggrexist = rs_c_true.
e_reporting_rnsid = e_s_datastate-rollup.
else.
e_reporting_rnsid = e_s_datastate-qualok.
endif.
ENDFUNCTION.
Can u please look into this and let me know the solution.now the queries which have been built on this cube are not executable.i ma not able to see its contents also.
Thanks in advanceThis issue is resolved
-
Performance Tuning in case of Database Access
Hi,
I am using following code...database access is huge for this code...pls help me out to make database access minimum. I am using 3 internal tables.
select partner1 partner2 into (mtab-busi_part, mtab-BUT051_PART)
from but051.
Select name_first name_last PARTNER_GUID into (mtab-bp_first, mtab-bp_last, MTAB-R_PARTNER_GUID)
From but000 where partner = mtab-busi_part.
*MTAB-OBJECT_ID = ITAB-OBJECT_ID.
append mtab.
endselect.
ENDSELECT.
*ENDLOOP.
loop at mtab.
CONCATENATE mtab-bp_FIRST mtab-bp_LAST INTO mTAB-bp_full
separated BY SPACE.
modify mtab.
endloop.
loop at mtab.
if mtab-bp_full = ' '.
select name_org1 into (mtab-bp_full)
from but000 where partner = mtab-busi_part.
append mtab.
endselect.
endif.
modify mtab.
clear mtab.
endloop.
SELECT OBJECT_ID GUID INTO (NTAB-object_id, Ntab-guid)
FROM CRMD_ORDERADM_H
for all entries in itab
where process_type = '1001' and object_id in o_id.
select single date_1 date_2 from crmv_item_index into (ntab-date_1, ntab-date_2 )
where object_id = ntab-object_id.
endselect.
Select partner_no partner_fct into (Ntab-partner_guid, Ntab-partner_fct)
from bbp_pdview_bup where guid_hi = Ntab-guid .
*and partner_fct <> '00000015'
Select partner name_org1 into (Ntab-partner_no2, Ntab-others)
from but000 where partner_guid = Ntab-partner_guid.
if sy-subrc = 0.
SELECT SINGLE DESCRIPTION FROM CDBC_PARTNER_FT INTO NTAB-DESC
WHERE PARTNER_FCT = NTAB-PARTNER_FCT AND SPRAS = 'EN'.
endif.
SELECT PAFKT ABTNR PAAUTH
FROM BUT051 INTO corresponding fields of nTAB
WHERE PARTNER2 = ntab-partner_no2 .
if sy-subrc = 0.
SELECT single BEZ30 FROM TB913
INTO CORRESPONDING FIELDS OF nTAB
WHERE PAFKT = nTAB-PAFKT AND SPRAS = 'E'.
endif.
if sy-subrc = 0.
SELECT single BEZ20 FROM TB915
INTO CORRESPONDING FIELDS OF nTAB
WHERE PAAUTH = nTAB-PAAUTH AND SPRAS = 'E'.
endif.
*endselect.
if sy-subrc = 0.
SELECT single BEZ20 FROM TB911
INTO (nTAB-BEZ2)
WHERE ABTNR = nTAB-ABTNR AND SPRAS = 'E'.
endif.
endselect.
APPEND NTAB.
*clear ntab.
*ENDSELECT.
ENDSELECT.
*clear ntab.
ENDSELECT.
ENDSELECT.
loop at ntab.
if ntab-others = ' '.
select name_first name_last into (ntab-first_name1, ntab-last_name1)
from but000 where partner = ntab-partner_no2.
endselect.
CONCATENATE ntab-FIRST_NAME1 ntab-LAST_NAME1 INTO nTAB-others
separated BY SPACE.
endif.
modify ntab.
clear ntab.
endloop.
SORT NTAB BY GUID.
SELECT OBJECT_ID GUID INTO (KTAB-object_id, Ktab-guid)
FROM CRMD_ORDERADM_H
for all entries in itab
where process_type = '1001' and object_id in o_id.
Select partner_no into (Ktab-partner_no1)
From crmd_order_index where header = Ktab-guid and pft_8 = 'X' and object_type = 'BUS2000126'.
*endselect.
Select name_first name_last into (Ktab-first_name, Ktab-last_name)
From but000 where partner = Ktab-partner_no1.
*endselect.
APPEND KTAB.
ENDSELECT.
ENDSELECT.
ENDSELECT.
loop at Ktab.
CONCATENATE Ktab-FIRST_NAME Ktab-LAST_NAME INTO KTAB-RESP_EMPLOYEE
separated BY SPACE.
MODIFY KTAB.
clear Ktab.
endloop.
loop at Ktab.
if Ktab-RESP_EMPLOYEE = ' '.
select name_ORG1 into (Ktab-RESP_EMPLOYEE)
from but000 where partner = Ktab-partner_no1.
endselect.
endif.
modify Ktab.
clear Ktab.
endloop.
SELECT OBJECT_ID GUID INTO (itab-object_id, itab-guid)
FROM CRMD_ORDERADM_H
where process_type = '1001' and object_id in o_id.
append itab.
endselect.
LOOP AT iTAB.
LOOP AT NTAB .
IF NTAB-object_id = iTAB-object_id .
itab-date_1 = ntab-date_1.
ITAB-DESC = NTAB-DESC.
itab-partner_no2 = NTab-partner_no2.
itab-partner_fct = ntab-partner_fct.
itab-bez30 = ntab-bez30.
itab-bez20 = ntab-bez20.
itab-bez2 = ntab-bez2.
itab-others = ntab-others.
INSERT lines of nTAB INTO ITAB.
modify itab.
CLEAR ITAB.
delete itab where object_id = ' ' and partner_no2 = ' '.
ENDIF.
endloop.
endloop.
sort itab by OBJECT_ID descending PARTNER_NO2 .
delete adjacent duplicates from itab comparing partner_no2 object_id.
sort itab by OBJECT_ID descending PARTNER_NO2 .
loop at iTab where partner_fct = '00000015'.
LOOP AT mTAB WHERE BUT051_PART = iTAB-partner_no2 .
itab-busi_part = mtab-busi_part.
itab-bp_full = mtab-bp_full.
ITAB-R_PARTNER_GUID = MTAB-R_PARTNER_GUID.
INSERT LINES OF mTAB INTO iTAB.
modify itab transporting busi_part bp_full r_partner_guid.
endloop.
endloop.
sort itab by busi_part descending partner_no2.
delete itab where object_id = ' '.
loop at ITab.
LOOP AT KTAB.
IF KTAB-GUID = ITAB-GUID.
move Ktab-partner_no1 to itab-partner_no1.
move Ktab-R_partner_GUID to itab-R_partner_GUID.
move Ktab-RESP_EMPLOYEE to itab-RESP_EMPLOYEE.
modify itab.
ENDIF.
endloop.
endloop.Hi
i will give you some tips to reduce the daya base load please apply that
<b>Tips and Tricks</b>
Optimizing the load of the database
Using table buffering
Using buffered tables improves the performance considerably. Note that in some cases a statement can not be used with a buffered table, so when using these statements the buffer will be bypassed. These statements are:
Select DISTINCT
ORDER BY / GROUP BY / HAVING clause
Any WHERE clause that contains a sub query or IS NULL expression
JOIN s
A SELECT... FOR UPDATE
If you wan t to explicitly bypass the buffer, use the BYPASS BUFFER addition to the SELECT clause.
Optimizing the load of the database
2. Use the ABAP SORT Clause Instead of ORDER BY
The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The database server will usually be the bottleneck, so sometimes it is better to move the sort from the database server to the application server.
If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT statement to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the database server sort it.
Optimizing the load of the database
3. Avoid the SELECT DISTINCT Statement
As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplicate rows.
Additional Info
Use of CONTEXT can highly optimize the code.
Context can be created using Context Builder (SE33)
Context advantages: - no double fetch by DEMAND: 1. fetch, 2. get from buffer - more performance (best SELECT-statement) - better survey of code
Use of PARALLEL CURSOR increases the Performance to a great extent.
INDEXES help to speed up selection from the database. The primary index is always created automatically in the SAP System. It consists of the primary key fields of the database table. If you cannot use the primary index to determine a selection result (for example, WHERE condition may not contain any primary index fields), you can create a secondary index.
Optimal number of indexes for a table You should not create more than five secondary indexes for any one table because:
Whenever you change table fields that occur in the index, the index itself is also updated.
The amount of data increases.
The optimizer has too many chances to make mistakes by using the 'wrong' index.
If you are using more than one index for a database table, ensure that they do not overlap.
reward if useful -
No. of records in the table
Is any system table or a program that gives us the # of records by SAP metadata table name ?.. i have a list of table names & need to know the # of recs in all of them...so can try looking at the larger ones for analysis.. ?
Hi Venugopal,
if you want to know the no of records in a table follow these steps.
1)go to se11 and open the table
2)go to utilities->tablecontents->display
3)click on Number of Entries button which is application tollbar wihtout entering any values in the screen .
you will get the no of records existed in the table
if you want to know the no of records for all the tabels at a time then you have to write a program.follow the code below.
data:cnt type i.
SELECT COUNT(*) FROM mara BYPASSING BUFFER.
cnt = sy-dbcnt.
write:cnt.
you will get the no of records in the table in cnt.
rewards points if helpful.
Maybe you are looking for
-
how do I sync my "contacts" & IPhoto from my IMac to my IPad?
-
Non determination of Stock Determination Group while Backflushing
Hi, While doing Backflushing for an assembly, the system is not fetching the storage location according to the Stock determination group maintained in the material master of the child parts. Can anyone explain the reason and if possible give a soluti
-
i recently bought the N73 ME and the firmware is not updated and is of the original version. It has 2 GB card in it and the space utilised on the card is aroun200 Mb. The perfromance is a degraded one. Rebootin the phone and then taking out the batte
-
I have a second generation iPod (20GB) that I would like to give to a friend who has a PC. Can I reformat it for a PC and if so how?
-
How to specify which version of a function to use
I tried to do what it said, but that resulted in error PowershellPS C:\WINDOWS\system32> Import-dscResource -ModuleName @{ModuleName="xPSDesiredStateConfiguration";ModuleVersion="3.4.0.0"}Import-dscResource : The term 'Import-dscResource' is not reco