cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting data to R3 from RFC "SAVE Functionality"

Former Member
0 Kudos

Hello Experts,

I am facing a problem while trying to insert data to R3.

I have 2 DC's <b>rmmodel</b> and <b>rmcomponents</b>

I have created Model in the rmmodel DC through aRFC and added it in the public part. further I added the rmmodel DC in rmcomponent DC's used DC list. Finally i added rmmodel in the used models list of rmcomponent DC.

Then i created a custom controller in rmcomponent DC. I have already done model binding and context binding.

Now i want to enter data from a FORM in a View to R3 on pressing <b>SAVE</b> button.

Core Team has provided me an aRFC wich is similar to the following structure.

XYZ__XYZ__XYZ__Input

[+] xy_xyz(Bapixyz2)

[+] xy_Act_Data(XYZ_abc_Act_data)

[+] Output

here in this case xy_Act_Data(XYZ_abc_Act_data) is binded to the custom controller and further to the view. I have created the FORM through <b>apply template</b> and created an action "<b>onActionSave</b>" and calling the <b>callRFC()</b> from the custom controller.

When i do the above i get the output but the FORM is Inactive so i can't fill the entries and further SAVE button won't be of any use.

please help.

Regards,

Amol

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi amol,

check out this thread.

Regards,

Gopi

Former Member
0 Kudos

Hi Gopi i am following your thread, and it seems to be helpful as i want to do similar kind of stuff.

But can you tell me how you did the context binding ?

As in my case i simply did the model binding and further context binding for the Model node in which i need to populate the data. Further i did the context mapping of the same.

But i am getting disabled form ui elements on running the project. Did you created your own context in the view with similar attributes or you did something else ?

Please Help.

Best Regards,

Amol

Former Member
0 Kudos

hi,

1. Compcontroller to Model -


> do model binding

2. ViewController to CompController ---> Context Mapping.

The disable UI elements you get because you might not have created the instance of the model object.

in the wdDoinit of the compcontroller create an instance of model object and bind it to node.

EX

Say your RFC name is <b>Z_TEST_RFC</b>

Z_TEST_RFC input = new Z_TEST_RFC();

wdContext.nodeZ_TEST_RFC.bind(input);

This should be solve your problem.

Regards,

Gopi

Former Member
0 Kudos

hi amol,

if i am not wrong your structure is this.

XYZ__XYZ__XYZ__Input

[+] xy_xyz(Bapixyz2)

[+] xy_Act_Data(XYZ_abc_Act_data)

[+] Output

[+]xy_xyz_<b>out</b>(Bapixyz2)

[+]xy_Act_Data_<b>out</b>(XYZ_abc_Act_data)

Did you check whether your UI elements are bound to xy_Act_Data_out node under Output? Since after executing the RFC the data gets populated in the node under Output.

Regards,

Gopi

Former Member
0 Kudos

Hi Gopi,

I already created instance for model.

and I do not have xy_Act_Data_out under Output as i am not supposed to populate data under any output node but this is a case of <b>structure</b> and not a Table where I only have to enter data to xy_Act_Data which is above and outside output node.

Actually I am trying to store data in a buffer as structure is involved and further on click of a save button it should simply store it temporarily in a structure and further on the click of a finalSave button i will be calling another RFC to store the data finally to the database.

Former Member
0 Kudos

hi amol,

try out this code.

XYZ_abc_Act_data xyxstuc = new XYZ_abc_Act_data();

xyxstuc.set<fieldname>(wdContext.node<nodename>,current<nodename>element().get<fieldname());

wdContext.currentXYZ__XYZ__XYZ__InputElement().modelObject().addxy_Act_Data(xyxstuc);

wdThis.wdGet<compcontrollername>.<executeRFCMethod>

<b>//wdContext.node<nodename>,current<nodename>element().get<fieldname() is the buffer where you are storing the date</b>

Regards,

Gopi

Answers (2)

Answers (2)

monalisa_biswal
Contributor
0 Kudos

As ur context structure is suggesting, to work with xy_Act_Data model node you have to create one instance of child model node's structure type as well and set it to the parent node's instance .

Check out for the type in the properties view of model node.

<Type of XYZ__XYZ__XYZ__Input> var = new <Type of XYZ__XYZ__XYZ__Input>();

wdContext.nodeXYZ__XYZ__XYZ__Input().bind(var);

var.set<Type of xy_Act_Data>(new <Type of xy_Act_Data>());

Former Member
0 Kudos

Looks like there is some problem with the binding !!!

Could you please post the code in the init() of component or custom controller,

Are you binding it to the node XYZ__XYZ__XYZ__Input()??

Ex : wdContext.nodeXYZ__XYZ__XYZ__Input( xy_Act_Data );

Regards,Anilkumar

Former Member
0 Kudos

Hi Anilkumar, thanks for responding.

The binding is fine, I checked once again.

Here is my

wdDoInit()

{

msgMgr = wdComponentAPI.getMessageManager();

Input = XYZ__XYZ__XYZ__Input();

wdContext.nodeXYZ__XYZ__XYZ__Input().bind(xy_Act_Data);

}

Former Member
0 Kudos

1. Create instance of modelClass XYZ_abc_Act_data

XYZ_abc_Act_data actData=new XYZ_abc_Act_data();

2. xy_Act_Data data=new xy_Act_Data();

data.setXYZ_abc_Act_data(actData);

Now bind the inputnode wdContext.nodeXYZ__XYZ__XYZ__Input().bind(data);

in the step 2 , i am not sure about the generated method .It could be setXXX or addXXX method.

Regards, Anilkumar

Former Member
0 Kudos

i am getting an error

xy_Act_Data is not a type.