cancel
Showing results for 
Search instead for 
Did you mean: 

Problems to get the content of context to R/3

Former Member
0 Kudos

Hello,

i have problems with connection between the context in web dynpro and r/3. I use a rfc function, which i wrote on my own (no standard) in order to get persons from web dynpro to r/3. In web dynpro I created a multi selection table where the user can choose a list of persons. the selection works in web dynpro. for example: when i choose two persons then i can see those two persons in my context (model node) but not in the table of the rfc function in r/3. that's my problem. here some coding of my view implementation.

		
for (int i = 0; i < wdContext.nodeBearbeiter().size(); i++) {
  if (wdContext.nodeBearbeiter().isMultiSelected(i)) {
    String str = wdContext
                 .nodeBearbeiter()
                 .getElementAt(i) 
                 .getAttributeValue("Bname")
                 .toString();
				
    Usr03 bearb = new Usr03();
				
    IWDNodeElement fb_bearb = 
                     wdContext
                     .nodeZ_Fh0002_Datenverwaltung()
                     .nodeImt_Bearbeiter()
                     .createImt_BearbeiterElement(bearb);

     fb_bearb.setAttributeValue("Bname", str);
				
     wdContext.nodeZ_Fh0002_Datenverwaltung()
              .nodeImt_Bearbeiter()
              .addElement(fb_bearb);
  }
}

the node z_fh0002_datenverwaltung is mapped to the controller context. the mapping between view and controller works. in the example: I can also see those two selected persons in the context node of the controller context just before calling the r/3 function. but the table imt_bearbeiter() is always empty in r/3.

can anybody help me please?

best regards

petra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

I think if every thing is correct

u need to write this piece of code.

u have written

wdContext.nodeBearbeiter().getElementAt(i).getAttributeValue("Bname").toString();

whereas i feel u shuld write like this

wdContext.nodeBearbeiter().getBearbeiterElementAt(i).getAttributeValue("Bname").toString();

Just Check This

Former Member
0 Kudos

hello,

thanks for your answer but it doesn't help. I already have the same problem.

regards

petra

Former Member
0 Kudos

Can you post the code that calls the R/3 function module?

Apart from that, you could use the typed context API for accessing the attribute value.

Armin

Former Member
0 Kudos

Hello Armin,

here my coding for calling the r/3 function:

<u>view controller</u>

wdThis.wdGetAccountCreateController().callZ_Fh0002_Datenverwaltung();

<u>component controller</u>

wdContext.currentZ_Fh0002_Datenverwaltung_InputElement()
         .modelObject()
         .execute();

wdContext.nodeZ_Fh0002_Datenverwaltung_Input()
	 .nodeOutput()
	 .invalidate();

What do you mean with the typed context API?

Petra

Former Member
0 Kudos

Your code seems correct.

Where do you set the values to be inserted into the RFC in the view or in the component controller?

I would like to know how you have mapped the nodes also.

Former Member
0 Kudos

Hi,

the values I set in context of the view and this is mapped to the component controller context. I report some messages (IWDMessageManager) to check my coding in the component controller just before calling my rfc function and I detected that the correct values also in the context of the component controller. but if i debugg to r/3 there are the tables empty.

Petra

Former Member
0 Kudos

Z<RFC>_input inp=new Z<RFC>_input();

wdContext.node<nodename>().bind(inp);

for(){

<Table> tab=new <Table>

tab.set<value>();

inp.add<table>(tab);

}

This is how we set the tables in to RFC.

Try changing your code.

Rest everything seems perfect

Former Member
0 Kudos

Hello,

that I did one view before. When I did it again do I not initialize my context?

Regards

Petra

Former Member
0 Kudos

You need not re initialize.

Instead of

Z<RFC>_input inp=new Z<RFC>_input();

you can give the following

Z<RFC>_input inp=wdContext.currentZ<RFC>_inputelement.modelObject();

now set the table as I said above. I think it is the problem with the way you set the table.

Former Member
0 Kudos

Would you mind providing the ABAP code where you enter the values from the table into the database table?

Answers (1)

Answers (1)

Former Member
0 Kudos

try the following

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

if (wdContext.nodeBearbeiter().isMultiSelected(i)) {

String str = wdContext

.nodeBearbeiter()

.getElementAt(i)

.getAttributeValue("Bname")

.toString();

Usr03 bearb = new Usr03();

wdContext.nodeImt_Bearbeiter().addElement(bearb);

bearb.setAttributeValue("Bname", str);

}

}