cancel
Showing results for 
Search instead for 
Did you mean: 

To access context values in java util methods in webdynpro java

Former Member
0 Kudos

My requirement is to access the wdcontext values in the my util classes.

kindly suggest how to access the context value in my util class

Regards

Priya

Accepted Solutions (0)

Answers (2)

Answers (2)

nikhil_bose
Active Contributor
0 Kudos

The context reference must be passed to the .java class in order to access same in the .java

for example,

Change MyUtil.java - get the reference to this file.


public class MyUtil {
//make a local variable of context element type.
private IPrivateCompView.IHashContextElement local_context;

//add context type in Constructor
public MyUtil (IPrivateCompView.IHashContextElement local_context, /*rest of params*/){
        this.local_context = local_context;
        //.... rest of initialization
}

In Webdynpro, initialize the call by passing the context reference.


 IPrivateCompView.IHashContextElement hashmap = wdContext.currentHashContextElement();
//initialize my class
new MyUtil( hashmap, /*rest of params*/);

regards,

Nikhil

Former Member
0 Kudos

Hi Priya,

First you have to create on .java program and put in to the particular package

For Ex: com.sap.tc.webdynpro.until this package having filename.java

how to access the context value in you are util class

1. Create one Value attribute under you are context.

Go to that value attribute properties type = here click on Elipse icon available. Please Click that icon Open the One Popup Window

In that popup window Choose Java Native Type and Click on Browse Button again Open one more Popup window

Here you can Pass you are java name (filename.java) and select that Click on OK Button

Hope this is Help full for you

Regards

Vijay Kalluri

Former Member
0 Kudos

Hi Vijay,

The requirement is I have a context of type hashmap in the controller and I want to use the controller's context value in java util methods.

Regards

Priya

Former Member
0 Kudos

Hi Priya,

That place you can find this hash method java.util.HashMap

I think it is help full for you priya. Or Can you give Clear Information.

Regards

Vijay Kalluri