cancel
Showing results for 
Search instead for 
Did you mean: 

Difference in submiting form using JS(CLient Side) and ABAP(server side).

former_member184111
Active Contributor
0 Kudos

Hi All,

We are implementing OCI . When i submit the for using below code:



<htmlb:button         id            = "submit"
                            text          = "Transfer To Shopping Cart"
                            tooltip       = "Transfer catalog to shopping cart"
                             o n C l i e n t C l i c k   =   " g o b a c k ( ) ; "   / > 
<scrapt typw="texa/javascaipt">
fu   n c t i o n   g o  b a   c k ( )
{

var r e t _ U R L   =   " < % =   H O O K _ U R L   %> " ; 
d oc u m e n t . f i n a l . a c t i o n   =   r e t _ U R L ;
d o c u m e n t . f i n a l . m e t h o d   =   " P O S T " ;
d o c u m e n t . f i n a l . s u b m i t ( ) ;
}
</script>

the form is sumbited properly whereas if i use :

<htmlb:button         id            = "submit"
                            text          = "Transfer To Shopping Cart"
                            tooltip       = "Transfer catalog to shopping cart"
                            o n C l i c k   =   "transfer "   / > 

in OnInputProcessing:
when 'transfer'.
navigation->goto_page( hook_url ).

i get the error:

BSP Exception: The side exit http://sapupd.xxxxx.com:8002/sap (cz1TSUQlM2FBTk9OJTNhc2FwdXBkX1NSTV8wMiUzYXJUaHBOdE0yYlVsVnQ5NzAtS0wwdmFOUWdnTWo3WHpHY01YS2NITmMtQVRU) / bc/gui/sap/its/bbpsc02 /? OkCode = ~ ~ ADDI & target = _top & caller = ~ ~ Ctlg & SAPSessionCmd = open & ~ sap syscmd = NOCOOKIE & client = ~ ~ 200 & lan is for the page final.htm not defined.

What is the problem in submiting form at server side?

Thanks,

Anubhav.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Anubhav,

what should I say, I don't know the parameters either...

But you can use a http logger to monitor the http request that is transferred in your variant submitting the form by JavaScript. Maybe you can find out the missing parameters.

Best regards,

CW

former_member184111
Active Contributor
0 Kudos

Hi Cornelia,

Will defintaely do that and post if find anything interesting.

Thanks,

Anubhav.

Former Member
0 Kudos

Hi,

Here is a sample code to submit a form content to a page with a round-trip to server (a little adapted to your problem).

Note that l_page is declared as a type STRING page attribute.

Layout:

<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<% if l_page is initial. %>

... put here your current BSP page layout ...

<% else. %>
<%=l_page%>
<% endif. %>

OnInputProcessing:

CHECK event_id = cl_htmlb_manager=>event_id.

DATA: my_nav TYPE REF TO cl_bsp_navigation,
      t_fields TYPE tihttpnvp,
      l_field  TYPE ihttpnvp.
...
WHEN 'transfert'.
request->get_form_fields( CHANGING fields = t_fields ).

LOOP AT t_fields INTO l_field WHERE name NE 'oninputprocessing' AND name NP '*htmlb*'.
  navigation->set_parameter( name  = l_field-name
                             value = l_field-value ).
ENDLOOP.

navigation->use_auto_submit_form( ).

navigation->encode_parameters( bspr_yes ).

navigation->goto_page( hook_url ).

my_nav ?= navigation.

CALL METHOD my_nav->construct_url
  IMPORTING
    page = l_page.

my_nav->reset( ).
RETURN.
...

Regards,

Tanguy

former_member184111
Active Contributor
0 Kudos

Hi All,

I am extremly sorry for so late response.

I tried with the code provided by Tanguy,but with this code the form is not submited at all.

value of l_page is

<h tml><bod y onL oad="Java Script: docume nt.f.submit();"><for m id="f" na e="f" met hod="POST" a ction="h ttp: //sapupd.xxxxx.com:8002/sap(cz1TSUQlM2FBTk9OJTNhc2FwdXBkX1NSTV8wMiUzYW5haXRyamM0ZFdjNjdkQ3YzT1FuQ2tXYmh4MHhiZlVIejVtcC1WR3MtQVRU)/bc/gui /s ap/its/ bbpsc02

Please guide me on this.

Regards,

Anubhav

Former Member
0 Kudos

Hi Anubhav,

do you want to provide some additional parameters to your ITS-Application?

In case of submitting a html-form by JavaScript , the values of the parameters are added automatically to the request.

In case of using navigation->goto_page( ), you have to add them by

navigation->set_parameter( name='parameter_name' value = parameter_value ).

Maybe that's the problem?

Best regards,

CW

former_member184111
Active Contributor
0 Kudos

Hi Cornelia,

I can add parameters to the URL as you suggested and in SPRO also parameters can be added to the url....but i dont know what parameters to add so that the page is submited properly using server event.

Thanks,

Anubhav.

Former Member
0 Kudos

Hi Anubhav,

in general it is possible to call an external URL by navigation->goto_page( ).

Try with a simple URL like navigation->goto_page( 'http://sap.com' ). If this works, maybe you have a problem with your ITS-Application. The URL you provided seems to be truncated. Did you check wether you can call it standalone directly in your browser?

Best regards,

CW

former_member184111
Active Contributor
0 Kudos

Hi Cornelia,

The full URL is:

http://sapupd.mycompanyname.com:8002/sap(cz1TSUQlM2FBTk9OJTNhc2FwdXBkX1NSTV8wMiUzYXJUaHBOdE1XMTRzUllWbkNCRmQxVzV2bmJRTWo3VWJkcU1VdlZUZlItQVRU)/bc/gui/sap/its/bbpsc02/?~OkCode=ADDI&~Target=_top&~Caller=CTLG&~SAPSessionCmd=open&~sap-syscmd=NOCOOKIE&~client=200&~lan0068007400740070003A002F002F007300610070007500700064002E0077006900700072006F002E0063006F006D003A0038003000300032002F00730061007000280063007A00310054005300550051006C004D0032004600420054006B0039004F004A0054004E00680063003200460077006400580042006B00580031004E00530054005600380077004D00690055007A00590058004A0055006100480042004F0064004500310058004D00540052007A0055006C006C00570062006B004E00430052006D005100780056007A005600320062006D004A005200540057006F003300560057004A006B00630055003100560064006C005A0055005A006C0049007400510056005200550029002F00620063002F006700750069002F007300610070002F006900740073002F0062006200700073006300300032002F003F007E004F006B0043006F00640065003D00410044004400490026007E005400610072006700650074003D005F0074006F00700026007E00430061006C006C00650072003D00430054004C00470026007E00530041005000530065007300730069006F006E0043006D0064003D006F00700065006E0026007E007300610070002D0073007900730063006D0064003D004E004F0043004F004F004B004900450026007E0063006C00690065006E0074003D0032003000300026007E006C0061006E

And yes , it works with other URLs .When i try to call this URL directly in browser it shows done but with errors and teh IE remains blank.

Thanks,

Anubhav.

former_member188685
Active Contributor
0 Kudos

what is the value in the hook_url .?

navigation->goto_page( hook_url ).

ideally it should work. instead of hook_url give the page ex

navigation->goto_page( 'main.htm' ).

former_member184111
Active Contributor
0 Kudos

Hi Vijay,

Value of hook_url is:

http://sapupd.xxxxx.com:8002/sap(cz1TSUQlM2FBTk9OJTNhc2FwdXBkX1NSTV8wMiUzYXJUaHBOdE51YndkY0NjNXlOdlNjNkdXbUNBTWo3VURHdDhXZm9NNzktQVRU)/bc/gui/sap/its/bbpsc02/?~OkCode=ADDI&~Target=_top&~Caller=CTLG&~SAPSessionCmd=open&~sap-syscmd=NOCOOKIE&~client=200&~lan

it is the url of an ITS application,to which this form is submited.

Its working fine with other URLs.

Thanks,

Anubhav.