Question on updating a table based on report data
Hi all,
I am building a new stock request form for our site and I have a report that provides a listing of all requests that have a status of pending based on supv_approve flag being Null.
I want to be able to update the table BGNA_NEW_STOCK_REQUESTS and set SUPV_APPROVE Flag to either Y or N depending on what the user sets as the value in the report. (by changing the standard report column to a text field and setting it to a named LOV with values Y or N, I can change each row in the displayed report to either be Y or N - but have yet to figure out how you then update the table with those values)
Each row of the report has a unique ID - I just havent figured out how you update a table by chaging the values displayed in a report. I get that I can change the feild type from standard report column to text field but havent figured out how to get an update button to actually update the table once I changed the NULL value to Y or N
any help is greatly appreciated!
Edited by: user8607582 on Aug 10, 2009 1:51 PM
Edited by: user8607582 on Aug 10, 2009 1:58 PM
Hello Danny,
Add a column to the sql that is something like this:
select apex_item.checkbox(1,<keyfieldname> "Approved", (then the rest of your query for your report).
This will put a check-box on your report. Move it to the beginning of the line for a better user-interface.
When the user clicks the "Submit" button, ONLY those lines that have a check in the box are sent back. Create a process on your page that does the following:
for i in 1..apex_application.g_f01.count Loop
<do the processing of Approved transactions using this syntax for your update processing... where <keyfieldname> = apex_application.g_f01(i);
<set all of the remaining as "N" if you wish or leave the supervisor's approval as NULL>
end loop;
This will then allow you process all of those items that were checked.
I hope this helps,
Don.
You can reward this reply by marking it as either Helpful or Correct :)
Similar Messages
-
How to update one table based on another table ??
Hello Friends:
I am trying to run the following query in oracle but it won't run.
UPDATE BOYS
SET
BOYS.AGE = GIRLS.AGE
FROM GIRLS
WHERE
BOYS.FIRSTNAME = GIRLS.FIRSTNAME AND
BOYS.LASTNAME = GIRLS.LASTNAME;
This query runs fine in sql server but in oracle its saying can't find "SET". PLease tell me what is the correct syntax in oracle to update one table based on another table.
thanksSee if this helps.
If you wrote an SQL statement:
update boys set age = 10;
Every row in the boys table will get updated with an age of 10. But if you wrote:
update boys set age = 10
where firstname = 'Joe';
Then only the rows where the firstname is Joe would be updated with an age of 10.
Now replace the 10 in the above statements with (select g.age from girls g where g.firstname = b.firstname and g.lastname = b.lastname) and replace where firstname = 'Joe' in the second statement with where exists (select null from girls g where g.firstname = b.firstname and g.lastname = b.lastname). The same concepts apply whether 10 is an actual value or a query and whether you have a where clause with the update statement to limit rows being updated.
About the select null question regarding the outer where clause:
Since the query is checking to see if the row in the girls table exists in the boys table what the column is in this select statement doesn't matter, this column isn't being used anywhere. In this case Todd chose to use null. He could have also used a column name from the table or a lot of times you'll see the literal value 1 used here. -
Build a table based on XML data set with Spry
Hi there,
I'm new to spry technology therefore forgive any basic question of mine.
I'm trying to fill content in a table based on XML data set values but nothing is shown :-(
here is my code.... any suggestion? pls tell me where I'm wrong.
Thank you in advance
<script src="SpryAssets/xpath.js" type="text/javascript"></script>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<script type="text/javascript">
var uscite = new Spry.Data.XMLDataSet("data/Calendario 2011.xml", "csv_data_records/record", {sortOnLoad: "Date", sortOrderOnLoad: "ascending"});
uscite.setColumnType("Date", "date");
uscite.setColumnType("km", "number");
</script>
<div class="RankContainer" id="UsciteDiv" spry:region="uscite" >
<table width="100%" border="0" class="RankTable">
<tr>
<th width="10%" scope="col" spry:sort="Date">Data</th>
<th width="20%" scope="col">Destinazione</th>
<th width="5%" scope="col">KM</th>
<th width="35%" scope="col">Percorso</th>
<th width="30%" scope="col">Breve</th>
<!-- <th width="15%" scope="col">Mappa</th>-->
</tr>
<tr>
<script type="text/javascript">
var rows = uscite.getData();
for (var i = 0; i < rows.length; i++)
if (rows[i]["Mappa"].startsWith("/"))
rowContent = "<td> si </td>";
else
rowContent = "<td> no </td>";
document.write("<td>{Date}</td>");
document.write("<td>"+rowContent+"</td>");
document.write("<td>{km}</td>");
document.write("<td>{Percorso}</td>");
document.write("<td>{Breve}</td>");
</script>
</tr>
</table>
</div>Sure this is how it should work (except that no anchor tag shall be present for Destinazione whereas Mappa has no real value in)
http://www.gsc-borsano.it/_Calendario%202011.html
and this is the non working page
http://www.gsc-borsano.it/_v2Calendario%202011.html
Thanks -
Is it possible to find the table based on the Date ?
Dear Team ,
Is it possible to find the table based on the Date ?
I have created an table ,But forgot the Table Name .
Is it possible to find the Tables created on particular Date .
Regards ,
Augustineas date is record the time also below query will work.
select * from user_objects
where
object_type = 'TABLE' and
to_date(created,'DD-MON-YYYY') =to_date('<your date value in DD-MON-YYYY format>','DD-MON-YYYY');
Edited by: shaileshM on Feb 24, 2010 9:39 PM -
Updating one table based on another
Ok, that sounds a little confusing, but this is what I want to do:
Table A is my source table and is a temp table and will be reloaded daily.
Table B is my target table.
What I want to do is update Table B using a subset of Table A based on a date within Table B. A simple psuedo code would look like:
update Table B
insert * from Table A where Table B.datefield <> Table A.datefield.
Both tables contain the same data elements, so the structure is an exact 1 to 1 match.
Table B was initially created from Table A using the copy command to do an intial load. From this point forward, I just need to update Table B with new data from Table A, which has data loaded into it throughout the day. My idea is to grab just the data that isn't in Table B once a day.
I'm open to all suggestions or ideas............
DougBy cracky, I think that merge thing is just what I'm looking for.
In theory the data in Table A will contain the data in Table B, plus newer data. The older data in Table A is stagnant, meaning that that table is just appended to. The problem is, Table A is periodically trimmed by the application. Table B is to be used for compiling all the data and reporting trend and historical data.
More, specifically, Table A is the History table in HP Openview. Table B will be a table in HP Performance Insight. Since theses are 2 totally seperate databases, I will need to copy over the OpenView History table to a temp table in PI nightly, then cull out the records that were added during that day and place those and only those into the PI table for reporting.
I'll give the merge command a try. I think it will do exactly what i need.
Thanks,
Doug -
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 -
Updating a table from Oracle Report
This is on Report 6i. How do I achieve this? I need to pass UPDATE statement on an oracle database table based on a condition from report formula.
Thanks,
RSo, there is no difficulty in this. As normal DML are working. You can perform also UPDATE/INSERT from report on your condition. So, you can use where you want.
Or you want to know something else?
-Ammad -
Update a table based on Min value of a column of a Another Table.Pls Help.
Dear All,
Wishes,
Actually I need update statement some thing like below scenario...
Data in table is like below:
I wrote a query to fetch data like below ( actually scenario is each control number can have single or multiple PO under it ) (i used rank by to find parent to tree like show of data)
Table: T20
Control_no P_no Col3
19950021 726473 00
19950036 731016 00
19950072 731990 00
731990 01
19950353 734732 00
734732 01
19950406 736189 00
736588 01
736588 02
736588 03
Table : T30
Control_no P_no col3
19950021 726473
19950036 731016
19950072 731990
731990
19950353 734732
734732
19950406 736189
736588
736588
736588
Now requirement is I need to update Table T30's col3 (which do have values in T20 but not this table) in such a way that , It should take MIN (COL3) from T20 and then update that value to related Col3)
Better I can explain through below new data format in T30 after update:
After update it should like:
Table : T30
Control_no P_no col3 (this is updated column)
19950021 726473 00 -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
19950036 731016 00 -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
19950072 731990 00 -- see here..both Pno should updated as '00' as MIN value col3 in Table T20 related to this
731990 00 record is '00' (out of 00,01 it should select 00 and update that value here)
19950353 734732 00 -- same again both Pno should updated as '00' as MIN value col3 in TableT20 related to this
734732 00 record is '00' (out of 00,01 it should select 00 and update that value here)
19950406 736189 00 -- As there is single col3 value in T20, 00 should be updated here.
736588 01 -- Here it should update col3 as '01' since for this pno(736588)
736588 01 -- Here too it should update col3 as 01 per requirement ,minimum value of this pno in T20
736588 01 -- same here too.. Sorry if my post formatting is not good...
Hope i am clear in my requirement..(update T30 col3 based on min value of col3 of related records)
Please suggest some update sql for this...(ideas would be great)
I am using oracle 10 g version soon will be migrated to 11g..
Regards
Prasanth
Edited by: Onenessboy on Oct 20, 2010 12:13 PM
Edited by: Onenessboy on Oct 20, 2010 12:15 PMOnenessboy wrote:
I am really sorry, my post so nonsense in look..
I used to use for actuall code..
the out put i tryped, i used [pre] , [/pre] but still does not look good..
hmm..thanks for your suggestion hoek..
so any ideas about my requirement...I would suggest spending a bit more time trying hoek's suggestion regarding {noformat}{noformat} tags instead of repeatedly asking for more help.
Because to understand your requirement, people are going to have to read it first. -
How to update the price based upon PGI date
Hi
I have issue of updation of the Prices and freight based on PGI date in the billing we are using the two billing types for the excsies and tax invoice creation .And in the copy control pricing type is maintained Aas "C" for the billing types with single delivery but someHow MRP in the excise billing has been picked from the condition record thats validity is ended and in Tax invoice it picks up the correct prices
Both pricing condition types has pricing type "B" from Billing date and in the freight we have maintained as "A" SRD
But for the some cases specially for the excise related part that is based upon the MRP we are facing this issue
Pricing date is some how coming from sales document
Please find the problem details in the attachmentHi,
if you see two condition tabs snap shots you can understand clearly because that two invoices has been created in two different dates and you have maintained the pricing date C-billing date ( KOMK-FKDAT).Due to this,the price of ZMRP is coming differently.After you creation of first invoice then you would have changed ZMRP amount.Now while you are creating second invoice ,system has taken new price of ZMRP in billing level.
Note:While creating second invoice, PGI date might have come into billing level but someone would be changed billing date manually at header level of billing document.Please check that one also.
Kindly let me know if you need further help on this.
Thanks,
Naren -
Difference in output for asset report based on report date
Dear all,
Our fiscal year is Jan- Dec.
In Asset balance report S_ALR_87011963,when I give report date as 31.07.2011, in output it is showing the value in every field as zero.
But if give 30.06.2011 or 31.08.2011 or any other period end it is showing correctly values like acquisition,accumulated depreciation and net book value.
Any of have any idea on this?
Your help is much appreciated.
Thanks in advance.
KumarHi Bernhard,
Thanks for your reply.
It is happening only for some assets.
Could you please elaborate your explanation on this.
Only for July ending (31.07.2011) values are coming as zero.
Thanks,
Kumar -
Update SAP tables after ALV report is displayed
Hi All,
I have to display a ALV report using function module REUSE_ALV_GRID_DISPLAY.
After the report is displayed, user can edit some of the flds in the report, and the fields need to updated in the table. How do I proceed to accomplish this.
Is it possible to use FM 'REUSE_ALV_DRID_DISPLAY' to do this or we need to use OOPS ALV to do this.
I searched for this in this forum, but couldnt get.
Thanks in advance,
AnanthYou can use the REUSE_ALV_GRID_DISPLAY. and can make it a changable. You can specify the column to be changable. Once the user enters data into that coloumn the interna table automatically gets populated with the values.
I have done a similar program. However you might need to copy some standard GUI status based on your requirements.
Whats ur mail ID. I can send you the program I have developed.
Shreekant -
Performance issue and functional question regarding updates on tables
A person at my site wrote some code to update a custom field on the MARC table that was being copied from the MARA table. Here is what I would have expected to see as the code. Assume that both sets of code have a parameter called p_werks which is the plant in question.
data : commit_count type i.
select matnr zfield from mara into (wa_marc-matnr, wa_marc-zfield).
update marc set zfield = wa_marc-zfield
where werks = p_werks and matnr = wa_matnr.
commit work and wait.
endselect.
I would have committed every 200 rows instead of every one row, but here's the actual code and my question isn't around the commits but something else. In this case an internal table was built with two elements - MATNR and WERKS - could have done that above too, but that's not my question.
DO.
" Lock the record that needs to be update with material creation date
CALL FUNCTION 'ENQUEUE_EMMARCS'
EXPORTING
mode_marc = 'S'
mandt = sy-mandt
matnr = wa_marc-matnr
werks = wa_marc-werks
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
" Wait, if the records not able to perform as lock
CALL FUNCTION 'RZL_SLEEP'.
ELSE.
EXIT.
ENDIF.
ENDDO.
" Update the record in the table MARC with material creation date
UPDATE marc SET zzdate = wa_mara-zzdate
WHERE matnr = wa_mara-matnr AND
werks = wa_marc-werks. " IN s_werks.
IF sy-subrc EQ 0.
" Save record in the database table MARC
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = wa_return.
wa_log-matnr = wa_marc-matnr.
wa_log-werks = wa_marc-werks.
wa_log-type = 'S'.
" text-010 - 'Material creation date has updated'.
wa_log-message = text-010.
wa_log-zzdate = wa_mara-zzdate.
APPEND wa_log TO tb_log.
CLEAR: wa_return,wa_log.
ELSE.
" Roll back the record(un save), if there is any issue occurs
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
return = wa_return.
wa_log-matnr = wa_marc-matnr.
wa_log-werks = wa_marc-werks.
wa_log-type = 'E'.
" 'Material creation date does not updated'.
wa_log-message = text-011.
wa_log-zzdate = wa_mara-zzdate..
APPEND wa_log TO tb_log.
CLEAR: wa_return, wa_log.
ENDIF.
" Unlock the record from data base
CALL FUNCTION 'DEQUEUE_EMMARCS'
EXPORTING
mode_marc = 'S'
mandt = sy-mandt
matnr = wa_marc-matnr
werks = wa_marc-werks.
ENDIF.
Here's the question - why did this person enqueue and dequeue explicit locks like this ? They claimed it was to prevent issues - what issues ??? Is there something special about updating tables that we don't know about ? We've actually seen it where the system runs out of these ENQUEUE locks.
Before you all go off the deep end and ask why not just do the update, keep in mind that you don't want to update a million + rows and then do a commit either - that locks up the entire table!The ENQUEUE lock insure that another program called by another user will not update the data at the same time, so preventing database coherence to be lost. In fact, another user on a SAP correct transaction, has read the record and locked it, so when it will be updated your modifications will be lost, also you could override modifications made by another user in another luw.
You cannot use a COMMIT WORK in a SELECT - ENDSELECT, because COMMIT WORK will close each and every opened database cursor, so your first idea would dump after the first update. (so the internal table is mandatory)
Go through some documentation like [Updates in the R/3 System (BC-CST-UP)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCSTUP/BCCSTUP_PT.pdf]
Regards -
Would like to update a table based on 1 row being returned from a join.
Hi, hope you guys can help.
I'd like to update 1 rown that is returned from a join query. The following code returns 1 row.
SELECT pt.*, pv.* FROM
--SELECT pt.template_id, pt.property_code, pv.value FROM
property_template pt inner join
property_value pv on pt.template_id = pv.template_id
WHERE property_code = '500_URL';
Based on the row returned i'd like to update a column called VALUE from the property_value table.
I've tried the following code but it updates every row in the value column.
update property_value set value = 'http://10.14.64.170:8080/XTI/UPLOAD'
where exists
SELECT pt.*, pv.* FROM
--SELECT pt.template_id, pt.property_code, pv.value FROM
property_template pt inner join
property_value pv on pt.template_id = pv.template_id
WHERE property_code = '500_URL'
Any help with this would be appreciated.You need this
UPDATE property_value pv
SET value = 'http://10.14.64.170:8080/XTI/UPLOAD'
WHERE EXISTS (
SELECT 1
FROM property_template pt
WHERE pt.template_id = pv.template_id
AND property_code = '500_URL'
);Regards
Arun -
UPDATING child table based on the mods to parent record
I have a one to many relationship between Table A and Table B.
I have a field in both of my tables that tracks the status of the record in each table. ie: submitted, inprogress, done.
When records are created in Table A and B, status is set to SUBMITTED. When the application is being reviewed, the status in parent table is changed to INPROGRESS. As soon as the status in Table A changes to INPROGRESS for the parent record, i also want the status in Table B to change to INPROGRESS for the corresponding child records.
How can I do this? Triggers is one of the solns, but is there something that i can do with the PROCESS option available on the parent form?
Any help is very much appreciated.Hi,
Firstly, as Oracle is a relational database, you shouldn't need to have the setting on a child record where it will always be the same as the parent record.
Secondly, a trigger is probably a better place to make the update, if you need to do this, as this would also handle updates outside of Apex.
Finally, yes you can create a process to do this if you want. You can create an unconditional process (that is, it runs whenever the page is submitted) and does something like:
UPDATE TABLEB
SET STATUS = :P1_STATUS
WHERE FK_ID = :P1_PK_ID
AND STATUS <> :P1_STATUSAndy -
Update one table based on condition from another table using date ranges
Hello!
I have two tables:
DateRange (consists of ranges of dates):
StartDate FinishDate
Condition
2014-01-02
2014-01-03 true
2014-01-03
2014-01-13
false
2014-01-13
2014-01-14 true
Calendar (consists of three-year dates):
CalendarDate IsParental
2014-01-01
2014-01-02
2014-01-03
2014-01-04
2014-01-05
2014-01-06
2014-01-07
2014-01-08
2014-01-09
2014-01-10
I want to update table Calendar by setting IsParental=1
for those dates that are contained in table DateRange between
StartDate and FinishDate AND Condition IS TRUE.
The query without loop should look similar to this but it works wrong:
UPDATE
Calendar
SET IsParental = 1
WHERE
CalendarDate BETWEEN
(SELECT
StartDate
FROM DateRange
WHERE Calendar. CalendarDate = DateRange. StartDate
AND
(SELECT StartDate
FROM DateRange
WHERE Calendar. CalendarDate = DateRange. FinishDate
AND Condition
IS TRUE
Is it possible to do without loop? Thank you for help!
AnastasiaHi
Please post DDL+DML next time :-)
-- This is the DDL! create the database structure
create table DateRange(
StartDate DATE,
FinishDate DATE,
Condition BIT
GO
create table Calendar(
CalendarDate DATE,
IsParental BIT
GO
-- This is the DML (insert some sample data)
insert DateRange
values
('2014-01-02', '2014-01-03', 1),
('2014-01-03', '2014-01-13', 0),
('2014-01-13', '2014-01-14', 1)
GO
insert Calendar(CalendarDate)
values
('2014-01-01'),
('2014-01-02'),
('2014-01-03'),
('2014-01-04'),
('2014-01-05'),
('2014-01-06'),
('2014-01-07'),
('2014-01-08'),
('2014-01-09'),
('2014-01-10')
select * from DateRange
select * from Calendar
GO
-- This is the solution
select CalendarDate
from Calendar C
where EXISTS (
select C.CalendarDate
FROM DateRange D
where C.CalendarDate between D.StartDate and D.FinishDate and D.Condition = 1
UPDATE Calendar
SET IsParental = 1
from Calendar C
where EXISTS (
select C.CalendarDate
FROM DateRange D
where C.CalendarDate between D.StartDate and D.FinishDate and D.Condition = 1
[Personal Site] [Blog] [Facebook]
Maybe you are looking for
-
How do i open Webpageicons.db? I'm trying to delete my favicons and can't!
How do i open Webpageicons.db? I'm trying to delete my favicons. Way back some time ago I think instead of deleting the items inside the favicons file I sent the whole folder to the trash. So now I don't have a file folder, its a document page that A
-
Help with sm 4.0 email and ccms
Hi, I'm having problems generating emails in sm 4.0. I've configured the landscape in t/c solution_manager and have alerts appearing for my trainng system. I'm just checking cpu at moment. I've set the treshholds to a low value in order for alerts to
-
Known issue..? dot notation in XSD..
I have an HL7 exported schema.. very large 1.5 MB In my sample payload I have good data: <receiveInput_Read_Input> <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ADT_A01"> <ADT_A01 xmlns="http://www.edifecs.com/xdata/200" xmlns:xsi
-
Startup script to load shortcuts - in a Citrix environment
Let me offer a sample of what I have and ask if anyone knows how to fill in the gaps. For starters, a listening script upon booting up InDesign: #target InDesign #targetengine session //collect the name of current user var userName = getUser(); funct
-
Activity Price in Cost Component Structure
Hi, After costing run I have updated Activity Price in KP26.. I want to see latest activity price in Cost component structure e.g. Labour Activity and Machine Activity..cost for this a) Is it require re-costing run? b) how can we calculate activity