cancel
Showing results for 
Search instead for 
Did you mean: 

Problems inserting data with Table as input Parameter using Web Dynpro java

Former Member
0 Kudos

Hello, I am new to Web Dynpro. I am trying to insert data with table as Input parameter to BAPI. I am not getting any error, but I dont see any data inserted in the table. Can some one please help me in the code what I am doing wrong.

I really appreciate any help.

IWDMessageManager manager = wdComponentAPI.getMessageManager();

//wdComponentAPI.getMessageManager().reportWarning("Inside Save");

Z_Opts_Masterdata_Details_Input input = new Z_Opts_Masterdata_Details_Input();

wdContext.nodeZ_Opts_Masterdata_Details_Input().bind(input);

// Set Action type flag

input.setFlag("I");

// __Bic__Aot_Op00100 is the table class (Custome table)

__Bic__Aot_Op00100 tableInput = new __Bic__Aot_Op00100();

tableInput.set__Bic__Zcotsno("BA2007051");

tableInput.setCustomer("1000");

tableInput.set__Bic__Zunit("1000");

tableInput.set__Bic__Zkdkgr("CA");

tableInput.set__Bic__Ztitle("New Plants - BA - 2007");

tableInput.setCo_Area("NA01");

input.addDetails(tableInput);

//wdContext.currentZ_Opts_Masterdata_Details_InputElement().modelObject().execute();

try

{

wdContext.currentZ_Opts_Masterdata_Details_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

wdThis.executeBAPICommit();

manager.reportSuccess("Committed");

}

catch(Exception e)

{

e.printStackTrace();

}

public void executeBAPICommit( )

{

//@@begin executeBAPICommit()

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {

// Calls remote function module BAPI_Transaction_Commit

wdContext

.currentBapi_Transaction_Commit_InputElement()

.modelObject()

.execute();

} catch (WDDynamicRFCExecuteException ce) {

manager.reportException(ce.getMessage(), false);

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks all for your input.

Murtuza, I tried the code that you included in bold. Its still not working.

Is there a way to debug in BAPI when you execute the Save button in Web Dynpro screen. I can debug if I test it from SE37.

I am going to try with some other table. This is a custom BAPI, I want to make sure that there is nothing wrong with the BAPI code.

Thanks

Raghu

Former Member
0 Kudos

Hi Raghunath,

Is your FM working fine while you try to execute it from R/3 itself and try giving same parameters from WD. Your code seems to be fine I assume something wrong with your FM itself.

Regards,

Murtuza

Former Member
0 Kudos

Thanks for your fast reply. I am testing the function module now. It is in transparent table in BI ODS. I will test the FM.

Thanks

Raghu

Message was edited by:

Ravi

Former Member
0 Kudos

I have sent you a test mail from my id.

Regards,

Murtuza

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi

Go to the following thread.

Regards

Suresh

Former Member
0 Kudos

Hi Raghunath,

make sure that ur Z_Opts_Masterdata_Details_Input bapi & transaction commit bapi are part of same model.

regards

Sumit

former_member720137
Active Participant
0 Kudos

Hi Raghunath

Make sure both the BAPI (Z_Opts_Masterdata_Details_Input bapi & transaction commit bapi) are imported inside same Model, Then only Committing of data will take place. I hope this will solve ur problem..

Thanks

Puneet

Former Member
0 Kudos

in bapi ,code is working fine?its write ........

same problem i was faceing

u had entered only single record in table

in bapi u r directly trying to accece table element without using"loopat itab" and workarea......

so first take row in workarea AND and using loop and then execute........

it has to work......

even i had given 3 days for this problem

Former Member
0 Kudos

Hi Raghunath,

Try adding the lines in bold in your code.

public void executeBAPICommit( )

{

//@@begin executeBAPICommit()

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {

// Calls remote function module BAPI_Transaction_Commit

<b>Bapi_Transaction_Commit_Input trans = new Bapi_Transaction_Commit_Input();

wdContext.nodeBapi_Transaction_Commit_Input().bind(trans);</b>

wdContext

.currentBapi_Transaction_Commit_InputElement()

.modelObject()

.execute();

} catch (WDDynamicRFCExecuteException ce) {

manager.reportException(ce.getMessage(), false);

}

Regards,

Murtuza

Former Member
0 Kudos

Thanks Murtuza. I will try that. Hopefully that works

Former Member
0 Kudos

Hi Raghunath,

Rest of your code is proper. So, if this things is not working then just try to execute your BAPI directly in R/3 using transaction using transaction SE37.

Regards,

Murtuza

Former Member
0 Kudos

Hi Raghu

use a breakpoint near Commit's Execute statement and check what is happening

Regards

Chaitanya.A