Refreshing the value of a field in a table and displaying it on the screen.
how do i mimimize calls to the database in the following scenario?
I need to show the latest value of a field in a table in a database through a java program. in a concurrent access environment, there are chances of multiple users getting stale values. how do I overcome this problem through code?
please advise.
There are many ways of doing this. However its worth noting that RDBMS database are not messaging, event driven systems and are not best suited to do what you want to do. You should only consider doing this if you have a low rate of changes.
You can
- Poll the database table and look for changes.
- Add a trigger to the table to record the keys which have changed. The have a query to find just the key which have changed.
- When a field changes, also send a broadcast/topic message.
- Add a trigger which sends a JMS message when a change occurs. (This is entirely DB/JMS specific, you need to find if this is possible)
Again, databases are not ideally suited to event driven, real time updates. There is no simple, clean solution.
Similar Messages
-
Adding Amount field in BSEG table and display it single line item?
hi experts,
I am doing credit / debit form now my requirement is
According to BELNR , GJAHR,BUKRS i want to find credit amount for this selection cretiria.
so i want to add all the lines of amount filed for a particular BELNR and display it as single line.
so i am getting data from print program like this
SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 2.
PARAMETERS: p_belnr LIKE bkpf-belnr OBLIGATORY,
p_bukrs LIKE bkpf-bukrs OBLIGATORY,
p_gjahr LIKE bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b0.
SELECT SINGLE *
FROM bkpf
INTO i_bkpf
WHERE belnr = p_belnr
AND ( blart = 'DG' OR blart = 'ZG' )
AND bukrs = p_bukrs
AND gjahr = p_gjahr.
IF sy-subrc = 0.
SELECT *
FROM bseg
INTO table it_bseg
WHERE belnr = i_bkpf-belnr .
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_CREDIT_DEBIT' " p_name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = v_form_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION v_form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
i_bkpf = i_bkpf
i_bseg = i_bseg
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
so my I_BSEG containing all line items of particular BELNR . with the field SHKZG iam getting only credit line items .
now i want to do is add all credited amount and display like this in a table.
against ref# (BSEG-REBZG) ! details (BSEG-SGTXT)! amount
124569 10%discount 950.00(total amount ie sum of all lines amount for a BELNR)
10.00(total tax amt ie sum of all lines of tax amount for a BELNR)
960.00hi arun,
i used collect in smartform my procedure is like this .
i am getting data into i_BSEG because i declared like this in TABLES parameter
i created a loop .
in that i mentioned like I_BSEG into WA_BSEG.
then i created a program lines here i mentioned like this.
COLLECT WA_BSEG INTO IT_BSEG.
but because of BUZEI "Number of Line Item Within Accounting Document .it is not same it is varying for every credited time that means for every line of BELNR. thats why it is not adding it is just appending .
so pls tell me any other chance to find sum .
because i want to sum up all credted amount and display it in single line
ie first column REBZG "Number of the Invoice the Transaction Belongs to(against ref) i want to display once .
And Second column SGTXT "item text(details) for amount once and for tax amount once
And Third column Amount first line consists total amount & second line consists total for tax amount
regards,
satheesh.
[email protected]
any doubts chat me regarding this post. -
I cannot refresh the screen, no matter what I try. The "restore" is not the same thing. So I always get old versions of websites, including my own. I cannot see a new version of any website I have visited previously. I need to know how to REFRESH my screen, and there is no way to do it!!!!!
Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
*Press and hold Shift and left-click the Reload button.
*Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
*Press "Command + Shift + R" (MAC)
Clear the cache and the cookies from sites that cause problems.
"Clear the Cache":
*Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
"Remove Cookies" from sites causing problems:
*Firefox/Tools > Options > Privacy > Cookies: "Show Cookies" -
Time trigger for refreshing the screen
Hi all,
How to implement the time trigger for refreshing the screen after some time interval .
Thanks in advance .hello Naval ,
set the delay propert Eg : 10
in the on action of the Time trigger Ui
invalidate the node of table .
write the select query for retrivig the PO from table into Itab .
bind the internal table to the node ...
But for your requirement it will efficient if you implement POWL query .
[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60f1d5ee-84ab-2c10-ce97-97dfd89bc238?quicklink=index&overridelayout=true]
Regards
Chinnaiya P -
Have to keep refreshing the screen
When I start up various applications under Firefox, the username and password are not always completed for me despite being stored. If I refresh the screen, then it works. Also, when using the back button in google, it takes me to a completely blank page instead of the list of returned items - again, if I refresh the screen, the correct list is displayed. This has only been happening in the last 2 weeks and it's driving me nuts.
I've looked on this forum for answers but there aren't any that explain why this is only happening with Firefox. I left IE because of problems, don't tell me I have to now abandon Firefox too? Has anyone got a reliable platform out there for goodness sake?Ok. I think safe mode should be the next step then.
I should have been more clear above. I didn't mean Windows Safe Mode. I was referring to Firefox's Safe Mode. See the article below:
[[Troubleshoot Firefox issues using Safe Mode]]
This basically starts Firefox up with all add-ons disabled and with a couple of changes to basic settings. If the problem doesn't occur in Safe Mode then it is a good bet that some setting or add-on is causing the problem. You can then follow the instructions in that article to enable them one by one to identify the culprit.
If the problem still occurs in Safe Mode then I suggest doing a Firefox Reset. See the article below. This will return Firefox to its defult settings. Your history, bookmarks etc will be saved but you will need to reinstall all your add-ons.
[[Reset Firefox – easily fix most problems]]
I hope that helps. Let me know if not. -
ALV - need to sum values of internal table and display in ALV
I have data in internal table as:
Material date sum1 sum2
Mat_A 19990101 4 4
Mat_A 20080501 3 0
Mat_A 20080601 2 0
Mat_B 19990101 2 0
Mat_B 20080601 5 5
Required output is :
Material qty1 qty2 19990101 20080501 20080601
Mat_A 432 4 4 3 2
Mat_B 2+5 5 2 5
Thinking of using ALV to pass the internal table and display as classical report (and also to save as excel spreadsheet).
Counting your help on the following questions:
1) How to accomplish the sum in ALV report? Can ALV FM do that or one has to use ABAP to compute the sum from the given internal table?
2) Mat_A can have more date values. Here it got 3 distinct date values 19990101, 20080601, 20080501. If it has say 5 date values, how to create the ALV date columns (from 3 to 5 date columns) dynamically?
Thanks for the help.for the sum inalv we use generally..
it_fieldcat-do_sum = 1.
check this examples...
http://www.****************/Tutorials/ALV/Subtotals/text.htm
*& Report ZTEST_ALV_PERC_13317
REPORT ztest_alv_perc_13317.
TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_events TYPE slis_t_event,
wa_events TYPE slis_alv_event,
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
l_layout TYPE slis_layout_alv.
TYPES: BEGIN OF ty_itab,
field1(10),
qty1 TYPE i,
qty2 TYPE i,
qty3 TYPE i,
dummy TYPE c,
END OF ty_itab.
DATA: itab TYPE STANDARD TABLE OF ty_itab WITH HEADER LINE,
itab1 TYPE ty_itab.
START-OF-SELECTION.
itab-field1 = 'FIRST'.
itab-qty1 = 2.
itab-qty2 = 1.
itab-qty3 = 5.
itab-dummy = 10.
APPEND itab.
itab-field1 = 'FIRST'.
itab-qty1 = 2.
itab-qty2 = 1.
itab-qty3 = 5.
itab-dummy = 10.
APPEND itab.
itab-field1 = 'FIRST'.
itab-qty1 = 2.
itab-qty2 = 1.
itab-qty3 = 5.
itab-dummy = 10.
APPEND itab.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-tabname = 'ITAB'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'QTY1'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'QTY2'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-fieldname = 'QTY3'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 5.
wa_fieldcat-fieldname = 'DUMMY'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-no_out = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 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.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF. -
Aditional field in standard table and screen
Hi friends.
I'd like to know how to add a new field in a table and make it visible in standard transaction.
In this case, the table is EBAN and transaction is ME51N, ME52N and ME53N. This new field must be includded in transaction items grid.
I've already added field to CI... include in EBAN but this new field does't appear in standard transaction.
I've already saw variant and this new field doesn't appear there too.
Any idea ? Any SAP Note (I hadn't find any sap note yet) ?
thanks.
GlaucoHi Raymond Giuseppi.
Greate hint about this SAP NOTE. It solved my issue !!!
P.S.: This note is to releases 46c and 47, BUT even I'm in release ECC 6.0 I must do the same: I've already created CMOD prject, includes and subscreen 0111 like SAP NOTE ask to do. This SAP NOTE has entire example on how to add this subscreen and encoding includes of TOP, PBO and PAI to read and save data of Zfields of EBAN. It's nice and easy to understand.
thank you !!!
Glauco
Edited by: Glauco Kubrusly on Nov 22, 2010 11:53 AM -
Adding Colume in the Table and display result in it.
Hi Guru's ,
I have a requirement to add column in existing Table. and Display the result after calculation.
Thanks,
RutuHi,
Please used this code snippet for reference:
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OAViewObject vo = (OAViewObject)am.findViewObject("<VO Name>"); // Give VO Name attached to the Table Region.
if (vo != null)
vo.addDynamicAttribute("<Att_Name>"); //Adding ViewAttribute to VO
vo.reset();
vo.next();
//Do calculation that you want
//Setting the calculated value in the created VO Attribute
vo.getCurrentRow().setAttribute("<Att_Name>", <Value to assign>);
I hope this will gives you a proper Help.
Please feel free to ask if any more Question
Thanks,
Shrikant -
How to join fields from different internal tables and display into one int
hai i have one doubt...
how to join fields from different internal tables and display into one internal table..
if anybody know the ans for this qus tell me......hii
you can read data as per condition and then can join in one internal table using READ and APPEND statement..refer to following code.
SELECT bwkey " Valuation Area
bukrs " Company Code
FROM t001k
INTO TABLE i_t001k
WHERE bukrs IN s_bukrs.
IF sy-subrc EQ 0.
SELECT bwkey " Valuation Area
werks " Plant
FROM t001w
INTO TABLE i_t001w
FOR ALL ENTRIES IN i_t001k
WHERE bwkey = i_t001k-bwkey
AND werks IN s_werks.
IF sy-subrc EQ 0.
LOOP AT i_output INTO wa_output.
READ TABLE i_t001w INTO wa_t001w WITH KEY werks = wa_output-werks.
READ TABLE i_t001k INTO wa_t001k WITH KEY bwkey = wa_t001w-bwkey.
wa_output-bukrs = wa_t001k-bukrs.
MODIFY i_output FROM wa_output.
CLEAR wa_output.
ENDLOOP. " LOOP AT i_output
ENDIF. " IF sy-subrc EQ 0
regards
twinkal -
How to add the values of all selected columns in a table and display it ?
Hi all,
I am using jdeveloper 11.1.1.6.0
Page:
my page jsff page contains one ADF table and one textbox
DB:
i have two database tables A & B ,
i need 2 columns from each table . say (A.product_no ,A.product_name,B.prodeuct_price ,B.confirm)
here product_no is primary key and present in both tables.
i need to create a VO combining these two tables and put it as ADF table in a jspx page
Functionality :
my 'confirm' field is a checkbox field in table . whenever the checkbox is selected,
the corresponding price will be getting added and display it in a textbox.
Eg:
if my first 4 price values are 3000 , 2000 ,4000,2000
and if i select first 3 values , then the text box should contain 9000 value.
i need help ...
Problem:
i need help in creating VO and functionality partHi,
it is easy: create an entity object for every table and one view object where you select your both entity objects and join them in your select statement.
Your desired 'confirm' functionality could be achieved with helpp of view object transient attributes - for more information see: http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcquerying.htm#CHDHJHBI
Regards
Pavol -
My administration website will not display the new values stored in the database. There are a series of admin pages used to update the database. The current values are shown in text boxes to indicate what the current values are. How can I refresh the page and display the new changes in the text boxes.
The values are retrieved by calling the get methods in my ConfigDB class, which returns a value(the a result from the query string). For example:
String str_url = rs.getString("name");
public String getNameURL() {
return str_url;
I used rs.refreshRow(); and has no effect.
ConfigDB is responsible for connecting to the database and quering the database.
Can anyone help me?????
gbiliosWhat exactly is the problem? Refreshing the page? It can be done either with Javascript or the HTML <META>-tag. Or even using a dummy Servlet that you post it and just dispatch the request back to the same page.
Do you get the updated values if you refresh the page manually in your browser (CTRL-F5 with IE)? If not, then your problem is that your ConfigDB class is caching the values. You need to modify it so that it will requery the database every time a getter method is called.
.P. -
Refreshing the screen that has af:table
Hi,
I have an Entity X, and I have an Edit screen where I can update attributes values of X Objects. On the Edit screen(JSPX), I have OutputText, InputText, selectOneChoice, selectBooleanCheckbox, and af:table components. On the Edit Screen I also have copy capability, the user can pick another Object of X and copy all its attributes values to the current object. When the copy is done, the copied values are instantly displayed on the screen for all the components except the af:table components(certain rows should be selected after the copy is done). I tried to refresh the page using the below code but didn’t help
protected void refreshCurrentPage(){
FacesContext context = FacesContext.getCurrentInstance();
String currentView = context.getViewRoot().getViewId();
ViewHandler vh = context.getApplication().getViewHandler();
UIViewRoot x = vh.createView(context, currentView);
context.setViewRoot(x);
x.setViewId(context.getViewRoot().getViewId());
I tried to add the table as a partialTrigger using the below code but that didn’t help
AdfFacesContext adfContext = AdfFacesContext.getCurrentInstance();
adfContext.addPartialTarget(compsTableComponent);
I have been struggling with this for days, can anyone suggest any solutions to it. I use ADF Business Components
Thanks :(Hi,
you lost me in the listing of components and what they do on the edit page. But I think that they are irrelevant for the question you ask anyway. So here are the options
1) call facesContext.getExternalContext.redirect("/yourViewId.jspx");
or
2) try refreshing the surrounding cotainer of the table. Sometimes its not the component you need to refresh, but the parent container
Frank -
Set Default Value based on Field from another table for a custom object
I'm trying to set the default value on a custom object field to the value of an account field. I have tried the syntax 50 different ways, and just am getting no where. The account field label displays as DBA, the integration tag is ltDBA_ACCT, and it shows up in reporting fx area as Account.Text_22.
The custom object field I'm triying to update is also called DBA, which was originally the "NAME" required field. Does the table name, Account, have to be included? Do I need a function in front of the field?
I have been updating the external ID using the row ID with syntex <ID> (Less than ID greater than) so I know it is possible to set the Default Value, but <DBA>, <ltDBA_ACCT>, "Account"."DBA", and so on just don't not work.
If anyone knows how to enter this I'd really appreciate the help.Ok, so if you want to default a field to the value from another object, you have to use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure that you do.
Next, this will only work as a default if the record is created from the object that you wish to join on because a default works at record creation and the ID needs to be available for it to work properly. It will not work if you choose the related object record after the custom object record is created. You could set the value as a post-default, but that does not seem to meet your requirements.
The syntax for the Default Value would be as follows: JoinFieldValue(ref_record_type, foreign_key, field_name).
In your case, ref_record_type is '<Account>', foreign_key is [<AccountId>], and field_name is '<YourFieldName>'. The best way to determine what the field name is would be to create a new workflow for Account and use the Workflow Rule Condition expression builder to pick your field ("DBA") from the list. The value that is returned by the expression builder should be placed in the field_name variable in the JoinFieldValue function (minus the brackets and in single quotes).
Give this a shot and let me know how you do.
Thom -
Length of value of c field in internal table
Hi experts,
how do I find out the lenght of the value which is an CHARACTER field in an internal table.
I get a .XLS file from the customer. To check where the real entries starts I need to know the length of one field in the internal table.
How do I do this?
I tried it with DESCRIBE, but it doesn't work because the c field is interpreted hexadecimal.
Example:
all fields in my table are c(30), the value in one column is max. 3 letters. I want to find out the row where the entry in this field is 3 letters long.
Edited by: Heiko Kany on Sep 3, 2008 8:49 AMHi Heiko,
You can find the length using the STRLEN function as given below;
DATA : ipstr TYPE string.
DATA : len TYPE i VALUE 0.
ipstr = 'Sample String'.
len = STRLEN( ipstr )
After execution len will contain 13.
Regards
Karthik D -
Passing values according to fields in a table
Hi
I am using Tomcat 6, JDK 6, Win XP.
I have first.jsp , which collects information from a file and and displays it in the table, plus some common operations , for example :
A1 A2 select update delete
B1 B2 select update delete
C1 C2 select update delete
So my first row of information consists of A1 and A2 and three operations which are hyper links to the next page, second.jsp:
Data fields : A1, A2 and
Select Update Delete
This is my Question:
first.jsp should send the correct parameters to second.jsp. Meaning, if user clicks the update in 2nd row, second.jsp should get B1,B2 and operation update and build a update.jsp page accordingly.
Could you tell me how first.jsp can pass these values to second.jsp ?
Thank youhope u build the table using for() loop .
<a href = "select.jsp?id=<%=primarykeyvalue%>">select</a>
<a href = "update.jsp?id=<%=primarykeyvalue%>">Update</a>
<a href = "delete.jsp?id=<%=primarykeyvalue%>">Delete</a>
Try this
Maybe you are looking for
-
10.6.8 Macbook Pro firmware update problem
I installed a couple of updates for my MBP 10.6.8. One was Safari, the other was brand new, released within the last week, I think it was a firmware update, and now the machine will not boot into OSX. I have a Bootcamp Windows 7 partition that star
-
Last week I had my iphone with me while I was on a canoe trip. An hour into the trip, one of my friends flipped over the canoe and then my iphone got soaked. I followed everybody's advice and put it in a baggie of rice for a couple of days. Afterward
-
Can't Print after Software Update
After completing an Apple software update which included Epson printer software update 2.7 I am unable to print. I get an error message; Error:/Library/Printers/EPSON/InkjetPrinter2Filter/rastertoescpll.app/Contents/ MacOS/rasertoescpll failed. Can y
-
A more mysterious NoClassDefFoundError problem
This is a continuation of cannot solve NoClassDefFoundError. I implemented amtguy's suggestion to the previous thread and it fixed my problem. I didn't know -cp was ignored when using -jar. In my executable jar's manifest, I specified the Class-Path:
-
Application crashes with just one user
Having an issue with Quark. It has randomly decided not to work. I verified permissions, trashed the prefs and caches, then did a fresh re-install (back to 5.1, 5.5 6.1, 6.5). All to no avail. Then made a new account and poof all is working well. So