cancel
Showing results for 
Search instead for 
Did you mean: 

Adaptive RFC's issue

Former Member
0 Kudos

hi all

i have two bapi's one for displaying the data and the other for editing the data. say <bapi>_getdetail,<bapi>_changedetail

The input parameters are same for both the bapi's.

say the input fields are like

cus no

sal org

output:

address

--- city

---phonenum

---county

---email

i designed 2 views

start view :which accepts the input values

res view :which displays the data.

my requirement is

in the res view i should be able to display the data and if required i should be able to change the data in fields .

how can i achieve this .if possible pls provide me the code snippets

kiran

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member197348
Active Contributor
0 Kudos

Hi Kiran,

Try like this:

Create a form with all the details to be displayed or changed. Create a Boolean attribute editEnable and bind it to enabled property of the all Input Fields. Set the field to false in the method onPlugFromStartVeiw

wdContext.currentContextElement().setEditEnable(false);

Create a button "Change ", in implementation,

Use this code to enable the form.

wdContext.currentContextElement().setEditEnable(true);

I hope that I could make it clear.

Feel free to revert in case of any issues.

Regards,

Siva

Former Member
0 Kudos

hi siva,

Thanku very much for u r reply.

the thing is

i passed the inputs of bapi1 in view1 and added submit button

i am able to display the data i required in view2

now

i have to implement anothet bapi, say Bapi <change detail>

the inputs for this bapi is also same

i added edit button to view 2

when i click on edit button it should go for that change bapi .this is what i am trying to do

The prblm is i am not understanding how to map the input parameters of both the bapis

means only one input screen i designed for both bapis . can u tell me the way to acheive this.

Thanks

kiran

Former Member
0 Kudos

Hi,

As the context for both the BAPI's are in Component controller, so they are available for both the views.

So what you do is in second view in Edit button write the following code

IprivateSecondview.IBapiChangeDetail ele = wdContext.nodeChangeDetail().createElement();

ele.setAddress1(wdContext.nodeDisplay().currentDisplayElement().getAddress());

wdContext.nodeChangeDetail().addElement(ele);

wdThis.wdGetController.executeBapiChangeDetail();

Hope this will solve your problem

Regards

Raghu

Former Member
0 Kudos

hi ,

i did application by selcting template service controller for component controller. I am able to display the data using bapi:BApi_CUstomer_Getdetail1.

now the task is to change the displaying data by using edit button, which should call bapi Customer_Changefromdata1.

i tried the above said method but not working.pls help me out.

kiran

srinivas_sistu
Active Contributor
0 Kudos

Hi Kiran,

As per my understanding you dont have to create two views to display and edit.

What you can do is simply crete a single view with all required inputs fields and a button Edit.

So by defalut you display the data using bapi_getdetils and make all the input fields reaadonly. So when user clicks on Edit button enable the input fields so that user will enter/change the data. now provide a submit button and onclick of the submit button get the data from context variables corrosponding to these input fields and put this data into bapi_modifydetails model and execute the bapi. Hope this helps you....

Some thign like this....

Initially your Submit button will be hidden... get the dta using bapi_getdetails and populate that into required context.

Now when user clicks on Edit, enalbe all the inputs and show the Submit button. On click of Submit do the necessary validations(if required) and now call the second bapi to store the data.... upon successful updation, display a success message and hide the Submit button again.....

Regards,

Srinivas

Former Member
0 Kudos

Hi,

Why is that not happening, it should work otherwise do onething create another value node and fill the node with displaynode

elements when you are displaying and then when you want to edit the data assign the values from value node to the second

Changedatanode and execute the Bapi.

Regards

Raghu

Former Member
0 Kudos

hi,

can u provide me code snippets.so that it could be more helpful.

Former Member
0 Kudos

hi Raghu,

i tried the code u provided. Its throughing error at this line

IPrivateFianlview.IBapi_Customer_ChangedetailNode i =wdContext.nodeBapi_Customer_Changedetail().createElement();

even i tried for

IPrivateFianlview.IBapi_Customer_ChangedetailElementi =wdContext.nodeBapi_Customer_Changedetail().createElement();

the error is "Type mismatch:can not convert IWD node element to IprivateFinalView"

I tried like this:

public void onActionSubmit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSubmit(ServerEvent)

//Bapi_Customer_Getdetail1_Input inp=new Bapi_Customer_Getdetail1_Input();

wdContext.currentPi_PersonaldataElement().setCity(wdContext.currentPe_PersonaldataElement().getCity());

wdContext.currentPi_PersonaldataElement().setFax_Number(wdContext.currentPe_PersonaldataElement().getFax_Number());

wdContext.currentPi_PersonaldataElement().setLastname(wdContext.currentPe_PersonaldataElement().getLastname());

wdThis.wdGetNewcomponentController().executeBapi_Customer_Changefromdata1_Input();

wdThis.wdGetNewcomponentController().executeBapi_Transaction_Commit_Input();

//@@end

}

but when i ckick on submit button its giving nullpointer exception

regards

kiran

Edited by: kiran_mareedu on Sep 25, 2009 1:12 PM