cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data from webdynpro to function module(Urgent)

Former Member
0 Kudos

Hi ,

I am passing data from webdynpro to function module.

I put the below code in action and I am passing flags also.

Please check the code

wdContext.currentZfxx_abc_clas_Validations_InputElement().setP_V_Header(null);

wdContext.currentZfxx_abc_clas_Validations_InputElement().setP_V_Details(null);

String acctDocNumber = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_AcctDocNumber();

Date docDate = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_DocDate();

String docType = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_DocType();

String fisclaYear = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_FiscalYear();

boolean postInPrev = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_PostInPrev();

String refDocNumber = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_RefDocNumber();

String companyCode = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_CompanyCode();

String docHeaderText = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_DocHeaderText();

String reason = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_Reason();

String currencyKey = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_currencyKey();

String fiscalPeriod = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_FiscalPeriod();

Date postingDate = wdContext.currentCtx_vn_HeaderDetailsElement().getCtx_va_PostingDate();

IPrivateHeaderInfoView.ICtx_vn_HeaderDetailsNode headerDetails = wdContext.nodeCtx_vn_HeaderDetails();

validationInput = new Zfxx_abc_Hd();

wdComponentAPI.getMessageManager().reportSuccess("-- 1 ");

validationInput.setBelnr(acctDocNumber);

validationInput.setBktxt(docHeaderText);

validationInput.setBldat(docDate);

validationInput.setBlart(docType);

validationInput.setGjahr(""+fisclaYear);

validationInput.setBudat(postingDate);

validationInput.setMonat(""+fiscalPeriod);

validationInput.setPost_Prev_Per(postInPrev);

validationInput.setXblnr(refDocNumber);

validationInput.setBukrs(companyCode);

validationInput.setReason(reason);

validationInput.setWaers(currencyKey);

wdThis.wdGetHeaderInfoCompController().executeZfxx_abc_Validations();

wdComponentAPI.getMessageManager().reportSuccess("Data Successfully Copied");

In the //begin and //end

I write the code

Zfxx_abc_Validations_Input input = new Zfxx_abc_Validations_Input();

Zfxx_abc_Hd validationInput;

the functionmodule is executed but values are not passing.

Please helpme out.

Thanks

Risha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

add this statement before calling rfc

input.set<Node Name which contains the attributes>(validationInput);

the sample code to pass information is like below

Zfxx_abc_Validations_Input input = new Zfxx_abc_Validations_Input();

wdContext.nodeZfxx_abc_Validations_Input().bind(input);

Zfxx_abc_Hd validationInput;

validationInput = new Zfxx_abc_Hd();

validationInput.setBelnr(acctDocNumber);

validationInput.setBktxt(docHeaderText);

validationInput.setBldat(docDate);

..........

input.set<Node Name which contains the attributes>(validationInput);

wdThis.wdGetHeaderInfoCompController().executeZfxx_abc_Validations();

Regards,

ramesh

Edited by: Ramesh Babu V on Jul 31, 2008 10:32 AM

Former Member
0 Kudos

hi ramesh ,

input.set<Node Name which contains the attributes>(validationInput);

which Node I h've to set here...????

User Node or functionmodule structure node....?

Thank You for ur reply

thanks

Risha

PradeepBondla
Active Contributor
0 Kudos

functionmodule structure node.

PradeeP

Former Member
0 Kudos

functionmodule structure node.

Regards,

Ramesh

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ,

I am not geting any errors. But values are not passed. After executing function module I am getting success message. I am giving invalid data for that also getting success message.

In Return table im checking errors after executing function module if errors are in table the it will print the error messages in webdynpro.

But errors are not displaying.

Please help me out.

nikhil_bose
Active Contributor
0 Kudos

put external brake points in RFC so that you can check the RFC is called along with the data supplied from front-end dynpro.

nikhil

Former Member
0 Kudos

post your function module context structure.

and cofirm once your settting values to import parameters of RFC.

PradeepBondla
Active Contributor
0 Kudos

Hi,

Every thing is working fine but you are not getting the values in the table?

put this code after execute statement. context. node<your table node>.invalidate();

PradeeP

nikhil_bose
Active Contributor
0 Kudos

after instantiating validationInput = new Zfxx_abc_Hd();

where are you binding validationInput?

I think you are missing here.

after setting values try adding that to node

wdContext.nodeZfxx_abc_Hd().bind(validationInput);

nikhil

Former Member
0 Kudos

hi ,

I am setting the flags as

wdContext.currentZfxx_abc_Validations_InputElement().setP_V_Header("X");

wdContext.currentZfxx_abc_Validations_InputElement().setP_V_Details("X");

I am getting "NullPointerException" in this first line.

please help me out.

Thanks

Risha

PradeepBondla
Active Contributor
0 Kudos

Hi,

Check whether your FM is taking "X" as a flag in the r/3. what are the correct values you need to pass for this flag?

also write this code for setting flags after binding the input

i.e. write after

Zfxx_abc_Validations_Input input = new Zfxx_abc_Validations_Input();

wdContext.nodeZfxx_abc_Validations_Input().bind(input);

PradeeP

nikhil_bose
Active Contributor
0 Kudos

in component controller init, you have to instantiate the node first.

in wdDoInit()


Zfxx_abc_Validations_Input input = new Zfxx_abc_Validations_Input();
wdContext.nodeZfxx_abc_Validations_Input().bind(input);

could you please post structure of context/RFC ?

nikhil

Former Member
0 Kudos

try with this

input.setP_V_Header("X");

input.setP_V_Details("X");

even you get the error pass the values what RFC expecting ?(contact your ECC person )

Former Member
0 Kudos

Hi Nikhil ,

Already I instantiated this in wdInit method of component controller.

Thanks

Risha

nikhil_bose
Active Contributor
0 Kudos

plz post view context structure

PradeepBondla
Active Contributor
0 Kudos

Hi,

You have to bind the funtion module input node... see the below code for flight list bapi, given by sap

public void wdDoInit()
  {
    //@@begin wdDoInit()
    // Create a new element in the Bapi_Flight_Getlist_Input node
    Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();
    wdContext.nodeBapi_Flight_Getlist_Input().bind(input);
    // Create new elements in the Destination_From and Destination_To nodes
    input.setDestination_From(new Bapisfldst());
    input.setDestination_To(new Bapisfldst());     
}

after this you can set , get the values.

and also in your code i could see that, you are getting the values before executing the bapi. and also invalidate() the node after executing the bapi.

context. node<your node>.invalidate();

first you have to bind, then set the values to bapi, then execute the bapi and then get the values from bapi (output).

PradeeP