cancel
Showing results for 
Search instead for 
Did you mean: 

Adding data to RFC table...

Former Member
0 Kudos

Hi,

I am trying to add data to table in RFC. For testing purpose i have hardcoded the value..

I am callin one RFC...it simply has only one node(table) to accept value.. and thus similarly one node for output..

I have put following code in init() method of view....

Ztest2 is my RFC name amd Ztest_table is table in R/3...

{

//@@begin wdDoInit()

Ztest2_Input input = new Ztest2_Input();

Ztest_Table tab;

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

{

tab = new Ztest_Table();

tab.setTestname("a");

tab.setTestnumber(i+5);

input.addMytab(tab);

}

wdContext.nodeZtest2_Input().bind(input);

try

{

wdContext.currentZtest2_InputElement().modelObject().execute();

}

catch(Exception e)

{

}

wdContext.nodeOutput().invalidate();

//wdThis.wdGetSampleCompController().execute();

//@@end

}

Now in the layout i have included two table , where one is binded to input node myTab and other table to output node..

But on execution..the layout table display value..but the table which is binded to output node..does not shows value..

Thus due to which even table in RFC is not getting updated...

What am i doing wrong in above code..

can any one plzz help me on this..

Regard,

jigar OZa

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Jigar,

I guess the problem is with this statement

input.addMytab(tab);

Try changing like this

Ztest2_Input input = new Ztest2_Input();
Ztest_Table tab;
for(int i=0; i<5;i++)
{
tab = new Ztest_Table();
tab.setTestname("a");
tab.setTestnumber(i+5);
wdContext.currentZtest2_InputElement().modelObject()..addMytab(tab);
}
wdContext.nodeZtest2_Input().bind(input);
try
{
wdContext.currentZtest2_InputElement().modelObject().execute();
}
catch(Exception e)
{

}
wdContext.nodeOutput().invalidate();

Regards,

Siva

Former Member
0 Kudos

Hi,

You should remove the line

wdContext.nodeOutput().invalidate();

as it will empty the output node.

Only use invalidate for getting data if there is a supply function behind a node.

J

Former Member
0 Kudos

Hi,

I tried above all solution..but still it did nt help...

I am not getting value in Output node...i am able to fill input node with data..bt not able to fill output node..

I refered more thread and changed my code to following..

IPrivateSampleView.ITableDataNode node = wdContext.nodeTableData();

IPrivateSampleView.ITableDataElement ele;

Ztest2_Input input = new Ztest2_Input();

wdContext.nodeZtest2_Input().bind(input);

Ztest_Table inputTable;

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

{

inputTable = new Ztest_Table();

ele = node.getTableDataElementAt(i);

inputTable.setTestname(ele.getTESTNAME());

inputTable.setTestnumber(ele.getTESTNUMBER());

input.addMytab(inputTable);

}

try

{

wdContext.currentZtest2_InputElement().modelObject().execute();

}

catch(Exception e)

{

}

wdContext.nodeOutput().invalidate();

Answers (3)

Answers (3)

Former Member
0 Kudos

Plz see the below thread for help

Former Member
0 Kudos

Hi Sameer, thanks for the link but i had already refered thatlink.. in fact i have not left any link on this forum for this issue..

But anyways i have solved this issue.. actually it was very silly mistake made in RFC.. we have used two RFC and it was in 1 test named functiongroup..

what we had made mistake is..we had declared tables : <table name> both the RFC due to which it was able to get value..

Thanks for your help..

Regards,

Jigar Oza

Former Member
0 Kudos

Hi

try this

AbstractList lst = new Ztest_table.Ztest_table_list();

Ztest_table tab = new Ztest_table();

tab.setName("abdc";

tab.setNumber(123);

lst.add(tab);

wdcontext.currentRFCName.modelobject.setTEST_TABLE(lst);

in the next step EXECUTE THE RFC .

try this it , hope this can help you .

murali

Former Member
0 Kudos

hi

Try to check whether the values your are passing to the table are set ,

put external breakpoint in the RFC , then call the RFC , first check whether your RFC is getting called , if your RFC is not getting called , its seams the user your have logges in through SAPLOGON

and the user ,pwd details you have provided for creating JCO is no same , if they are same

then your RFC gets called(set the break point in the RFC and call the RFC) .

then check table node whether the values you are passing the values are getting set , also check

ouput if it providing the output ,

check this issues , your problem gets solved easily , there is no problem in the code as i guess .

murali