cancel
Showing results for 
Search instead for 
Did you mean: 

insert problem

Former Member
0 Kudos

hi guys,

i want to insert the data into sap r/3 table..via jco using bapi

here is the program...., but data is not found in the sap table...

any wrong in my program ?...

they given some data to insert into sap table

import parameters,table rows.... i shown in the below program.(exact information i set )

IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZHR_INFOTYPE_OPERATION");

if(ftemplate != null) {

// Create a function from the template

JCO.Function function = ftemplate.getFunction();

JCO.ParameterList paralist=function.getImportParameterList();

paralist.setValue("11","PERNR");

paralist.setValue("INS","ACTIO");

paralist.setValue("A","TCLAS");

paralist.setValue("20071213","BEGDA");

paralist.setValue("20071213","ENDDA");

paralist.setValue("1","OBJPS");

paralist.setValue("LTA","SUBTY");

client.execute(function); //executing the function.

JCO.Table sales_orders = function.getTableParameterList().getTable("PROPOSED_VALUES");

sales_orders.appendRows(3);

System.out.println("after function"+sales_orders.getNumRows());

for(int i=0;i<sales_orders.getNumRows();i++)

{

sales_orders.setValue("0582","INFTY");

sales_orders.setValue("P0582-AMTEX","FNAME");

sales_orders.setValue("200.00","FVAL");

sales_orders.nextRow();

sales_orders.setValue("0582","INFTY");

sales_orders.setValue("P0582-JBGDT","FNAME");

sales_orders.setValue("20071213","FVAL");

sales_orders.nextRow();

sales_orders.setValue("0582","INFTY");

sales_orders.setValue("P0582-JENDT","FNAME");

sales_orders.setValue("20071213","FVAL");

}

JCO.Table sales_orders1 = function.getTableParameterList().getTable("MODIFIED_KEYS");

sales_orders1.setRow(1);

sales_orders1.appendRow();

sales_orders1.setValue("11","PERNR");

sales_orders1.setValue("0582","INFTY");

sales_orders1.setValue("LTA","SUBTY");

sales_orders1.setValue("1","OBJPS");

sales_orders1.setValue("20071213","BEGDA");

sales_orders1.setValue("20071213","ENDDA");

System.out.println("modified"+sales_orders1.getNumRows());

System.out.println("modified"+sales_orders.getNumRows());

OUTPUT: in my console it showing it appended...

but that record is not present in the sap r/3 table

when abapers are checking that record...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi tony,

In the function module you are calling, is there a commit work statement? (This commits the work to the database table.) Check with whoever wrote the function module and get them to show you it working in SE37 with some test data. If it doesn't work there it will never work for you via JCo.

Gareth.

Former Member
0 Kudos

hi,

yes, they tested it is working there...

there it is adding the record , it is added....

any information should i get from abapers.?..............

thanks

Former Member
0 Kudos

hi,

this is a custom functiion module which is a rfc

here record is not inserting in the sap r/3 table

what is the problem?

i got the ouput like this......

MODIFIED_KEYS

PROPOSED_VALUES

IMPORT ACTIO

IMPORT BEGDA

IMPORT DIALOG_MODE

IMPORT ENDDA

IMPORT LUW_MODE

IMPORT MASSN

IMPORT NO_ENQUEUE

IMPORT NO_EXISTENCE_CHECK

IMPORT OBJPS

IMPORT PERNR

IMPORT PERSG

IMPORT PERSK

IMPORT PLANS

IMPORT SEQNR

IMPORT SPRPS

IMPORT SUBTY

IMPORT TCLAS

IMPORT WERKS

EXPORT HR_RETURN

EXPORT RETURN

EXPORT RETURN1

NO OF ROWS ARE:---3

THE COLUMNS IN THE TABLE ARE:--4

-


INFTY: 0582

FNAME: P0582-AMTEX

FVAL: 200.00

SEQNR: 00

-


INFTY: 0582

FNAME: P0582-JBGDT

FVAL: 20061215

SEQNR: 00

-


INFTY: 0582

FNAME: P0582-JENDT

FVAL: 20061215

SEQNR: 00

-


PERNR: 00000011

INFTY: 0582

SUBTY: LTA

OBJPS: 1

SPRPS:

ENDDA: 2006-12-15

BEGDA: 2006-12-15

SEQNR: 000

Former Member
0 Kudos

Yes, as I said, ask them if there is a commit statement in the code.

Former Member
0 Kudos

hi,

yes, there it is commited,,,,,,

in my program any thing i have to make a commit...........

thanks

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

tony

can u tell me the tables and export parameters and structures of ur bapi.

regards

guru