cancel
Showing results for 
Search instead for 
Did you mean: 

Insertion of more than one record into database table

Former Member
0 Kudos

Hi friends,

I am doing an IDoc to JDBC scenario.can you please tell me how I can insert more than one record using a single connection.

regards

Debansu

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks to all,problem has been resolved.

dieter_glau
Explorer
0 Kudos

Here is the Typ-Definition of InsertStmt for insert into tab1 (col1, col2)



InsertStmt     comlex type
   InsertStatment   Element occurs 1
      tab1               Element occurs 1
         action          Attribute occurs 1 default "INSERT"
         table           Element occurs 1
         access       Element  occurs 1 .. unbound
            col1         Element occurs 1
            col2         Element occurs 1
   InsertStatement_response Elemment occurs 0..1
       insert_count   Element occurs 1

the InsertStatement_response part will be filled when JDBC returns.

Edited by: Dieter Glauß on Aug 12, 2008 2:45 PM

Former Member
0 Kudos

Hi Dieter,

Thanks for the help.The problem has been solved.Just wanted to point out two things:

Action is an attribute which can take two values i.e optional or required

During mapping of Access with corresponding segment of IDoc,we have to do a remove context.

regards

Debansu

Edited by: Debansu Sarkar on Aug 12, 2008 8:19 PM

Former Member
0 Kudos

Hi,

Please tell me how to do the mapping.I have made the occurence of 'statementname' as 1..unbounded.Still it is not working.

Former Member
0 Kudos

Test in ur Message Mapping,.

your InsertStatements created as many times as number of items to be inserted...

Former Member
0 Kudos

sarkar then use the following format :

<StatementName1>

<dbTableName action=u201DINSERTu201D>

<table>realDbTableName</table>

<access>

<col1>val1</col1>

<col2>val2</col2>

</access>

<access>

<col1>val11</col1>

</access>

</dbTableName>

</StatementName1>

<StatementName2>

<dbTableName action=u201DINSERTu201D>

<table>realDbTableName</table>

<access>

<col1>val1</col1>

<col2>val2</col2>

</access>

<access>

<col1>val11</col1>

</access>

</dbTableName>

</StatementName2>

prateek
Active Contributor
0 Kudos

U can use multiple statement nodes as mentioned here

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm

Regards,

Prateek

dieter_glau
Explorer
0 Kudos

sample

insert into tab1 (col1, col2) values ('val1-1','val1-2')

insert into tab1 (col1, col2) values ('val2-1','val2-2')

insert into tab1 (col1, col2) values ('val3-1','val3-2')


<ns0:InsertStmt xmlns:ns0="http://xyz.com/insert">
  <InsertStatement>
   <TAB1 action="INSERT">
    <table>tab1</table> 
    <access>
     <col1>val1-1</col1> 
     <col2>val1-2</col2> 
    </access>
    <access>
      <col1>val2-1</col1> 
      <col2>val2-2</col2> 
    </access>
    <access>
     <col1>val3-1</col1> 
     <col2>val3-2</col2> 
    </access>
   </TAB1>
  </InsertStatement>
  </ns0:InsertStmt>

Regards Dieter