Insert Multiple Records into Multiple ZTABLEs inside the BAPI
Hi,
I have a requirement to Insert or Update Multiple Records into a ZTABLE inside the BAPI. Is there any special approach inside the BAPI to insert or update ZTABLEs with multiple records. It looks like the simple INSERT Statement is not working. Can you please suggest me a Suitable solution for this req?
Thanks and Regards,
Kannan
Hi,
INSERT ZTABLE FROM TABLE ITAB.
The itab structure should be of the structure ZTABLE..
Same for MODIFY and update.
MODIFY ZTABLE FROM TABLE ITAB..
Thanks,
Naren
Similar Messages
-
Splitting of a CSV File with Multiple Records into Multiple XML File
Dear All,
<b> I am doing a Scenario of CSV to XML Files. I am using BPM for the same. My incoming CSV File has got multiple records. I want to break this Multiple records into Multiple XML Files having one record each.</b>
Can someone suggest how can I break this rather Split this into Multiple XML Files.
Is Multimapping absoltely necesaary for this. Can't we do this without Multimapping. Can we have some workaround in the FCC parameters that we use in the Integration Directory.
Kindly reply ASAP. Thanks a lot to all in anticipation.
Pls Help.
Best Regards
Chakra and SomnathDear All,
I am trying to do the Multimapping, and have 0....unbounded also. Someways it is not working.
<b>
Smitha please tell me one thing...Assigning the Recordsets per Message to 1, does it mean that it will write multiple XML Files as I want.</b>
Also I am usinf Set to Read only. So once the File is read it becomes RA from A. Then will it write the other Records.
I have to use a BPM because there are certain dependencies that are there for the entire Process Flow. I cannot do without a BPM.
Awaiting a reply. Thanks a lot in anticipation.
Best Regards
Chakra and Somnath -
How do you insert new records into multiple tables using the same unique primary key?
I’ve created a PHP site and MySQL server using a free app called XAMPP. I have successfully created a form in Dreamweaver that will write data to a (name) table in the SQL database. Here’s my question: How do you write to two (or more) tables in the same database and pass the same primary key to both tables? In the SQL database, I defined the first field as ID and set it as the primary key with auto update. So, when you insert a new record, it creates a unique primary key for that record. In my form, I’m capturing info that needs to be stored to two tables at the same time; a Name table and Address table. Since the Name and Address tables use the ID field as the primary key, I believe I will need to pass the ID value from the Name table to the insert of the Address table to insure they both have the same primary key, right?
No. You probably need the primary key from one table to be a foreign key in the other tables. In any case, I believe you can use two methods to obtain the auto generated key. First with SQL:
http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html
And the other using a PHP function:
http://us3.php.net/mysql_insert_id -
Insert multiple records into a table(Oracle 9i) from a single PHP statement
How can I insert multiple records into a table(Oracle 9i) from a single PHP statement?
From what all I've found, the statement below would work if I were using MySQL:
insert into scen
(indx,share,expire,pitch,curve,surface,call)
values
(81202, 28, 171, .27, 0, 0, 'C' ),
(81204, 28, 501, .25, 0, 0, 'C' ),
(81203, 17, 35, .222, 0, 0, 'C' ),
(81202, 28, 171, .27, 2, 0, 'C' ),
(81204, 28, 501, .20, 0, 1, 'C' ),
(81203, 28, 135, .22, 1, 0, 'C' )
The amount of records varies into the multiple-dozens. My aim is to utilize the power of Oracle while avoiding the i/o of dozens of single-record inserts.
Thank you,
WillYou could look at the INSERT ALL statement found in the documentation here:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_913a.htm#2133161
My personal opinion is that you probably won't see any benefit because under the hood I think Oracle will still be doing single row inserts. I could be wrong though.
The only way to confirm was if you did a test of multiple inserts vs an INSERT ALL, that is if the INSERT ALL met your requirements.
HTH. -
Efficient Way of Inserting records into multiple tables
Hello everyone,
Im creating an employee application using struts framework. One of the functions of the application is to create new employees. This will involve using one web form. Upon submitting this form, a record will be inserted into two separate tables. Im using a JavaBean (Not given here) between the JSP page and the Java file (Which is partly given below). Now this Java file does work (i.e. it does insert a record into two seperate tables).
My question is, is there a more efficient way of doing the insert into multiple tables (in terms of performance) rather than the way I've done it as shown below? Please note, I am using database pooling and MySQL db. I thought about Batch processing but was having problems writing the code for it below.
Any help would be appreciated.
Assad
package com.erp.ems.db;
import com.erp.ems.entity.Employee;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.ArrayList;
public class EmployeeDAO {
private Connection con;
public EmployeeDAO(Connection con) {
this.con = con;
// METHOD FOR CREATING (INSERTING) A NEW EMPLOYEE
public void create(Employee employee) throws CreateException {
PreparedStatement psemployee = null;
PreparedStatement psscheduleresource = null;
String sqlemployee = "INSERT INTO employee (FIRSTNAME,SURNAME,GENDER) VALUES (?,?,?)";
String sqlscheduleresource = "INSERT INTO scheduleresource (ITBCRATE,SKILLS) VALUES (?,?)";
try {
if (con.isClosed()) {
throw new IllegalStateException("error.unexpected");
// Insert into employee table
psemployee = con.prepareStatement(sqlemployee);
psemployee.setString(1,employee.getFirstName());
psemployee.setString(2,employee.getSurname());
psemployee.setString(3,employee.getGender());
// Insert into scheduleresource table
psscheduleresource = con.prepareStatement(sqlscheduleresource);
psscheduleresource.setDouble(1,employee.getItbcRate());
psscheduleresource.setString(2,employee.getSkills());
if (psemployee.executeUpdate() != 1 && psscheduleresource.executeUpdate() != 1) {
throw new CreateException("error.create.employee");
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException("error.unexpected");
} finally {
try {
if (psemployee != null && psscheduleresource != null)
psemployee.close();
psscheduleresource.close();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException("error.unexpected");
}Hi ,
U can use
set Auto Commit function here ..
let it be false first
and when u do with u r all queries ..
make it true
this function take boolean values
i e helful when u want record to be inserted in all or not at all..
Hope it helps -
Inserting Multiple Records into two table
I want to insert records from a ADF swing form into two tables. In the first table the primary key is generated by a trigger and then I need to retrieve the primary id generated and then insert multiple records in another table using the primarykey obtained from the first table as foreign key.
How to do this ?User,
If you're using ADF Business components, have a read on the DBSequence data type. If you have two VO's linked by a view link, and the FK is a DBSequence type, all this happens for you out-of-the-box.
Hope this helps,
john -
Insert multiple records into database through internal table
Hi
please help me how to insert multiple records into database through internal tableHi,
Welcome to SCN.
Press F1 on INSERT statement and you will teh syntax as well the docu for the same. -
Insert multiple records into Oracle using Java
Hi,
Has anyone tried to insert multiple records into an Oracle table from Java? I have my data in a Java collection.Can I send a Java Collection to an Oracle Package as a PL/SQL Table Type? My problem is I dont want to instantiate a CallableStatement object everytime I do an insert. Instead I want to do that only once and then insert multiple records in one operation.
Any suggestions will be appreciated,
Thanks,
AlexHi Mensa,
I went thru the code example in your book in chapter 8 (downloaded it from OTN). It looks like the java code for "public class myPLSQLIndexTab" might be a java stored procedure stored in the oracle database?
Pardon my ignorance because I've never worked on java code in the oracle database itself but how would I call such a program outside the oracle database? For example say I have a batch job that downloads data from a webservice and that batch job is written in java and its sitting on a batch server somewhere on the network. But the java program that inserts data into the database is sitting in the oracle database (also somewhere in the same network). How can the java code sitting on the batch server talk to the java code sitting on the oracle server? Is it the same as calling a pl/sql package using CallableStatement?
Thanks
Alex -
Splitting the single record into multiple records based on validity
Hi Guru's,
basically i am an BI consultant with less knowledge on ABAP, can i request your help on the ABAP task.
I am working on HR module which is integrated with SAP BI, the reports will be executed based on calendar month the requirement is i should split the single record into a multiple records based on validity of the record. basically the HR data would be in data from and date to.
below is the logic
Check whether the start and end date of the record are in the same month and year.
If yes nothing changes
If no create multiple records
1st record original start date of the record u2018till end of that month
Following record 1st of the next month u2018till last day of the month
u2026
Last record 1st of the month u2018till original end date.
All fields will have the same values, only the datefrom and dateto fields change.
Can any one please provide me the same code to proceed on my task.
Thanks and Regards,
VenkatHi,
Using Rule group we can split it.
Using Rule Group in SAP-BI Part - 1
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/using%20rule%20group%20in%20sap-bi%20%20part%20-%201.pdf
Thanks
Reddy -
How to concatenate multiple records into one
Hi everybody:
I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
Lan|Author
English|Ernest Hemingway
Spanish|Octavio Paz
Spanish|Mario Vargas Llosa
English|Sinclair Lewis
Spanish|Gabriel García Márquez
And I want to get this:
Author
Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
I have worked with SQL Server and I can do something like this:
CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
RETURNS varchar(5000) AS
BEGIN
declare @retvalue varchar(5000)
set @retvalue=''
select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
return substring(@retvalue,1,len(@retvalue)-1)
END
ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
v_ret VARCHAR2(4000);
v_element VARCHAR2(4000);
v_cursor sys_refcursor;
BEGIN
OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
LOOP
FETCH v_cursor INTO v_elemento;
EXIT WHEN v_cursor%NOTFOUND;
IF v_ret IS NULL THEN
v_ret := v_element;
ELSE
v_ret := v_ret || ', ' || v_element;
END IF;
END LOOP;
RETURN v_ret;
END;
Exist some other way to do this?
Best Regards
JackTks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
I wil read about the other techniques than Hoek mention
Best Regards.
Jack -
Import multiple records into a PDF document?
I'm not sure I'm using the correct terms, but let me spell out my problem.
I have a PDF document with several text forms named with the same names as columns in an Excel spreadsheet saved into txt format.
The forms are duplicated onto several pages so if there are five records in the spreadsheet, there are five pages in the PDF.
I am able to open the PDF and choose Import Form Data and point to the Excel txt file.
But in the Import Data from Delimited Text File dialog box, I am only able to choose one record at a time.
I was hoping to be able to import multiple records onto multiple pages. This way I could do a bulk printing of the spreadsheet data into the PDF. But doing one record at a time is cumbersome and won't work as we expand the project.
Any clues as to how to do this better?John,
I don't have the actual client's data as that is proprietary.
I do have two silly little test files that I put together, but I think you've answered my question.
I've already told the client to use Word (gasp) and Excel with a mail merge and then export to PDF or print directly.
Ironically this could have also been done with InDesign.
But as much as I had to recommend Word, it was nice that the client started out by wanting PDF. -
Concatenate multiple records into one single record
Hello everyone,
Can anyone guide me how to merge multiple records into one single record
like......... I am getting the data in the file like
aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
ffffff/gggg/hhhhhhhhhhhhhh
/123/4567/55555/99999999/kaoabfa/eee
fffff/kkkkkkkk/llllllllllllllllllllllll
when i use gui_upload I am getting the data into the internal table in the above format.
My main intension is to split the record at / to multiple lines and dowload it into another file.
What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.Yes, it should work.
In my example
Loop at itab.
concatenate i_text itab into i_text.
endloop.
You change that loop for the loop of your internal table with the file records
So if you have this three records
'aaaa/bbb/ccc'
'/dddd/efg'
'hijk/lmn'
i_text will look like this at the end
'aaaa/bbb/ccc/dddd/efghijk/lmn'
then in this part of the code
split i_text at '/' into table itab2.
itab2 will have the records looking like this
aaaa
bbb
ccc
dddd
efghijk
lmn' -
Transformation Routine to convert single record into multiple
All,
I need your help with ABAP Syntax. My requirement is to take a single record and convert it to multiple records into a DSO with a condition to not create a record if a KF value is 0.
R/3 Data Record:
Employee | Date | Char1 | KF1 | Char2 | KF2 | Char3 | KF3 | Char4 | KF4
Conversion Result into DSO:
Employee | Date | Char1 | KF1
Employee | Date | Char2 | KF2
Employee | Date | Char3 | KF3
Employee | Date | Char4 | KF4 (This record will not be written if no value is in KF4)
I have read about the result table in update rules, however within BI 7.0 Transformations I am unfamiliar as to where the RESULT_TABLE function applies. Has this been replaced by the Expert Routine?
Could any ABAP expert provide sample code as to how I would perform this conversion in a Transformation Routine?
Thanks,
DavidThanks Alex for your response.
I did find a solution to this as it turns out to be fairly simple, however I executed the routine as an Expert Routine instead of a Start Routine. I was advised to do the transformation here.
The basic concept is defined below:
Loop at source_package assigning -kf2.
Append result_fields to result_package.
Endif.
-- Kf3u2026 and so on
Endloop.
Basically the APPEND statement is used to create the additional records. -
Split a record into multiple records
Hi,
I have situation where i need to split a record into multiple records.
InputData :
value|BeginDate |EndDate
15 |2002/10/15|2002/10/16
13 |2002/10/13|2002/10/20
19 |2002/10/19|2002/10/23
10 |2002/10/10|2002/10/12
OutPut :
10 |2002/10/10|2002/10/12
13 |2002/10/13|2002/10/15
15 |2002/10/15|2002/10/16
13 |2002/10/16|2002/10/19
19 |2002/10/19|2002/10/23
ThanksHi ,
As a far I understood from your example ,
I have few questions...
1. You have information about the patient in a 1 source table.
2. how u are identifying for patient X u need 5 rows to be created. R u storing these informations in seprate table or how ...
3. if you have these information in a seperate tables ..... a simple cross join in ODI should get you the expected result.....
Or give some more information with a example ..that would be great ...
Thanks -
Saving multiple records into text file
Can I save multiple records into a text file at one go?
My application has a list of data displayed there and when the user clicks on the save button it will save all the records on the screen.
It works but it only saves the last record.
Here are my codes
// this is to display the list of data
private JLabel[] subjects=new JLabel[20];
private JLabel[] subTotal=new JLabel[20];
private JLabel[] codes=new JLabel[20];
private JLabel[] getTotal=new JLabel[20];
String moduleCodes;
String getPrice;
double price;
int noOfNotes;
public testapp(Subjects[] subList)
int j=0;
double CalTotal=0;
for (int i=0; i<subList.length; i++)
subjects[i] = new JLabel();
subTotal[i] = new JLabel();
codes=new JLabel();
getTotal[i]=new JLabel();
if (subList[i].isSelected)
System.out.println(i+"is selected");
subjects[i].setText(subList[i].title);
subjects[i].setBounds(30, 140 + (j*30), 400, 40);
subTotal[i].setText("$"+subList[i].price);
subTotal[i].setBounds(430,140+(j*30),100,40);
codes[i].setText(subList[i].code);
getTotal[i].setText(subList[i].price+"");
CalTotal+=subList[i].price;
contain.add(subjects[i]);
contain.add(subTotal[i]);
j++;
moduleCodes=codes[i].getText();
getPrice=getTotal[i].getText();
noOfNotes=1;
// this is where the records are saved
public void readRecords(String moduleCodes,String getPrice,int notes)throws IOException
price=Double.parseDouble(getPrice);
String outputFile = "testing.txt";
FileOutputStream out = new FileOutputStream(outputFile, true);
PrintStream fileOutput = new PrintStream(out);
SalesData[] sales=new SalesData[7];
for(int i=0;i<sales.length ;i++)
sales[i]=new SalesData(moduleCodes,price,notes);
fileOutput.println(sales[i].getRecord());
out.close();I suggest writing a method that takes a SalesData[]
parameter and a filename. Example:
public void writeRecords(SalesData[] data,
String filename) throws IOException
BufferedWriter out = new BufferedWriter(new
FileWriter(filename, true));
for (int i = 0; i < data.length; i++)
out.write(data.getRecord());
out.newLine();
out.close();
And it's good to get in the habit of doing things like closing resources in finally blocks.
Maybe you are looking for
-
Live mail has a habit of junking mail that I wanted to receive, and over Christmas a whole batch of mail has not come through. I try and check the junk mail section - but it takes time to log in and check, which I don't always have. I usually read
-
Hi...I have made an application that has a JTable with listeners on. When you press a cell the information in the cell appears in the Jlist. When you first run the program you see the JTable and the empty JList. We have set a preferredSize on the JLi
-
Transfer Timecode to Output File
I'm using a Settings file (detailed below) to transcode a 10-bit Quicktime file to Streaming H.264 My 10-bit file has DF timecode on it but the resulting H.264 file does not. Is there any way to tell Compressor to carry the timecode over? Name: MP4_8
-
hi Anyone I can say if Oracle 9iAS have a web interface in Java (i.e. J2EE) to the oracle workflow? Oracle 9iDB have an web interface in PL/SQL, Is there one to Oracle 9iAS? thanks Diego
-
TS3276 my emails are duplicated
my emails are duplicated. Something to do with Rules?