cancel
Showing results for 
Search instead for 
Did you mean: 

Java Iview Refresh EPCM???

Former Member
0 Kudos

Iam New on SDN,greatest community ever!!

I hope somebody would solve my problem.

How could I programatically refresh a java Iview in the Portal?

Is it though EPCM??

Sample code?Any directions to existing threads??

Thanks for every Input!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You could add refresh the iview by adding the following java and javascript lines to your jsp code.


<% String iviewurl = componentRequest.getComponentContext().getContextName().toString();%>
parent.pageSupport.ivuRefresh("<%=iviewurl%>");

If you want your iView to refresh at particular time intervals then you could use HTMLB timer component.

Former Member
0 Kudos

Thank you so much.

Iam getting runtime error if i insert your code.

even one line like:

<% String iviewurl = componetRequest.getComponentContext().getContextName().toString();%>

is giving me that error.

I have code from Page Builder API

<b><i>EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "reload",

)</i></b>Did u notice getContextName() from your code and from the API??

So is it not the EPCM we have to use?

Ofcourse your code seems perfect but it's not liking the line:<b><% String iviewurl = componetRequest.getComponentContext().getContextName().toString();%</b>

Thank you again for responding so quickly

Former Member
0 Kudos

EPCM should work fine as well. My code had a typo in it.

I was missing 'n' in

componentRequest

If you still get error, can you post the error.

Former Member
0 Kudos

Told ya your code is perfect, I have used the following code:

<% String iviewurl = componentRequest.getComponentContext().getContextName().toString();%>

EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "reload", )

is working now...But it doesn't seem that it is reloading it..

is reload and refresh same for an iview?

Coz my backend data is not loading and results only when i manually click on the page tab again.

Can u explain why?

Former Member
0 Kudos

Hi Taylor,

I haven't used EPCM to refresh or reload an iView but i have used the following two lines to succesfully refresh iView.

<% String iviewurl = componentRequest.getComponentContext().getContextName().toString();%>
parent.pageSupport.ivuRefresh("<%=iviewurl%>");

Former Member
0 Kudos

But if use that code then it throws a java script error:

A runtime error has Occured:

parent.pageSupport is null or not an object.

If we don't use EPCM then how would you reload an iview??

Prakash thanks for posting back so quickly!!

Former Member
0 Kudos

Taylor,

Sorry i forgot to mention that you need to put the iView on a page.

Prakash Singh

Message was edited by: Prakash Singh

Former Member
0 Kudos

Perfect prakash!

It works when i put this on a page.

But not really loads..only refreshes the view.

Do i have to use EPCM for loading and refreshing accuarately?

I mean..if i don't want to put the iview on a page is EPCM the answer?

Thanks for solving my problem.

Have a great Day,

Former Member
0 Kudos

Hi Taylor,

I don't what your java code looks like but make sure you are reloading/refreshing the content in doInitialization() method. EPCM should be used if you don't want to put the iview on page.

Prakash

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Another option would be using the HTMLB timer.

Regards,

Rich Heilman

Former Member
0 Kudos

Thanks,

My iview (Dropdown Box) gets populated from R3 BAPI.

If i delete values in Dropdown from Backend using some operations on JSP and when i hit refresh it should actually reload the content from the Backend again!!

So could you tell me the exact flow ..like doInt doPAI doPBO...if i hit refresh it's only reloading the JSP(from cache) but not loading the content from Backend.

have any ideas?

Former Member
0 Kudos

Taylor,

Because you are doing a reload (refresh-samething), it is going to execute the servlet from scratch and therefore it is going to execute doInitialization first and then doPBO. doPAI will never get executed(because there was no event).

If you want your PAI to be executed then use the following javascript code. Don't use the code that we already discussed.

var form = document.all(htmlb_formid);
form.submit();

Former Member
0 Kudos

k, I have all my logic written inside PBO.So it should reload the content from the Backend which is not happening for somereason.

if i put your code:

parent.pageSupport.ivuRefresh("<%=iviewurl%>"); twice in the code..will the iview be refreshed twice??

I don't see it happening two times...

I have an htmlb Link on JSP clicking on which would reload the iview..but for somereason even though it is refreshing upon clicking i don't see any results..only after cliking several times on the page or workset it loads...is it caching somewhere??

Thank you for quick reply!

Former Member
0 Kudos

iview will not refresh twice because the second refresh will never get executed. Remember html is regenerated every single time.

Are you making a commit in backend to make sure your data is update in R/3? iView shouldn't be cached if you haven't specified in the iView property. Try adding the logic in doInit.

Former Member
0 Kudos

Pretty Neat Explanation.

Infact i have a link on JSP that opens an R3 transactional Iview in a whole new window..I can modify the contents and save ..and close it.

Then i would hit refresh link on JSP which should bring the new details from Backend..Does it sound meaningful to do that way?

I have tried calling my JCA call in the doInit also..same thing no difference..

Thank you for every input!

Former Member
0 Kudos

You are fine the way you have designed your application.

Here are some few questions for you? Does your iView at any point reflect the new changes? Are you using a bean? Are you resetting the content of the bean to the new values you get from SAP? Why don't you just print out the new values you get to see if SAP is returning new content?.

Example:

IPortalComponentResponse = (IPortalComponentResponse) this.getResponse();
response.write(val + "<br>");

Former Member
0 Kudos

If i refresh the whole page then it brings the new results into the dropdown.

Yes, Iam using a bean.

Iam not sure abt resetting the bean with new values..

But when ever iam accessing the BAPI thru JCA..iam loading that into a model of the Bean.

So if i make changes and save in the BAPI then it should only bring the modified values of BAPI.How would i reset the Bean?

Why only when i refresh the top level tab or the whole page it shows the resultS and not with EPCM or with:

parent.pageSupport.ivuRefresh("<%=iviewurl%>");

Former Member
0 Kudos

that is what i mean by resetting the bean.. i am running out of ideas.

Former Member
0 Kudos

Prakash , You been gr8!

Just one more question,

Does the refresh reloads only the JSP or will it also go into Bean and Dynpage??

Do you have any pdf or links that has the flow of the Dynpage and stuff??

Thank you buddy!

Answers (0)