cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data from webdynpro table to RFC

Former Member
0 Kudos

Dear All,

I need to pass the the data from the input table of the webdynpro to IMPORT parameter of the RFC. Means i have an UI element(table) and if user enters entry,i have to pass them to my rfc so it can be taken to R/3. Can any body seuggest/send me the code??

Regards,

Anup.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Anup,

There is a very similar thread at

Pasting the same reply here :

Assume that BAPI uses a table ‘MyTable’ of some type 'ZTAB' .

<BAPI_name>_Input input = new <BAPI_name>_Input () // create an instance of the Input class;

ZTAB table = new ZTAB();

//if you do not know table type of 'MyTable’ , check the function 'input.add<MyTable> (<table type>)'

table.set<property1>(<your-value>);

.

.

table.set<propertyN>(<your-value>););

input.add<MyTable>(table);

wdcontext.node<BAPI_name>_Input().bind(input);

Now execute the BAPI using the following line

wdContext.current<BAPI_Name>_InputElement().modelObject().execute();

wdContext.nodeOutput.invalidate()

// clears the old value in the output node

So if you are reading the value from a value node you can change your code like :

Assume that BAPI uses a table ‘MyTable’ of some type 'ZTAB' .

<BAPI_name>_Input input = new <BAPI_name>_Input () // create an instance of the Input class;

ZTAB table;

IPrivate<view>.I<table_node>Element elmt;

//if you do not know table type of 'MyTable’ , check the function input.add<MyTable> (<table type>)

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

{

table = new ZTAB();

elmt = wdContext.node<table_node>().get<table_node>ElementAt(i);

table.set<property1>(elmt.get<corresponding property1>);

.

.

table.set<propertyN>(elmt.get<corresponding propertyN););

input.add<MyTable>(table);

}

wdcontext.node<BAPI_name>_Input().bind(input);

Now execute the BAPI using the following line

wdContext.current<BAPI_Name>_InputElement().modelObject().execute();

wdContext.nodeOutput.invalidate()

// clears the old value in the output node

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Thanks Nibu,

This solution seems to work..

Is there any separate way to close the thread i gues rewarding points is the way to close. isn't it?.

REgds,

Anup.

Former Member
0 Kudos

Someone stole this post ! If found, please do return

Former Member
0 Kudos

Dear Nibu,

I didn'n mean that i'm particular about not giving points..i always give points even if people reply..

I was just asking if there is another way to close..thread.

Cheers,

Anup.

Former Member
0 Kudos

Hi Anup,

Sorry if I have been rude in my earlier posting. I was just pointing out the need to close the threads & award appropriate points.

I'm deleting my previous post and I am extremely sorry if I have hurt you. I didn't mean to do that

Do keep posting and let us all learn better !

Best regards,

Nibu.

Former Member
0 Kudos

hi anup,

to do that u need to do the following..

1. import the BAPI

2. get into the code of action handler

3. create the input node say..

Z_XXXX_Input xyz=new Z_XXX_Input();

4. this is the node which we would get once u import the BAPI.

5. now add the values which u need to execute the BAPI. ex. xyz.setVBLEN("XCXC");

xyz.addKunnrTable(kunnrtable);

6. now call the following code

wdcontext.nodeZ_XXX_Input().bind(xyz);

wdcontext.currentZ_XXX_InputeElement().modelobject.execute();

7. so for the table data you need to put line 5.

8. say i have a table of employee UI Table with coloumns name, empid

9.

Zsv_EmpTable emptable=new Zsv_EmplTable();

for (int i=0;i<wdContext.nodeEmployees().size;i++) {

emptable.setEmpName(wdcontext.nodEmployees().getEmpoyeesAt(i).getName();

emptable.setEmpId(wdcontext.nodEmployees().getEmpoyeesAt(i).getId();

}

now add the input parameter like table/values to the input node of BAPI.

Call the Bind();

call the execute();

Thanks & Regards,

Raghavendra Pothula