cancel
Showing results for 
Search instead for 
Did you mean: 

bapi for select and update not work

Former Member
0 Kudos

Hi experts!

I've a little problem with one bapi. I will tray explain the issue:

I've one bapi with one input variable and with one table.

If this input is "S" the bapi returns on table the result of one query.

If the input is "U" the bapi update the abap table.

From webdynpro I've associate the table to my context. And all calls to bapi using "S" work's fine. I can see the table results.

This table results contain InputFields to change the values, and I call again the bapi using "U" method.

But no update doesn't work.

any ideas?

david

Accepted Solutions (0)

Answers (5)

Answers (5)

monalisa_biswal
Contributor
0 Kudos

check whether table parameter is properly passed to the BAPI.

Collection <var>=wdContext.current<Model Node>Element().modelObject().get<table Parameter>();

Iterator it= <var>.iterator();

while(it.hasNext())

{

<table Parameter's model class> line= (Bapimatram)it.next();

wdComponentAPI.getMessageManager().reportSuccess(line.get<fieldname>());

}

Former Member
0 Kudos

hi,

Check whether you BAPI has COMMIT WORK. Since when you pass S it is fetching the data. When you Pass U it is not updating the data in the backend. To update the data in the backend the BAPI should be using COMMIT WORK, other wise you have to commit the work explicilty by calling another BAPI i,e

BAPI_TRANSACTION_COMMIT.

Btn you can loop at the BAPIRETURN table and print it to find out what is the error what you are getting when you Pass U.

u can do that by this code

int size = wdContext.node<bapireturn>.size();

for(int i =0;i<size;i++)

{

wdComponentAPI.getMessageManager.reportSucess(wdContext.node<bapireturn>.get<bapireturn>elementat(i).getType();

}

//Print the type and message field data and check.

Regards,

Gopi

Former Member
0 Kudos

Ok.

How can I do it?

thanks,

david

Former Member
0 Kudos

Hi David,

To print the values you should use the code some thing like this:

If you have action on Update button then:

onAction(...){

for(int i=0; i<wdContext.node<nodeName>.size().i++{

//Printing the elements:

<b>wdComponentAPI.getMessageManager.ReportSuccess(

wdContext.node<nodeName>.getElementAt(i).get<attributeName()>);

</b>

In the same way try printing all the elements

//Passing the elements:

Pass the values from output node to input node in order to pass the whole table values.

wdContext.CurrentNodeElement.set<Update>("U");

wdContext.node<nodeName>.Current<NodeElement>.set<AttributeName>(

wdContext.node<nodeName>.getElementAt(i).get<attributeName()>);

}

}

If it not clear then post your Node structure.

Regards,

Jhansi

Former Member
0 Kudos

Hi,

I use the binding method.

I think that the problem is, if I change any value on the inputfield this value is not refreshed into the context values that execute the bapi.

thanks

david

Former Member
0 Kudos

Hi David,

Check weather you are passing the values changed(table) to the input structure.And also try printing the values that you are passsing. Is the table bounded to Model node or Value node???

Regards,

Jhansi

Former Member
0 Kudos

Hi,

Does your BAPI functionality has been implemented such that?

if yes

Before executing ur function module

U can seperate the input value like this.

if(inputfield.equals("S"))

inuput.set<BAPIInputFiled>("S");

else

inuput.set<BAPIInputFiled>("U");

Next execute the BAPI();

Are you using the one variable for the both functinalitis or two variables.

If Two, then binding such that other wise bind only one.

Thanks,

Lohi.