cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in inserting a row in to R3 table using JCO in webdynpro

Former Member
0 Kudos

Hi all,

I want to insert a new record in to the r3 table.

I used JCO for fetching and retrieving.

The problem is when i insert the data in to parameters it accepts the values, but when i try to insert it in to table it shows the following error:

"try to access a table which does not have any rows yet".

But the table alredy contains 4 records.

Through the following way only i tried to contact FM.

Is there any fault in this let me know Please.

bapiDocument = repository.getFunctionTemplate("functon module name").getFunction();

table = bapiDocument.getTableParameterList().getTable("table name");

table.setValue(wdContext.currentContextElement().get<contextvariable>,"table field name");

It's very urgent,Plz if you know let me know.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

use table.appendRows(int n) instead.This will allow you to append multiple rows(n) to the table by improving performance.As such there are no settings to be done.

Check this out.

Regards,

Ajay

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Use table.appendRow() before setting the values for table fields.

e.g.your code should be like this.

bapiDocument = repository.getFunctionTemplate("functon module name").getFunction();

table = bapiDocument.getTableParameterList().getTable("table name");

table.appendRow();

table.setValue(wdContext.currentContextElement().get<contextvariable>,"table field name");

Regards,

Ajay

Former Member
0 Kudos

Hi,

Thanks to you all for your quick reply.

Ajay as per your suggestion,i inserted table.appendrow(),i am able to insert 2 rows. after 2nd row i am not able to insert rows in to the table after that.

Is there some settings need for this.

If you know Plz tell me.

Thanks.

Former Member
0 Kudos

HI,

set all the required values for the tabel parameters and excute the RFC.

check wether the row is updated in SAP R/3.

Former Member
0 Kudos

Hi Krishnaveni,

I think you are doing the wrong way, that is using the incorrect BAPI to create the record.

I am not sure about you are using the Correct BAPI for creating the record in R/3. Please Check the functional model.

Kind Regords,

Mukesh