cancel
Showing results for 
Search instead for 
Did you mean: 

MVC - Return to calling page

Former Member
0 Kudos

Hi,

I am trying to code an MVC that returns form fields to the calling page, but can't seem to get this working.

My main.do is defined as the default BSP for the BSP application, and is being called from an independant website.

In my DO_HANDLE_EVENT I would like to return to the calling website populating form fields, but can't seem to get this to work.

I have tried the below...

1) NAVIGATION->RESPONSE_COMPLETE( )

2) NAVIGATION->RESPONSE_COMPLETE( )

navigation->exit( ).

In both cases the MVC leaves a blank screen, but doesn't close itself.

The code in my DO_REQUEST reads...

if is_navigation_requested( ) is not initial.

return.

endif.

Once the navigation is working I would assume the form fields would need to be passed through to RESPONSE in DO_HANDLE_DATA, but I can't even get to that stage.

Assistance appreciated.

Robin

Accepted Solutions (1)

Accepted Solutions (1)

former_member181879
Active Contributor
0 Kudos

Robin,

The first problem is that your reference world is slightly upside down. So let us put some bits and pieces on the table. With your next questions, we try to bring it more back to normal.

There is a HTTP request, that comes from somewhere (usually a browser) and a HTTP response (that what the server sends back). Nothing else. Only these two concepts.

The concept of "form fields" are only interesting/valid within the context of a HTTP request. Which means only when somebody (the guy talking to us) send us a HTTP request, can we peek inside and look at the form fields.

For the HTTP response (what we are returning), there is only one concept (at our minimal abstraction level): HTML! You can only return a complete page that is full of HTML to the caller (which is usually the browser and it wishes to display this page).

Does this help you? No, probably not. So let me ask some questions in return:

(*) Describe your a simple version of the complete scenario. I suspect you have some external web page, that calls your WhatIsDate.HTM page. And this page must return a string to the sender.

(*) Can we use XML? What type of client is the caller? If a browser, we can consider a JavaScript solution.

brian

Former Member
0 Kudos

Brian,

Hi. Thanks for the response. Although I roughly understand the concepts, I am still trying to get to grips of the terminology.

I am developing a search page for cost objects that will be called from an external web site. I can either return XML or HTML - it makes no difference to me. Posting the field values back seems easier though.

The solution I have developed interfaces with SAP for various data transfers already - this is the last step that I have left till last, and am struggeling with (Its an HTML thing - give me ABAP anyday). All interfaces that we have already developed are sending through XML in the BODY of the REQUEST, and returning XML in the BODY of the RESPONSE. This I have managed to do with a simple BSP and the OnInitialization event. [ response->set_data( i_xxml ). ] So in this senario I can see how the returned page is sending our a response of HTML or XML.

With my new page I am trying to interact with the user. Allow them to select a cost object, and return the selected one to the calling page. I am assuming a response POST of the selected fields and values.

I have developed this through an MVC as this seems to be the way SAP is going, but can't seem to get or understand how to get the MVC to close down and return a POST response.

My MVC is has a view.htm with a couple of tableView's. The output tableView has a line selection that triggers the Event, but now what?

VIEW --> main.htm is called from main.do

<htmlb:content id = "content"

design = "classicdesign2002design2003" >

<htmlb:page>

<htmlb:form>

<xhtmlb:protectDoubleSubmit/>

<%-- -


Header----


--%>

<%@ include file = "top.bsp" %>

<%-- -


Search----


--%>

<%@ include file = "search.bsp" %>

<%-- -


Output----


--%>

<htmlb:tray id = "TrayList"

design = "TEXT"

isCollapsed = "<%= application->Collapsed_List %>"

title = "Search Result <b><%= application->G_CO_TYPE-description. %></b>, listed" >

<htmlb:trayBody>

<htmlb:tableView id = "LIST"

fillUpEmptyRows = "false"

footerVisible = "true"

filter = "NONE"

design = "alternating"

selectionMode = "singleselect"

onRowSelection = "SelectedLine"

table = "<%= application->TAB %>"

visibleFirstRow = "50"

visibleRowCount = "20"

width = "100%" />

</htmlb:trayBody>

</htmlb:tray>

<%-- -


--%>

</htmlb:form>

</htmlb:page>

</htmlb:content>

Former Member
0 Kudos

The calling system is within a browser, and the developer that side intends on including my page call as some type of iView.

former_member181879
Active Contributor
0 Kudos

Hallo Robin,

After reading your message a number of times, I am at lost to answer. It is not even worth to shoot in the dark here, as we are going to be way of mark. The problem is that you are using terminology that is not only non-standard, but in many cases theorectically impossible. We can try to help, but it going to take some time to really understand what you want to achieve. Do you have the time (and the patience)? Or could you describe this to another developer in your group, who can then write it down.

The first thing to learn in the world of HTTP is that there is exactly one HTTP request, and one HTTP response. We can only answer something, if someone is asking. This is in all cases the browser.

So let us start with building a picture of where you are. You posted the source of a view. No, it does not have to be MVC, a simple would be the same. In this view there is some code to display a table, with an event handler. The only way that this piece of the puzzle is going to work, is if the browser is calling us. So we have this very simple picture (we try to remove some complexity):


  human with browser    ---- sends HTTP request to server --------> server/BSP
                        <--- BSP sends back table ----

  human click in table  ---- browser sends HTTP request to server ---> BSP sees click, does something
                        <---- BSP sends back the data you want (either HTML or XML)

Important things in this picture:

(*) There are always matching HTTP request and response cycles.

(*) After the click we have to send a HTTP response, this is going to land in the browser

So far, so good. We can even just send a small ByeBye into the browser.

But now I fail with the rest of the picture. If you want to send data somewhere, of course you can make an outgoing call from BSP to some other server using either RFC or HTTP. Is this what you want?

Or, you write "and the developer that side intends on including my page call as some type of iView." Now, if this iView is a SAP Enterprise Portal, then of course you can consider to use a portal event to fire the information from your returned page to any other iView listening (in the browser) to events.

All in all, I am really at lost to say anything more intelligent. Hope at least that this did help.

brian

Answers (1)

Answers (1)

Former Member
0 Kudos

Brian,

Hi. I have spoken to my learnered collegues, and the answer lies in Java script. I have implemented their suggestions, and my BSP works now as expected.

So all is solved. I guess shows that as long ask you know what to ask for then you will get the answer.

Thanks for your input.

Regards,

Robin.