How to write BTree entries to distinct pages
Hi All,
I am writing concurrent transaction tests for my Java Library that uses a Berkeley-DB BTree. The intention of these tests are to assert that my library provide the advertised levels of isolation by using the underlying Berkeley locking correctly. Here is a simple example test:
--- Java ---
String setup = "setup: declare(X,Y,Z) ";
String writeY = "writeY: temp=X Y=1 write|commit";
String writeZ = "writeZ: temp=X Z=1 write|commit";
new ScenarioRunner(setup, writeY, writeZ).run();
In this test, I am simply checking that no conflicts occurred (shared reads, non-overlapping writes). However, to make the test work, I need to make sure that I create entries (X,Y,Z) on separate pages.
So how does one accomplish this?
My current (painful) solution to is create a set of test values and then select those values that appear on different pages to be used as X,Y,Z in the test. This is accomplished by reading the logs (using db4.6_printlog).
Your Ideas?
Thanks in Advance,
Roberto
Edited by: Roberto Faria on Apr 20, 2009 2:59 PM
Hi Roberto,
Just in case you are still in the look for a way to resolve.
Suppose that you have the database page size set to 512B. The size of an item (key or data item) that can be stored onto a leaf page will be approximately 128B (usually calculated as page_size/4). Any item exceeding this size will be forced onto an overflow page.
[http://www.oracle.com/technology/documentation/berkeley-db/db/ref/am_conf/pagesize.html|http://www.oracle.com/technology/documentation/berkeley-db/db/ref/am_conf/pagesize.html]
[http://www.oracle.com/technology/documentation/berkeley-db/db/ref/am_misc/diskspace.html|http://www.oracle.com/technology/documentation/berkeley-db/db/ref/am_misc/diskspace.html]
The actual formula for calculating the size of an overflow item looks like this: overflow_item_size = (page_size - page_overhead) / minimum_no_of_keys * 2 - item_overhead * 2
Remember that on a Btree database page the minimum number of keys that can be stored is 2 (each record requires 2 slots, one for the key, one for the data).
Now, you can pad your key and data items so that they extend up to this limit. You can set your page size to a 512B, pad the items so that they extend up to 111B (based on the formula mentioned above) and store the records you need but with some dummy records in between, such as (key | data):
keyX<pad_bytes> | dataForKeyX<pad_bytes>
keyXX<pad_bytes> | dataForKeyXX<pad_bytes> (dummy record)
keyZ<pad_bytes> | dataForKeyZ<pad_bytes>
keyZZ<pad_bytes> | dataForKeyZZ<pad_bytes> (dummy record)
The idea is that considering that by default a lexicographical comparison routine is used by BDB for key comparison, each record you need will be distributed onto a page with an ignorable/dummy record, hence you should end up with the keys you need on different leaf pages.
You'll have to adjust the number of padding bytes according to the page size and the size of your key/data items.
Regards,
Andrei
Similar Messages
-
How to write Resourebundle class for uix page
Our web application should support some different languages .I have took a look of "Internationalization" by help system but still not so clear.
How to make a simple uix page supported with multiple languages at runtime ? If Resoursebundle is the answer ,how to realize it? Has anybody example codes?
thanks
YongYes, you should use a java ResourceBundle, and you can use the bundle data provider to bind text from a bundle. This is described in the Internationalization chapter of the UIX developers guide.
As to how to write a resource bundle, there should be info available on the web, so try doing a search. -
ASE 15.7 how to find data entry using table page nr
Hi,
I am looking for a dbcc () to get data when I know page number from a table
Thank youHi Isabella,
What your asking is not supported by SAP .. although you can achieve the result by using dbcc page:
http://wiki.scn.sap.com/wiki/display/SYBASE/DBCC+page
The only problem is that the data is in binary format so you have to format it by yourself to a readable format.
Regards,
Adam -
How to write exponent on Ipad on Pages ?
I don't manage to put some exponent on pages and I didn't see any answer on internet so I ask it here.
You cannot type exponents in Pages, no subscript or superscript either. I Googled this question and found this app that claims to work in conjunction with Pages in iOS to give the ability that you are seeking.
https://itunes.apple.com/us/app/tex-equation/id390366359?mt=8 -
How to write a user password update page to update jazn-data.xml?
Many thanks!
Or is there any container managed servlet?Can someone help on this?
I am just looking for an example (may be with a 2 column matrix), not somebody to write full code as per my requirements for me. -
How to write jsp select record from Oracle divide per page , about 50 reco
Dear Expert,
How to write jsp select record from Oracle divide per page , about 50 record per page.
Thank you very much.I wish I could, but there is no single sign on module available for Fusion, also, so called Fusion is yet another Word With Big Letters, behind it there is yet another OC4J ( now Oracle switched to Weblogic though) container with bunsh of Oracle apps residing in it.
Generally speaking, neither Fusion nor Oracle Apps user database does not have any single authentication module available out of the box to integrate user database.
It's a long sad story running straight from Oracle Apps 11.0.5.
That's why I've created JAAS single sign on login module and used it ever since at OC4J 10.2 and onwards at OC4J 10.3
Back to the topic: to develop Apps and test them externally using the session bean I've isted above, one need to copy certain libraries from Oracle Apps server, then add them as libraries for JDeveloper project.
Here is the complete list:
oracle.apps.fnd.cache
oracle.apps.fnd.cache
oracle.apps.fnd.common
oracle.apps.fnd.functionSecurity
oracle.apps.fnd.metadata
oracle.apps.fnd.security
oracle.apps.fnd.util
oracle.apps.jtf.cache
oracle.apps.jtf.security
Edited by: Faceless on Nov 26, 2009 3:04 AM -
How to write code for page up and page down buttons on alv screen?
Hi,
Page up and page down buttons are not working in general alv report. Thease buttons are in disable mode. But is stnd. transactions (tcode : fbl5n) these are enabled and working properly, but we can't debug this with /h
How to write code for page up and page down buttons on alv screen?Poonam,
On doing the screen debugging it took me over to Include LSTXWFCC ,kindly check the below code.
module cc_display.
fcode = sy-ucomm(4).
case sy-ucomm(4).
when 'P--'.
perform cc_firstpage.
when 'P-'.
perform cc_prevpage.
when 'P+'.
perform cc_nextpage.
when 'P++'.
perform cc_lastpage.
when 'EX--'.
perform cc_firstcopy.
when 'EX-'.
perform cc_prevcopy.
when 'EX+'.
perform cc_nextcopy.
when 'EX++'.
perform cc_lastcopy.
I guess it can give you some lead.
K.Kiran. -
How to write strings with an underline on the TOP-OF-PAGE of ALV
How to write strings with an underline on the TOP-OF-PAGE of ALV
if u r using classes and methods it can be done
but if u r using normal fms and then u have to use HTML_TOP_OF_PAGE but the drawback for this it cannot be printed when the report is printed . -
BLS' iMac 3.60GHz Intel Mac - OS X 10.6.7 - Pages 4.0.5…
How come I (the Admiistrator) can Read & Write the majority of my Pages archives but not write on random paragraphs?So what happens when you try to edit this information?
For example:
You have a document...
klasdfl;kasdfl;kjasd;lfkja;slkfja;sldkfj;alskdjf;laksdjfl;kj
klasdfl;kasdfl;kjasd;lfkja;slkfja;sldkfj;alskdjf;laksdjfl;kj
klasdfl;kasdfl;kjasd;lfkja;slkfja;sldkfj;alskdjf;laksdjfl;kj
klasdfl;kasdfl;kjasd;lfkja;slkfja;sldkfj;alskdjf;laksdjfl;kj
jkjklioiouijo32904213904902349023904902390902390
jkjklioiouijo32904213904902349023904902390902390
jkjklioiouijo32904213904902349023904902390902390
jkjklioiouijo32904213904902349023904902390902390
Would you be able to highlight the second paragraph? (not in my post obviously)
If so, what happens? -
How to write ICONS in ALV TOP of Page
Hai experts,
How to ICON in ALV Top of PAGE
i want to wrire
ICON_LED_RED for cancellation Invioce
ICON_LED_GREEN for Invioce
but i pass this values to wa_header-info it comes @5C@ @5B@
thanks
sitaramHi...
I think this code is help full for u....
*& Report ZFI_TEST *
REPORT ZFI_ICON_TEST MESSAGE-ID zz .
*& TABLES DECLARATION *
TABLES: vbak.
*& TYPE POOLS DECLARATION *
TYPE-POOLS: slis.
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF itab OCCURS 0,
icon TYPE icon-id, "itab-icon = '@08@' -> Green ; '@09@' -> Yellow ; '@0A@' -> Red
vbeln LIKE vbak-vbeln,
audat LIKE vbak-audat,
vbtyp LIKE vbak-vbtyp,
auart LIKE vbak-auart,
augru LIKE vbak-augru,
netwr LIKE vbak-netwr,
waerk LIKE vbak-waerk,
END OF itab.
*INTERNAL TABLE FOR FIELD CATALOG
DATA: wa_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE slis_t_fieldcat_alv.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
DATA: it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event,
*INTERNAL TABLE FOR SORTING
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
*INTERNAL TABLE FOR LAYOUT
wa_layout TYPE slis_layout_alv.
*& VARIABLE DECLARATION *
DATA : v_repid TYPE sy-repid,
v_pagno(4) TYPE n,
v_date(8) TYPE c.
*& CONSTANTS *
CONSTANTS: c_x TYPE c VALUE 'X'.
*& SELECTION SCREEN *
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_vbtyp FOR vbak-vbtyp DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-003.
PARAMETERS: p_list RADIOBUTTON GROUP rad1 DEFAULT 'X'.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-004.
PARAMETERS: p_grid RADIOBUTTON GROUP rad1.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN: END OF BLOCK b2.
AT SELECTION-SCREEN.
PERFORM validate_screen.
*& START OF SELECTION *
START-OF-SELECTION.
CLEAR: itab, itab[].
V_REPID = SY-REPID.
PERFORM get_data.
PERFORM display_data.
*& END OF SELECTION *
END-OF-SELECTION.
*--DO ALV Process
v_repid = sy-repid.
*--Sort the Output Fields
PERFORM sort_fields.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
PERFORM set_layout.
*& Form GET_DATA
text
TO GET THE DATA FROM TABLES INTO ITAB
FORM get_data .
SELECT vbeln
audat
vbtyp
auart
augru
netwr
waerk
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbak
WHERE vbeln IN s_vbeln AND
audat > '04.04.2005'
AND netwr > 0.
LOOP AT itab.
IF itab-netwr < 10000.
itab-icon = '@08@'.
ELSEIF itab-netwr > 10000 AND itab-netwr < 100000.
itab-icon = '@09@'.
ELSEIF itab-netwr > 100000.
itab-icon = '@0A@'.
ENDIF.
MODIFY itab INDEX sy-tabix.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form sort_fields
FORM sort_fields .
CLEAR wa_sort.
wa_sort-fieldname = 'VBTYP'.
wa_sort-spos = '1'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'NETWR'.
wa_sort-spos = '2'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
ENDFORM. " sort_fields
*& Form set_layout
FORM set_layout .
IF p_list = c_x .
wa_layout-window_titlebar = 'LIST DISPLAY'(016).
wa_layout-zebra = 'X'.
+
+
ALV LIST DISPLAY
PERFORM list_display TABLES itab.
o
+
+ ALV GRID DISPLAY
ELSEIF p_grid = c_x.
wa_layout-window_titlebar = 'GRID DISPLAY'(017).
wa_layout-zebra = 'X'.
PERFORM grid_display TABLES itab.
ENDIF.
ENDFORM. " set_layout
*& Form list_display
FORM list_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
i_save = 'U'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " list_display
*& Form GRID_DISPLAY
FORM grid_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
it_events = it_event
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " GRID_DISPLAY
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
FORM validate_screen .
DATA: lv_vbeln LIKE vbak-vbeln.
IF NOT s_vbeln IS INITIAL.
SELECT vbeln
INTO lv_vbeln
UP TO 1 ROWS
FROM vbak
WHERE vbeln IN s_vbeln.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'INVALID SALES DOC'.
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_SCREEN
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
DEFINE m_fieldcat.
add 1 to wa_fieldcat-col_pos.
wa_fieldcat-fieldname = &1.
wa_fieldcat-ref_tabname = 'VBAK'.
wa_fieldcat-do_sum = &2.
wa_fieldcat-cfieldname = &3.
append wa_fieldcat to it_fieldcat.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
m_fieldcat 'ICON' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'AUDAT' '' ''.
m_fieldcat 'VBTYP' '' ''.
m_fieldcat 'AUART' '' ''.
m_fieldcat 'AUGRU' '' ''.
m_fieldcat 'NETWR' 'C' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
ENDFORM. " display_data[/code]
Regards,
Rahul
Edited by: Rahul Reddy on Apr 14, 2008 12:33 PM -
how do i modify the language on pages??
You tell Pages what language the text is by selecting it and applying:
Inspector > Text > More > Language > Espagñol
Language is like bold or underlined or ALL CAPS, it is part of the text's style. In fact making it part of a style in the Styles Drawer is a quick way of applying it.
The default language is whatever you have set the System to.
Peter -
How to get footer only in last page of report
anybody tell me
1).how to get footer only in last page while we are displaying reports
and header only in first page .
2) how to create search help and how to use it .
3) how to create lock objects and how can we use itHi
This posting has an example of using a splitter container:
Changing width of a custom container dynamically
This posting has a discussion about using TOP-OF-PAGE:
Display Page numbers in ALV
This posting has an example of using picture control:
Insert picture in selection screen.
This posting has an example of putting a picture on top of an ALV grid:
Logo in OO ALV Grid
The page footer is defined using the statement END-OF-PAGE.
The processing block following END-OF-PAGE is processed only if you reserve lines for the footer in the LINE-COUNT option of the REPORT statement.
<u><b>CREATION:</b></u>
Go to SE11 Tcode
select search help
give the 'z' search help name and create
select the selection method ur table name eg : 'mara'
dialog module 'display value immediately'.
add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
where left position when displaying and spos = search position
and then save and activate ..
<b>Creating Search Help:</b>
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_basic.htm
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_imp.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee86446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee2b446011d189700000e8322d00/frameset.htm
A lock object is a virtual link of several SAP tables which is used to synchronize simultaneous access by two users to the same set of data ( SAP lock concept).
Locks are requested and released in the programming of online transactions by calling certain function modules which are automatically generated from the definition of the lock objects. These lock objects must be explicitly created in the ABAP Dictionary.
<b>To set locks, you must perform the following steps:</b>
1. You must define a lock object in the ABAP Dictionary. The name of the lock object should begin with E.
2. The function modules for requesting and releasing locks which are created automatically when the lock object is activated must be linked to the programming of the relevant online transactions.
<u><b>Reasons for Setting Locks</b></u>
Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.
<u><b>Lock Mechanisms in the Database System</b></u>
The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.
Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.
<u><b>SAP Locks</b></u>
To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.
The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.
Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name> . You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.
<u><b>Lock Types</b></u>
There are two types of lock in the R/3 System:
<u><b>
Shared lock</b></u>
Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to change the object. It does not, however, prevent other programs from setting further read locks.
<u><b>Exclusive lock</b></u>
Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.
example uses the lock object ESFLIGHT and its function modules ENQUEUE_ESFLIGHT and DEQUEUE_ESFLIGHT to lock and unlock the object.
For more information about creating lock objects and the corresponding function modules, refer to the Lock objects section of the ABAP Dictionary documentation.
The PAI processing for screen 100 in this transaction processes the user input and prepares for the requested action (Change or Display). If the user chooses Change, the program locks the relevant database object by calling the corresponding ENQUEUE function.
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'SHOW'....
WHEN 'CHNG'.
* <...Authority-check and other code...>
CALL FUNCTION 'ENQUEUE_ESFLIGHT'
EXPORTING
MANDT = SY-MANDT
CARRID = SPFLI-CARRID
CONNID = SPFLI-CONNID
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID
TYPE 'E'
NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
The ENQUEUE function module can trigger the following exceptions:
FOREIGN_LOCK determines whether a conflicting lock already exists. The system variable SY-MSGV1 contains the name of the user that owns the lock.
The SYSTEM_FAILURE exception is triggered if the enqueue server is unable to set the lock for technical reasons.
At the end of a transaction, the locks are released automatically. However, there are exceptions if you have called update routines within the transaction. You can release a lock explicitly by calling the corresponding DEQUEUE module. As the programmer, you must decide for yourself the point at which it makes most sense to release the locks (for example, to make the data available to other transactions).
If you need to use the DEQUEUE function module call several times in a program, it makes good sense to write it in a subroutine, which you then call as required.
The subroutine UNLOCK_FLIGHT calls the DEQUEUE function module for the lock object ESFLIGHT:
FORM UNLOCK_FLIGHT.
CALL FUNCTION 'DEQUEUE_ESFLIGHT'
EXPORTING
MANDT = SY-MANDT
CARRID = SPFLI-CARRID
CONNID = SPFLI-CONNID
EXCEPTIONS
OTHERS = 1.
SET SCREEN 100.
ENDFORM.
You might use this for the BACK and EXIT functions in a PAI module for screen 200 in this example transaction. In the program, the system checks whether the user leaves the screen without having saved his or her changes. If so, the PROMPT_AND_SAVE routine sends a reminder, and gives the user the opportunity to save the changes. The flight can be unlocked by calling the UNLOCK_FLIGHT subroutine.
MODULE USER_COMMAND_0200 INPUT.
CASE OK_CODE.
WHEN 'SAVE'....
WHEN 'EXIT'.
CLEAR OK_CODE.
IF OLD_SPFLI NE SPFLI.
PERFORM PROMPT_AND_SAVE.
ENDIF.
PERFORM UNLOCK_FLIGHT.
LEAVE TO SCREEN 0.
WHEN 'BACK'....
<b>
Another Example</b> :
please see this link with Screen shot .....
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm
Reward all helpfull answers
Regards
Pavan -
How to display values in top of page in ALV report
Hai,
This is my billing report program, i developed that object by using ALV but i could not able to use Top-of-page. please any one correct my code,
*& Report ZE0232_ALV_BILLING *
report ze0232_alv_billing.
type-pools: slis.
data: repid like sy-repid.
data: fieldcatalog type slis_t_fieldcat_alv,
wa_fieldcatalog type slis_fieldcat_alv.
data : ievent type slis_t_event,
wevent type slis_alv_event.
data: sal_text like tvkot-vtext,
DIS_TEXT LIKE TVTWT-VTEXT,
DIV_TEXT LIKE TSPAT-VTEXT.
tables: vbrk.
data: begin of i_vbrk occurs 0,
vbeln like vbrk-vbeln,
fkdat like vbrk-fkdat,
erdat like vbrk-erdat,
kunrg like vbrk-kunrg,
name1 like kna1-name1,
netwr like vbrk-netwr,
stext like tvkot-vtext,
dtext like tvtwt-vtext,
divtext like tspat-vtext,
end of i_vbrk.
selection-screen begin of block billing with frame.
parameters: salesorg like vbrk-vkorg.
select-options: dischanl for vbrk-vtweg,
division for vbrk-spart,
bildat for vbrk-fkdat.
selection-screen end of block billing.
select vbeln fkdat erdat kunrg netwr from vbrk into corresponding fields of table i_vbrk where vkorg = salesorg
and vtweg in dischanl
and spart in division
and fkdat in bildat.
select vtext from tvkot into sal_text where vkorg = salesorg and spras = 'EN'.
endselect.
select vtext from TVTWT into DIS_text where VTWEG IN dischanl and spras = 'EN'.
endselect.
select vtext from TSPAT into DIV_text where SPART IN DIVISION and spras = 'EN'.
endselect.
loop at i_vbrk.
move: sal_text to i_vbrk-stext,
DIS_TEXT TO I_VBRK-DTEXT,
DIV_TEXT TO I_VBRK-DIVTEXT.
modify i_vbrk.
endloop.
perform get_fieldcatalog.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = repid
I_GRID_TITLE =
i_callback_top_of_page = 'TOPS'
it_fieldcat = fieldcatalog
tables
t_outtab = i_vbrk
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*& Form GET_FIELDCATALOG
text
<b>form tops.
write :/ 'Hai Welcome'.
endform. "tops</b>&----
*& Form get_fieldcatalog
text
form get_fieldcatalog.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-fieldname = 'VBELN'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'SALES DOCUMENT'.
WA_fieldcatalog-rollname = 'VBELN'.
wa_fieldcatalog-hotspot = 'X'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-fieldname = 'FKDAT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'BILL DATE'.
WA_fieldcatalog-rollname = 'VBELN'.
WA_fieldcatalog-hotspot = 'X'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '3'.
wa_fieldcatalog-fieldname = 'ERDAT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'CREATED DATE'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '4'.
wa_fieldcatalog-fieldname = 'KUNRG'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'CUSTOMER NO'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '5'.
wa_fieldcatalog-fieldname = 'NAME1'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'CUSTOMER NAME'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '6'.
wa_fieldcatalog-fieldname = 'NETWR'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'NET VALUE'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '7'.
wa_fieldcatalog-fieldname = 'STEXT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'SALES ORG'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '8'.
wa_fieldcatalog-fieldname = 'DTEXT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'DIS.CHANNEL'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '9'.
wa_fieldcatalog-fieldname = 'DIVTEXT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'DIVISION'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
endform. "GET_FIELDCATALOGHI see this report
you can know how to write TOP-OF_PAGE code
and insert LOGO also
*& Report ZTEST_ALV_LOGO
REPORT ztest_alv_logo.
TYPE-POOLS : slis.
*ALV Formatting tables /structures
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: gt_events TYPE slis_t_event.
DATA: gs_layout TYPE slis_layout_alv.
DATA: gt_page TYPE slis_t_listheader.
DATA: gs_page TYPE slis_listheader.
DATA: v_repid LIKE sy-repid.
*ALV Formatting work area
DATA: w_fieldcat TYPE slis_fieldcat_alv.
DATA: w_events TYPE slis_alv_event.
DATA: gt_bsid TYPE TABLE OF bsid WITH HEADER LINE.
INITIALIZATION.
PERFORM build_events.
PERFORM build_page_header.
START-OF-SELECTION.
*perform build_comment. "top_of_page - in initialization at present
SELECT * FROM bsid INTO TABLE gt_bsid UP TO 10 ROWS.
*perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
*USING = Row, Column, Field name, display length, table name, heading
*OR
PERFORM build_fieldcat.
gs_layout-zebra = 'X'.
*top of page event does not work without I_callback_program
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_structure_name = 'BSID'
i_background_id = 'ALV_BACKGROUND'
i_grid_title = 'This is the grid title'
I_GRID_SETTINGS =
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
TABLES
t_outtab = gt_bsid.
Form..............: populate_for_fm
Description.......: Populates fields for function module used in ALV
FORM populate_for_fm USING p_row
p_col
p_fieldname
p_len
p_table
p_desc.
w_fieldcat-row_pos = p_row. "Row Position
w_fieldcat-col_pos = p_col. "Column Position
w_fieldcat-fieldname = p_fieldname. "Field name
w_fieldcat-outputlen = p_len. "Column Lenth
w_fieldcat-tabname = p_table. "Table name
w_fieldcat-reptext_ddic = p_desc. "Field Description
w_fieldcat-input = '1'.
APPEND w_fieldcat TO gt_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " populate_for_fm
*& Form build_events
FORM build_events.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_events.
READ TABLE gt_events
WITH KEY name = slis_ev_user_command
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_user_command TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
READ TABLE gt_events
WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_top_of_page TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
ENDFORM. " build_events
*& Form USER_COMMAND
When user command is called it uses 2 parameters. The itab
passed to the ALV is in whatever order it currently is on screen.
Therefore, you can read table itab index rs_selfield-tabindex to get
all data from the table. You can also check r_ucomm and code
accordingly.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE gt_bsid INDEX rs_selfield-tabindex.
error checking etc.
SET PARAMETER ID 'KUN' FIELD gt_bsid-kunnr.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDFORM. "user_command
*& Form top_of_page
Your own company logo can go here if it has been saved (OAOR)
If the logo is larger than the size of the headings in gt_page,
the window will not show full logo and will have a scroll bar. Thus,
it is a good idea to have a standard ALV header if you are going to
use logos in your top of page.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_page
i_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "top_of_page
*& Form build_fieldcat
*Many and varied fields are available here. Have a look at documentation
*for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
FORM build_fieldcat.
w_fieldcat-fieldname = 'BUDAT'.
w_fieldcat-seltext_m = 'Dte pst'.
w_fieldcat-ddictxt(1) = 'M'.
w_fieldcat-edit = 'x'.
Can change the position of fields if you do not want them in order
of the DDIC or itab
w_fieldcat-row_pos = '1'.
w_fieldcat-col_pos = '10'.
APPEND w_fieldcat TO gt_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcat
*& Form build_page_header
gt_page is used in top of page (ALV subroutine - NOT event)
*H = Header, S = Selection, A = Action
FORM build_page_header.
For Headers, Key is not printed and is irrelevant. Will not cause
a syntax error, but is not used.
gs_page-typ = 'H'.
gs_page-info = 'Header 1'.
APPEND gs_page TO gt_page.
gs_page-typ = 'H'.
gs_page-info = 'Header 2'.
APPEND gs_page TO gt_page.
For Selections, the Key is printed (bold). It can be anything up to 20
bytes. It gets printed in order of code here, not by key value.
gs_page-typ = 'S'.
gs_page-key = 'And the winner is:'.
gs_page-info = 'Selection 1'.
APPEND gs_page TO gt_page.
gs_page-typ = 'S'.
gs_page-key = 'Runner up:'.
gs_page-info = 'Selection 2'.
APPEND gs_page TO gt_page.
For Action, Key is also irrelevant.
gs_page-typ = 'A'.
gs_page-info = 'Action goes here'.
APPEND gs_page TO gt_page.
ENDFORM. " build_page_header
<b>Reward if useful</b> -
How to write to a log file within a JSP
Hello everybody,
do you know how to write to a log file within a JSP.
my code is (/space/SP/tlf/ExcepcionJava.jsp):
<html>
<body bgColor=#C4E1FF>
<%@ page import="java.io.*" %>
<%
FileWriter salida = new FileWriter(response.encodeURL("log.txt"));
salida.write(request.getParameter("errorMsg"));
salida.close();
%>
</body>
</html>.. I run under Solaris, Jrun 2.3.3
I have also test with getServletContext().getRealPath(), but I get /netsrv/nes/docs/ instead of /space/SP/tlf/Hi,
Give the full path of the log file to the FileWriter. Such as;
FileWriter salida = new FileWriter(response.encodeURL("/usr/local/tomcat/logs/testlogs/log.txt"));
nurettin -
How to write log information into SM37 batch job log
Hi,
I have a report running in batch mode, and I would like to log the start time and end time for some part of the code (different Function modules). I need to write this log information into the batch job log. Therefore I can check the time frame of my FMs.
After search the SDN, I can only get some information on how to write log into the application log displayed in SLG1, but that's not I want. I want to write batch log information, and check it in SM37.
If you have some solution or code to share, please. Thanks a lot.
Best Regards,
BenHi Nitin
Thanks for the reply. Could you explain it with some code ?
I tried to use the write statement , but it did not wrok. I could not see the result in SM37.
write : "start of the FM1 processing".
FM1 code
write : "end of the FM1 processing".
but those two statement did not show in SM37..
1) how to use a information message ?
2) how to use NEW PAGE PRINT ON and PRINT OFF command. ?
I would appreciate if you can write some code ,that I can use directly.
Thanks a lot.
Best Regards,
Ben
Maybe you are looking for
-
I pay a monthly subscription to a French newspaper and I would like to know how to suspend or end it should I want to. I believeI need to go to Manage Subscriptions but I cannot find this anywhere. I've seen messages about various buttons etc. on th
-
Hello experts, We are configuring SUS connected to an ERP 6.0 system. I would like to know which PO header and item texts (from ERP) are visible from SUS. Header texts: -Header Text -Header Note -Pricing types -Deadlines -Terms of delivery -Shipping
-
ITunes won't start after reinstalls and iPhone problems
last time I think I clicked Never Register on iTunes after plugging my iphone,downloaded some podcasts to my phone,everything seems alright before that,but then my iphone won't sync properly with itunes... iTunes keeps saying Syncing Iphone (sometime
-
AME & Premiere CS6 crashing (quit unexpectedly error)
Hi guys, AME & Premiere keep crashing on me, at the end of the rendering it is displaying a message "AME quit unexpectedly" and below error: Process: Adobe Media Encoder CS6 [318] Path: /Applications/Adobe Media Encoder CS6/Adobe M
-
Hi gurus, Can some one suggest me in finding the size of complete database and the free space left in the database . as i am doing the refresh just need to gather the statistics . thanks