How to insert new records in Master and detail Forms.
Hi,
I am having trouble inserting values in both master and detail view at the same time. The scenarios is I have a Dept Table (View Object-VO1) and Employee Table(View Object -VO2) both linked with a foreign key, as per Default HR schema in Oracle DB XE.
Now I want to insert new record in both Dept(VO1) and EMP(VO2) table via a New page say ( Page2 ). There is a button on Page1 with button INSERT .I can only drag-drop "CreateInsert" operation on that button for VO1 or VO2. So only text box for Dept records are enable to insert data but not Emp records. Is there a way I can insert data in both the tables at the sametime??
Thanks,
MB
Hi MuradRabbani,
You can programmatically call both createInsert Operations,
Add to your pageDef both CreateInsert Operations.
Create a button tha will call insert method from Master (VO1) and then call insert method for Detail (VO2)
Here is an Example code of calling the operations:
DCBindingContainer dcb = ADFUtils.getDCBindingContainer(); //you need ADFUtils.java and JSFUtils.java classes. You can find them in the sample applications in your JDeveloper.
OperationBinding oper = dcb.getOperationBinding("CreateInsertVO1");
oper.execute();
-----------------NOTE: at this point you should have set values that compine the ViewLink on the master in order the detail will know where to link the new record there are many ways to do it.
As an approach try to overrdi the create Method on the in the ViewRowImpl of your Master vo (VO1)
e.g.
@Override
protected void create(AttributeList attributeList) {
//before
attributeList.setAttribute("NameOfAttribute", valueHere);
super.create(attributeList);
After that you should call the operation for your detail VO2
e.g.
DCBindingContainer dcb = ADFUtils.getDCBindingContainer();
OperationBinding oper = dcb.getOperationBinding("CreateInsertVO2");
oper.execute();
The detail record will now have the values from your master automatically.
Regards,
Dimitris.
Similar Messages
-
Urgent help : how when insert new record navigation off
hi master
Sir
when i insert new record by mistake press down key and curser move to next record and my need is
When I insert new record or change any record that time my form navigation musht be off and no move to next record how I restrict to navigation please give me idea which event and what code I use
Thanking you
aamirIf u want the cursor not to move ahead from a particular field when the records are inserted or updated on that field then u can just write null to the
key-next-item trigger of that particular item.
ie IN key-next-item
null;
Hope this is what you wanted. -
How to insert new record into altered table
I am using JDBC with MySQL. I altered existing table and want to insert new record using java class. But it is not possible.How to do?
How is it "not possible"?
Either modify the Class for the new fields, or give the new fields default values (if applicable). If the type of an existing column has changed, then only the first option is available.
Where's the problem? -
Insert New Record in Master Data by Code
Hi guys,
I need to insert a new value in an infoobject by code creating:
1 new record in table P (data not time dependent)
1 new record in table S (SID table)
This code could be executed by many tasks in parallel and so it could create problems of concurrency in writing and in quality of the value of new SID selected.
The first question is:
THERE IS A STANDARD CODE THAT INSERT A NEW RECORD ALSO CREATING SIDS, managing concurrency in writing and reading?
The second (if not answer to first)
This is a part of my code (draft)... any suggestions:
insert into TABLE P
INSERT INTO /bic/pzck9idfl VALUES st_p_zck9idfl.
IF sy-subrc = 0.
FLAG = 1.
WHILE FLAG = 0.
SELECT MAX( sid )
INTO v_sididfl
FROM /bic/szck9idfl.
ADD 1 TO v_sid.
*record for SID table
st_zck9idfl-sid = v_sid.
st_zck9idfl-/bic/zck9idfl = v_idfl.
st_zck9idfl-chckfl = 'X'.
st_zck9idfl-datafl = 'X'.
st_zck9idfl-incfl = 'X'.
insert record in SID Table
INSERT INTO /bic/szck9idfl VALUES st_zck9idfl.
COMMIT WORK AND WAIT.
IF Sy-subrc = 0.
SELECT SINGLE FROM /bic/szck9idfl
WHERE SID = v_SID
AND /bic/zck9idfl NE v_idfl.
IF Sy-SUBRC = 0.
FLAG = 1.
ELSE.
FLAG = 0.
ENDIF.
ELSE FLAG = 1.
ENDIF.
ENDWHILE.
Thanks and points to helpful answer!
ciao
C@fHi Claudio,
I would not recommend to do this. Please have a look for standard fm to that job of have a look into the class library to find some methods. On the first look at your code here my comments:
SELECT MAX( sid )
INTO v_sididfl
FROM /bic/szck9idfl.
ADD 1 TO v_sid.
Not a pretty good idea, as there is a number range object for getting a sid for each infoobject. If you get your sid like this, all later standard postings will fail with 'duplicate records'.
*record for SID table
st_zck9idfl-sid = v_sid.
st_zck9idfl-/bic/zck9idfl = v_idfl.
st_zck9idfl-chckfl = 'X'.
st_zck9idfl-datafl = 'X'.
st_zck9idfl-incfl = 'X'.
if you mark all these flags with 'X' you will tell the system that this record is used somewhere in masterdata or in a datatarget and you cannot delete it with standard methods.
regards
Siggi -
How to insert new record in ALV GRID?
Hi all,
I am displaying ztable data into grid format using method SET_TABLE_FOR_FIRST_DISPLAY of Class CL_GUI_ALV_GRID using OOPS concept.now i want to insert a new record into ALV grid?
If anyone has tried then please tell me?
Thanks and Regards,
ArpitaHi Avinash,
Thanks for replay.
My problem is solved.i did it as follows.
HANDLE_DATA_CHANGED
FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_UCOMM.
METHOD HANDLE_DATA_CHANGED.
LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO WA_GOOD_CELLS.
CASE WA_GOOD_CELLS-FIELDNAME.
WHEN 'ZCARRID'.
CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = WA_GOOD_CELLS-ROW_ID
I_FIELDNAME = WA_GOOD_CELLS-FIELDNAME
IMPORTING
E_VALUE = ZCARRID1.
WA_FLI-ZCARRID = ZCARRID1.
ENDMETHOD.
Using method CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE,
i am reading individual values and assinning it to WA and then insert into ZTBALE.
Thanks,
Arpita -
[php+mysql] how to insert 3 records at once and print out all 3 records?
Hi all,
I have to create a serie of pages that allow the user to:
1- Insert 3 records in a mysql db at once
2- click NEXT
3- viewverify//print the data that he has entered (all 3
records)
4- click PRINT
5- click FINISH
then, restart from 1
What is the best way to do this?
TIA for any suggestion.
tonyThe best way is usually to use a stored procedure. Do you
know if the version of MySQL you are using supports sprocs? -
How to insert new record into oracle table from GridView in VS2005.
I need to insert records into Oracle10g table from VS2005 GridView using the Insert Method in Business Logic Class. The Update and Delete Methods are working fine. What's the best way out?
How is it "not possible"?
Either modify the Class for the new fields, or give the new fields default values (if applicable). If the type of an existing column has changed, then only the first option is available.
Where's the problem? -
How to insert new record in the database table using the Jdeveloper
Hi Masters
I am new Bee in j2EE developing side and i ahve oracle jdeveloper 9i version is 9.0.4
And now I wann to know that how can i create the web application that will enter the Data in the HTML FORM and save that data into the Table emp plz tell me step by step
thx in advancethe steps to follow -
download JDeveloper 10.1.2 from OTN (9.0.4 is very old and has some features that won't be in the next releases).
Then follow the ADF Workshop from the JDeveloper home page on OTN.
(If you have to use 9.0.4 then look for the archives of JDeveloper on OTN)
for example:
http://www.oracle.com/technology/products/jdev/viewlets/viewlet-archive0903.html -
How to insert new record or update existing record using a complex view?
Currently I created this screen, there is no problems on display data, only on the update funtionality (it means insert / update / delete on the table for which the view is based on).
I have a table and a complex view in order to display the information from the table in a tabellar form (i.e up to 70 record in same "record" in the form, one for each item)
The view is like this
select a.f1, a.f2, get_value(a.pk1,1) a1, get_value(a.pk1,2) a2, get_value(a.pk1,3) a3............
from my_table a
where a.proj_id = user
and I want to permit the update of the field a1, a2, a3 in a multiposition canvas (tabellar).
I created an INSTEAD-OF trigger.
But it not work only in the form. I receive the error FRM-40654 when I try to change the existing value in the running form based on that view.
The view is woking and updatable using sql-plus.
If I query
select * from ALL_UPDATABLE_COLUMNS where table_name = 'SPV_BOQ_BOM_POS_ACTIVITIES';
in which 'SPV_BOQ_BOM_POS_ACTIVITIES' is the name of my view.
The question is: why if the view is updatable using SQL*Plus, is not updatable using Oracle Form 10gR2 ?
Someone could help me asap?
ThanksI removed on the datablock three items that are not showed, one of this is the Sysdate of update on the table for which the view is based.
I removed also the on-lock trigger and the update from the form is NOT working fine.
But for now I can still mantaing the ON-LOCK trigger.
Is not a priority to remove this trigger.
I still have the problem when the field is null, it mean that in the table SP_BOQ_BOM_POS_ACTIVITIES the record not exist.
I try now to explayn better.
SPV_BOQ_BOM_POS_ACTIVITIES is the name of the view.
SP_BOQ_BOM_POS_ACTIVITIES is the name of the table.
This are the desc
desc SPV_BOQ_BOM_POS_ACTIVITIES
Describing SPV_BOQ_BOM_POS_ACTIVITIES....
NAME Null? Type
BOQ_HEADER_ID NOT NULL NUMBER(12,0)
BB_ID NOT NULL NUMBER(12,0)
BOQ_ID NOT NULL NUMBER(12,0)
PROJ_ID NOT NULL VARCHAR2(10)
ACT_GROUP_CODE VARCHAR2(30)
TOTAL_QTY NUMBER
ACT_CODE_1 VARCHAR2(4000)
QTY_1 NUMBER
ACT_CODE_2 VARCHAR2(4000)
QTY_2 NUMBER
ACT_CODE_3 VARCHAR2(4000)
QTY_3 NUMBER
ACT_CODE_4 VARCHAR2(4000)
QTY_4 NUMBER
ACT_CODE_5 VARCHAR2(4000)
QTY_5 NUMBER
ACT_CODE_6 VARCHAR2(4000)
QTY_6 NUMBER
USR_ID NOT NULL VARCHAR2(10)
LMOD NOT NULL DATE
INT_REV NOT NULL NUMBER(6,0)
The field QTY_1, QTY_2.... QTY_6 are calculated with a customer stored function from the table SP_BOQ_BOM_POS_ACTIVITIES.
Also the field ACT_CODE_1, ACT_CODE_2, .... ACT_CODE_6 are calculated with a customer stored function from the table SP_BOQ_BOM_POS_ACTIVITIES.
desc SP_BOQ_BOM_POS_ACTIVITIES
Describing SP_BOQ_BOM_POS_ACTIVITIES....
NAME Null? Type
BBPA_ID NOT NULL NUMBER(12,0)
BOQ_HEADER_ID NOT NULL NUMBER(12,0)
BB_ID NOT NULL NUMBER(12,0)
BOQ_ID NOT NULL NUMBER(12,0)
PROJ_ID NOT NULL VARCHAR2(10)
ACT_GROUP_CODE NOT NULL VARCHAR2(30)
ACT_CODE NOT NULL VARCHAR2(30)
QTY NUMBER(12,0)
FLG_MANUAL_CHANGE VARCHAR2(1)
USR_ID NOT NULL VARCHAR2(10)
LMOD NOT NULL DATE
INT_REV NOT NULL NUMBER(6,0)
If I use SQL Navigator this insert working fine
insert into SPV_BOQ_BOM_POS_ACTIVITIES
(BOQ_HEADER_ID, BB_ID, BOQ_ID, PROJ_ID, ACT_GROUP_CODE, ACT_CODE_1, QTY_1)
values (5050, 5015, 30486, 'B39368', 'TEST', '0101010101010101', 1709)
1 row(s) inserted
Instead using the Screen, at runtime, I receive the message:
FRM-40400 Transation Complete: 1 records applied and saved
but nothing is saved in the table SP_BOQ_BOM_POS_ACTIVITIES, and the view SPV_BOQ_BOM_POS_ACTIVITIES contain the calculated QTY_1 for the 'key', with null value.
Moreover If in the field QTY_1 (NUMBER) I put a character, instead a Number, just to see if the Screen attempts or not an UPDATE or AN INSERT, the message is FRM-40509: Oracle Error. UNABLE TO UPDATE RECORD. Why happen an Update and not an INSERT using the Screen?
In effect, the trial using SQL navigator of the following statement
insert into SPV_BOQ_BOM_POS_ACTIVITIES
(BOQ_HEADER_ID, BB_ID, BOQ_ID, PROJ_ID, ACT_GROUP_CODE, ACT_CODE_1, QTY_1)
values (5050, 5015, 30486, 'B39368', 'TEST', '0101010101010101', 'r');
I got Invalid Number and it's ok as answer from the database.
Edited by: fmariani on 30-apr-2009 1.51 -
How get all record from master and matching record from detail
hi master
sir i have master detail table
i have many record in master table but some record in detail table how i get
all record from master and matching record from detail
such as
select m.accid,m.title,d.dr,d.cr from master m, detail d where m.accid=d.accid
this query not work that get only related record i need all record from master
please give me idea
thanking you
aamirhi master
sir i have master detail table
i have many record in master table but some record in
detail table how i get
all record from master and matching record from
detail
such as
select m.accid,m.title,d.dr,d.cr from master m,
detail d where m.accid=d.accid
this query not work that get only related record i
need all record from master
please give me idea
thanking you
aamir
select m.accid,m.title,d.dr,d.cr
from master m, detail d
where m.accid=d.accid (+)The outer join operator (+) will get you all the details from master and any details from the detail if they exist, but the master details will still be got even if there are not details.
Note: Oracle 10g now supports ANSI standard outer joins as in:
select m.accid,m.title,d.dr,d.cr
from master m LEFT OUTER JOIN detail d on m.accid=d.accid -
Inserting new records into database table at runtime
Hi all ,
How to insert new records into database table at runtime on click update?
Thanks.Hi Sasikala,
Just for your understanding am giving a sample code snippet which you can use to read the contents of your Table UI element & save the data on to your database. Suppose you have a button up on pressing which you want to read the data from your screens table & save on to the database then you can proceed as shown below:
1) Obtain the reference of your context node.
2) Fetch all the data present in your table into an internal table using methods of if_wd_context_node
3) Use your normal ABAP logic to update the database table with the data from your internal table
In my example I have a node by name SFLIGHT_NODE and under this I have the desired attributes from SFLIGHT. Am displaying these in an editable table & the user would press up on a push button after making the necessary changes to the tables data. I would then need to obtain the tables information & save on to the database.
data: node_sflight type ref to if_wd_context_node,
elem_sflight type ref to if_wd_context_element,
lt_elements type WDR_CONTEXT_ELEMENT_SET,
stru_sflight type if_main=>element_sflight_node,
it_flights type if_main=>elements_sflight_node.
" navigate from <CONTEXT> to <SFLIGHT_NODE> via lead selection
node_sflight_node = wd_context->get_child_node( name = 'SFLIGHT_NODE' ).
lt_elements = node_sflight->get_elements( ).
" Get all the rows from the table for saving on to the database
loop at lt_elements into elem_sflight.
elem_sflight->get_static_attributes( importing static_attributes = stru_sflight ).
append stru_sflight to it_flights.
endloop.
" Finally save the entries on to the database
modify ZSFLIGHT99 from table it_flights.
if sy-subrc eq 0.
endif.
However a word of caution here.... SAP doesn't ever recommend directly modifying the database through an SQL query. You would preferably make use of a BAPI for the same. Try go through Thomas Jung's comments in [here|modify the data base table which is comming dynamiclly;.
Regards,
Uday -
How to show master and detail tables in different pages?
Hi,
Can somebody expalin me how to include or bind the master and detail tables to different pages which are included at runtime.
thnaks,
Naresh.Hello!
you have ti create a Master/Detail data structure.
In the first page drag the master table, on the second drag a detail table.
It should work out of the box. Selecting a record on the master table selects
the details on the detail table automatically!
regards,
Mario Udina -
Master and detail in the same page
db11xe , apex 4.0 , firefox 24 ,
hi all ,
i am trying to insert the master and detail data in one step in the same page :
i have two tables (clients) and (tests_administered)
the client table's region contains theses items
client_id
client_name
the other table's region contains these columns -- the tabular region
row selector
test_admin_id -- pk, hidden
client_id -- hidden , this is the one i should populate with values
and more columns
i've done this :
1- removed the condition of the tabular region .
2- Added the request CREATE to the list in condition of the APPLYMRU process -- or :request like ('CREATE')
3- Added new process with following code : -- with sequence before the applymru process and after process row of clients process
for i in 1..apex_application.g_f02.count
loop
apex_application.g_f02(i) := :p2_client_id ;
end loop ;
but nothing happened . why ? what did i miss ?
thanksHi,
Create a Master Detail Form through the APEX Wizard
Make sure you choose the Primary Keys for the Master Detail as one of your Column and not the ROW ID.
Selecting an existing Sequence for the Primary Key is preferred.
Select the option the where your Master and Detail appears in the same page.
Initially when you run the page your master and detail will not appear at the same time in the page when your Master Detail Form is in the entry form mode. For this you have to go to your Tabular Form(Detail Form) region, and below you will have to remove the Condition for the display of your Tabular form and set it to “No Condition”.
Now when you run the page both the Master and Detail form will appear together in the create mode but you will not be able to insert or create both master and detail records at the same time when u click the create button. For this the following needs to be done: You need to create a PL SQL Tabular Form process :
Let's say your master form is based on DEPT and your detail tabular form is based on EMP. Make sure the following things are configured:
The DEPT insert/update DML process runs before the new tabular form PLSQL process. (ie) the new PL SQL Tabular Form Process that you create should be inbetween Automatic Row Processing(DML) and Multi Row Update Process , so create the new Tabular Form Pl SQL process with a sequence number inbetween these two Processes.
Make sure you choose Tabular form while creating this PL SQL process.
The new tabular form PL/SQL process executes the following as the source
:DEPTNO := :P1_DEPTNO;
Where DEPTNO is the Foreign Key column in the Tabular Form that links the Primary Key Item P1_DEPTNO of the Master Form.
Finally this new PL SQL process conditionally runs when DEPTNO is null, so you need to add the following condition to the process:
The final step to accomplish in creating both the Master and Detail records at the same time is to make a change in the condition of the Multi Row Update Process. :request in ('SAVE','CREATE') or :request like 'GET_NEXT%' or :request like 'GET_PREV%'
-We make this change so that records get inserted into the Detail table when we click the ‘’Create” button.
Now you can Run your page and create both the Master and Detail records at the same time.
Thanks and Regards,
Madonna -
How do I insert new record and get results on a landing page
how do I insert new record and get results on a landing page
It's not clear from your post what you are asking. In a SQL database, you use the INSERT statement to insert a row into a table. You use the SELECT statement to retrieve rows. Here's some basic info on how to do that within PHP
PHP MySQL Insert Into
PHP MySQL Select -
Receiver JDBC: Error while doing the Deleting and Inserting new records
Hi All,
I am doing Idoc to JDBC scenario. In this I am collecting & bundling different type of Idocs and then sending to the JDBC receiver. My requirement is to delete the existing records in the database and insert the new records. I have configures as mentioned in the link
Re: Combining DELETE and INSERT statements in JDBC receiver
In the above link its shows for single mapping. In my scenario I am using multi mapping for collecting idocs in BPM. If I configured for normal mapping then it is working fine(Deleting existing records and Inserting new record). Whenever I am using multi mapping then I am getting following error in the receiver JDBC communication channel u201CError while parsing or executing XML-SQL document: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)u201D . Can you please tell me what might be the problem.
Thanks & Regards,
T.PurushothamHi !
check this out:
JDBC - No 'action' attribute found in XML document - error
JDBC receiver adapter: No 'action' attribute found in XML document
It appears that the inbound payload (the one that is going from XI to the JDBC adapter) does not have the requiered tag to specify which SQL action to execute in the receiver system. Maybe the multimapping is not creating the desired output message format.
Regards,
Matias.
Maybe you are looking for
-
Drop Down Menu - Clipping in IE
Hello, I'm having an issue with drop down menus when displayed in IE6. The site is at www.dtoomey.com and the menus in question are on the left margin of the page, with a grey background. Basically, with Opera, Firefox and Safari (mac/pc), the text b
-
Redundant Shipping Option DropDown
Hi In the store's shopping cart layout there is the shipping option dropdown that shows all the options available to the user. This dropdown has the words CHOOSE SHIPPING OPTION as the default listing, but then right above it, it says CHOOSE SHIPPING
-
HT4623 Plse need assistance urgentlu I was updating my Iphone and coudnt finish the phone software
Plse need urgent assistance. Was updating my Iphone and when was installing the Iphone software a problem left my Iphone with the apple icon and can not reinstall it.
-
TextEdit ABAP types and objects
Anyone who knows an appropriate ABAP type or ABAP object to store the content of my HTMLB textEdit elements? Any help will be appreciated. Thanks!
-
HT204216 how do you change the name of your iMac you setup when first cut on
need to change the name i assigned my imac when first cut on.