SQL Mode Command to update database table
Hi All,
I have a couple of scenarios which I need help with:
1)
- I have a sql query which pulls two columns lets say Equipment and a val1 from a sql database table displayed in a grid.
- Once the user clicks on a record I have two text boxes which get the value of the selected records on the same page (equipment, val1).
- I then have an update button, wherein they can change the value of the val1 column.
I have created a sql query of mode command with an update statement. My question is, how do I execute this update query from the webpage, I know how to assign the parameters so the get passed to the update query I just am not sure how to kick off the update query. Do I have to have it as part of an applet to even refer to it from within my webpage? If so, don't I have to assign an applet a display template? (this command query does not have an output). Please help...
Thanks,
Mahwish
I have done scenario 2, but its not easy. This is how I did it.
Instead of using the iGrid applet, I used an XSLT stylesheet to create a "grid" of input boxes in HTML that allow direct editing of the value. At the end of each row you had an "update" button that passed the value of the updated box, and the corresponding information you need for icommand update. You can either display the information you need for the update query in the "grid" or you can use hidden form objects to store the information. Indexing is pretty easy, you just name the form elements by positions (eg. frmTxtR1C1) for example.
The solution is not for the faint of heart, takes some development time and a fair amount of XSLT knowledge, but if you need this functionality repeatedly in your application, it works great. It looks really slick too because you can do things like change the color of your form after you have updated it so the user knows there has been a change. Of course there are always multiple ways to attack a problem I love hearing other suggestions.
Similar Messages
-
I have 1 million records in application server and I want to update database table from that.
Is UPDATE statement the best technique to do it.
Just wanted to know if there is any other better tehcniques.
Also i want to write the errors to job log. How can we do that?
Regards,
DNPIf they are all new records or all changes, it would be best to use INSERT or UPDATE. You will also want to do mass inserts/changes using an internal table. Since you have so many records, you will probably have to do this in chunks in order to avoid dumping on the rollback area.
Rob -
How to update database table !!!
hi all,
Please advice how to update database table with certain cndition needs to be checked.
Please consider below scenario.
have used enqueu and dequeue function to lock entries and also i have used BAPI so considering that return parameter . i want to update table
/tdk/st0027.
1. I want to update database table
2. there are certain condition needs to be checked like ,
loop at it_final into wa_final.
th_return-type = 'S'.
if th_final-vbeln = /tdk/st0027-vbeln and
th_final-posnr = /tdk/st0027-posnr and
th_final-etenr = /tdk/st0027-sdslno.
above condition which i need to check .and need to append below system fields need to be appended in table.
th_final-prstsind = '20'.
th_final-chgdate = g_date.
th_final-chgtime = g_uzeit.
th_final-chgprog = g_cprog.
th_final-chguser = g_uname.
append th_final to td_final.
update /tdk/st0027 FROM th_final.
endif.
endloop.
but i am getting error saying that "The type od database table and work area (TH_FINAL) are not unicode convertible"?
I am not able to understandwhat would be the solution for this ?
Thanks and regards,
Prasad K. NAralkarThe error occurs in the UPDATE statement included in the code. In this statement it is seen that there is a mismatch of structure defined for the DDIC table /tdk/st0027 and that of your work area th_final.
try to create a structure w.r.t the DDIC table.
Eg: DATA: wa_temp TYPE /tdk/st0027.
MOVE-CORRESPONDING th_final TO wa_temp.
Then try to UPDATE using the temporary work area i.e wa_temp which has structure similar to that of the database table. -
Enqueue and Dequeue before updating Database table
Hi all,
We are updating database tables using INSERT, MODIFY and UPDATE statements. Since many people will be running the application at the same time we need to lock the table before updating database table. So we need to use ENQUEUE and DEQUEUE functionality for this purpose.
Can any plz explain what are the steps we should follow now?
Thanks in advance.Hi,
Any Database access should carefully handled as multiple applications may be accessing the database at the same time. To read a record from the database you don't need to implement a lock, but to write you need not only locks but also ideally should use the Update Function Modules to comply SAP "All or Nothing" Principle. This will prevent data inconsistency of the database and the data will be proper state. You need to use the COMMIT WORK and ROLLBACK WORK in you code to handle the consistency part of the database.
The best design approach would be seperate the Database Layer completely from the business layers. This will make your code robust and easy to maintain.
As, for the Locking Concepts, you will get multiple resources from SDN as how to create Locks and implement the Locking modules in your code. But more than that what matters is why and how to implement the SAP Locking concepts to make your application run better.
Have a look at the following link
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Hope this helps.
Thanks,
Samantak. -
Doubt in updating database table
hi all
i want to modify values ztable from a internal table ....
for eg : the ztable contains matnr and accept_qty
matnr qty
mat01
mat02
i need to modify qty of the table .. i am using where condition (ie modify where matnr = ) but where condition is not working for database tables .... how to proceed with this ..
thanks
lokeshhi,
before that :- modify statemnt will modify a record if there is record having the same key like that of record in work area.
if there is no record in itab with key of work area record, it will insert a new record in itab.
look this sample code.
*modify internal table
loop at itab into wa.
wa-field1 = data1.
wa-field2 = data2.
wa-field 3= data3.
modify itab from wa transporting field1 field2 field3 where key_field = wa-keyfield. "there shuld not be any chang in key field.
endloop.
*now update database table
*work area and data base structure shuld be same type
if itab[] is not initial.
modify ztable from table itab.
endif.
rgds
anver
if hlped pls mark points -
Browse and update database tables
I'm looking for a tool that will let me connect to an Oracle database, select a table and some fields off the table and build a simple java class to navigate / update the data.
Essentially, I'm looking for a tool that replicates the way Microsoft Access can build a form for navigation and update of a database table.
However, I want to use java, not MS Access.
Any ideas if such a tool is available ?
Thankshttp://squirrel-sql.sourceforge.net/
-
How to find out who updated database tables
Hi
We are using Oracle Database 10g Release 10.2.0.4.0.
A user, via pl/sql developer, has been updating data on our database. This resulted in certain reports not balancing. At that time, we did not have database triggers on the tables concerned. We now need to go back at least a month or more to see who had updated these tables. We have a username, is there any script that we can use? How accurate is v$active_session_history? Would it give us all the info we need?781424 wrote:
Hi
We are using Oracle Database 10g Release 10.2.0.4.0.
A user, via pl/sql developer, has been updating data on our database. This resulted in certain reports not balancing. At that time, we did not have database triggers on the tables concerned. We now need to go back at least a month or more to see who had updated these tables. We have a username, is there any script that we can use? How accurate is v$active_session_history? Would it give us all the info we need?It is little easy to know with AUDITING, or use Log miner to analyze log files. -
Performance manager sql action rule for updating metric table
Hi, I need to update metric stop_date using a sql action rule (Performance Manager execute sql action rule). My problem is I can't update stop_date into the PM Repository Database. Sql action database connection is properly set, but when I set sql for executing update in table ci_probe and I schedule the rule the system doesn't seem to connect to Database (the rule run successfully, but the table ci_probe is not updated). I don't understand if the problem is database connection or wrong sql code.
Can Anyone help me with suggestions or sql action rule samples?
Thanks
Luigi
Edited by: Luigi Oliva on Jun 13, 2008 1:32 PMHi It's working, Problem was in repeat_interval it's working now,
Thanks,
I changed
repeat_interval => 'FREQ=DAILY;BYSECOND=10',to
repeat_interval => 'FREQ=SECONDLY;BYSECOND=10',Thanks,
Edited by: NSK2KSN on Jul 26, 2010 11:14 AM -
Update database table from a work area
hi!
I have a workarea that is like the corresponding database table. There are a lot of fields so I dont want to update each field with an UPDATE but instead I want to do som sort of:
UPDATE dbase_table
FROM work_area
WHERE dbase_table-primary_key = work_area-primary_key
I could only find a statement called UPDATE dbase_table FROM work_area but I dont understand how without specifying a WHERE clause it knows which rows to update.
regards
BaranUPDATE dbtab FROM wa. or
UPDATE (dbtabname) FROM wa.
Extras:
1. ... CLIENT SPECIFIED
2. ... CONNECTION con
Effect
Changes one single line in a database table, using a primary key to identify the line and taking the values to be changed from the specified work area, wa. The data is read out of wa from left to right, matching the line structure of the database table dbtab. The structure of wa remains unchanged. This means that wa must be at least as wide (see DATA) as the line structure of dbtab, and have the same alignment. Otherwise, a runtime error occurs.
If either the database table, dbtab, or the work area, wa, contain Strings, wa must be compatible with the line structure of dbtab.
Example
Changing the telephone number of the customer with customer number '12400177' in the current client:
DATA wa TYPE scustom.
SELECT SINGLE * FROM scustom INTO wa
WHERE id = '12400177'.
wa-telephone = '06201/44889'.
UPDATE scustom FROM wa.
When the command has been executed, the system field SY-DBCNT contains the number of updated lines (0 or 1).
Examples
Update discount for the customer with the customer number '00017777' to 3 percent (in the current client):
DATA: wa TYPE scustom.
SELECT SINGLE * FROM scustom INTO wa
WHERE id = '00017777'.
wa-discount = '003'.
UPDATE scustom FROM wa.
The Return Code is set as follows:
SY-SUBRC = 0:
The specified line has been updated.
SY-SUBRC = 4:
The system could not update any line in the table, since there is no line with the specified primary key.
BR< JAcek -
Updating database table for 'CHANGE' and 'ADD' buttons.
Hi,
I am working on module pool program. Here i am using table control.Below is my requirement:
1) I have designed a selection - screen with 'CHANGE' and 'DISPLAY' buttons and in screen 100 i have 'ADD' and 'SAVE' buttons.
2) when i click on 'CHANGE' , it will move to screen 200 here i need to change quantity field for that particular record which is in table control.once i change the field value and click on 'SAVE' a message should be populated that "RECORD IS SAVED' and this record should be updated in database table with new quantity field value and it should return back to my selection screen.
3) When i click on 'ADD' , it should display already existing records in disable mode and a new line should be added inorder to enter new records. Once i enter the data and click on SAVE, this new record should be saved in the database table along with existing records.
Kindly suggest me a sample code for this as am new to table control in module pool programming.Hi Gaurav,
I've a similar problem!! any solutions to your problem!! -
Updating database table based on BAPI response in case of error
Dear Experts,
My scenario includes pulling records from database stagging table, and push one record at a time to BAPI_ALM_NOTIF_CREATE.
I am using sender JDBC adapter(with select query and update query to mark records as processed).
My question is : Once XI selects records, immediately status is updated in stagging table for the selected records as processed. what if BAPI could not create document? In this case I need to update status of that record as "Not processed".
What should I use?
If BPM, then please tell me the steps.
Is this possible without BPM?
What are the chances of failure between XI and BAPI?
Please provide your inputs.
Thank you.
Div>
S.R.Suraj wrote:
> Hi Divyesh,
>
> Your steps are correct..
>
> 1. JBDC will read record with code = 0 and make it 1...
> 2. Once the bapi process is completed all these read records shoudl be made as 2 (if completed successful) else 0 if bapi went into some error.. so that again the jdbc adapter can poll these records and give back to bapi for processing...
>
> Now your questions
> >>So after selection and updation only proxy call will be done right? So for every polling of jdbc adapter ,proxy call will happen?
> YEs every poll of jdbc will result in a proxy call and every time it will contain next set of records (as the earlier one have already marked as 1)
>
> >>How to achieve this?
> Since this is a synchronous scenario JBDC->XI->Proxy and reverse, I have suggested to use responseonewaybean as a module in sender jdbc adapter (because sender jdbc cannot act synchronously thats why you need to use this module)..
>
> >>Do i need to use BPM? please suggest steps.
> and if this is not working then go for BPM..the steps as i mentioned in my first thread..
>
> Regards
> Suraj
Hi Suraj,
Thanks a lot for your support.
It would be good if you can provide your inputs.
Stagging table records status:
Flag = 0 (XI will poll records)
Flag = 1(XI has polled records and XI will se tthis flag by JDBC adapter)
Flag =2 (should be done based on response from Proxy Tables parameter) Proxy will set tables parameter which will include info on error message and type.
(Now based on new requiremets: for error records status should not be reset to 0 so that XI can poll records again, now stagging table should contain error records(for which proxy can not create notification in SAP) with error message and status flag 2)
Now scenario would be JDBC to Proxy.
Polling interval for JDBC adapter should be 1 minute.
So I think status 0 to 1 will be done by XI after immediately selecting records.
But how about Status 2 that has to be set only for error records only and with error information.
I have to update stagging table records with status 2 and error info based on proxy table response. How this can be done?
This updation will be done in case of error only.
I was thinking this aproach:
We can have two interfaces.
First interface will be jdbc to proxy:
JDBC adapter select and update records with flag =1 and then send to proxy call and create document in SAP. At SAP side if document can not be created then they will store that error info in some table.
Second Interfgace:
Client SAP Proxy will periodically run and send these error records info to XI and XI will update stagging table records accordingly.
Suraj, What is your sugestion in this solution? Do I need to use Responseonewaybean?
Thanks Suraj
Div -
Not updating database table after editing using theADFapplicationJdev10.1.3
Hi
I created the Sample Browse and Edit JSF JSP page oracle ADF application as explained in the cuecards in Jdev10.1.3.
After editing the department table rows in browser i am checking the database tables for the changes.
But my table are still with the old data.they are not updating with the values i changed in the browser.
i followed the steps correctly as explained in cuecards.
where i am going wrong.
What i have to do to commit the changes in to database in my ADFApplication.Did i need anything to add my code.In Jdev 10.1.3,there is no operations folder directly under the Application data module control.
there is only constructors,merge entity,persist entity,refresh entity,remove entity and findalldepartments(),findallemployeeas() nodes under the application data module control.
In findalldepartments,findallemplloyees the operations node is there.under that i don't have the commit .i have only create,execute,first,previous,last,next,delete,removerowwithkey,setcurrentRowWithkey,setcurrentRowWithkeyValue under the operation node.
so how can i commit the operations in database.
Please help me. -
Hi,
My requirement is to update the table EBAN(Purchase Requisition). Let us suppose that there are 3 items in the purchase requisition. If I make any changes to any of the item, the other two items need to be updated with the same changes. I am using a MODIFY....FROM <Internal Table> statement to update the changes in the database,
Now the problem is if I am making any changes in the 3rd item and press save, the database gets updated for 2nd and 3rd item only but the 1st item is not modified in the database.
If I make changes to the 1st item, then the modifications are done to 1st, 2nd and 3rd item and is working fine. The problem is when I make changes to 2nd or 3rd item then the 1st item does not get updated. I tried using update statement, locking table EBAN using ENQUEUE_E_TABLE but nothing worked.
I tried to use MODIFY...FROM <Workarea> inside a loop but it didn't work.
Kindly suggest.
Regards,
Amit BeheraHi
After modifying u append that values work area to internal table. -
Need help in updating database table from screen fields
Hi,
Can anyone tell me how to update the database table with the entries given in the fields of a screen ?...a procedure-wise explanation would be very helpful.
Thank you.
Moderator message: sorry, no beginner forums here, please search for available information or attend training.
locked by: Thomas Zloch on Aug 12, 2010 3:16 PMHi,
Can anyone tell me how to update the database table with the entries given in the fields of a screen ?...a procedure-wise explanation would be very helpful.
Thank you.
Moderator message: sorry, no beginner forums here, please search for available information or attend training.
locked by: Thomas Zloch on Aug 12, 2010 3:16 PM -
CRUD using ADF fails to update database table
Hi All,
I am very new to ADF and JDev. I am using JDev 11.1.1.2.0 and oracle 10g DB.
I have created the required
1. model, view control, Data control files using JDev for a DB table.
2. .jspx file that has a 'panel accordin' and a 'panel formLayout' layouts to display the required table fields on the page.
I am using Panel accordin layout to display the data with navigators buttons and works fine.
In Panel Form layout, after displaying the fields I have added "Submit" button. I have bound this button with "Commit" operation by simple drag and drop.
PS: I have added the fields by simple drag drop of the data control file mapped to the table in question.
On running the page I find things work fine till I want to use the submit button. It just updates the UI front but when I verify in my database table I find that it has not been updated.
I am clueless. Pls guide.
A site with step - by - step end to end development will be very great.
Waiting desparately to get this solved.
Thanks all
Edited by: user8925296 on Jan 16, 2010 2:13 AMYou need to be careful. Submit and committing to the database are two different things.
Submit on a page (and autoSubmit the property) are only posting the changes you typed into the field, back down to the application server. NOTHING is happening with the database at this point. So the applications's internal "cache" of records (using something like ADF BC) is holding the changes but the database doesn't know anything. So if you quit now, no changes will go to the database.
These changes onlyget submitted down to the app server when you do some sort of action like press a button. Simply navigating fields will be doing nothing back to the app server. If you add autoSubmit then you will automatically submit the changes on that field down to the app server when you leave the field (but again, this is not touching the database)
You have to explicitly add a COMMIT operation to save those changes to the database.
Maybe if you try in a simple EMP example and send us your findings we can help direct you further.
Regards
Grant
Maybe you are looking for
-
I cannot open pages documents although I have downloaded the 4.3 version from the App store
-
External monitor not displaying full quality
I recently purchased a Macbook Pro 15.4" Retina. I hooked it up to my Acer External Monitor via the HDMI out on the Macbook. My display settings are set to 1080p, however the display seems very blury and pixelated. I used to have a Late 2007 Macbook
-
Upload excel file (xls) into internal table in SRM 4.0
Hi experts! I need upload a xls file into internal table (in ABAP report) in EBP machine for i work with data in the sheets. Can you help me? Best Regard!
-
Dear Sir, I cannot download netweaver from this website. Is there any setup that must be done before download ? Thanks Sincerely David
-
Issue with New OS 10.2.1.537 and "Delete On" with "Handheld Only"
With the new setting "Delete On" set to "Handheld Only", the following scenarios will delete messages from both the Handheld, AND THE SERVER: 1) Using "Delete Prior" to delete all messages prior to a selected date. 2) Using "Select More" option to se