BSP Page validation through ABAP in EventHandler

Hello Experts,
I am new in BSP Application.Kindly help me.
I have created a page through HTML code, now I have to validate input fields through ABAP code instead of JAVASCRIPT.
Can I do it in EventHandler.
If yes then please let me know with some examples.
Regards,
Ankur.

Hi anukur,
Ok, Let me show you one example which i have done ok,may be that may help you out.
layout  page is
on input processing
event handler for checking and processing user input and
for defining navigation
DATA:
w_event TYPE REF TO cl_htmlb_event,
  w_obj TYPE REF TO object,
  w_carrid TYPE REF TO cl_htmlb_inputfield,
  r_carrid TYPE RANGE OF sflight-carrid,
  r_id LIKE LINE OF  r_carrid.
CALL METHOD cl_htmlb_manager=>get_event
  EXPORTING
    request = runtime->server->request
  RECEIVING
    event   = w_event.
CASE w_event->id.
  WHEN 'get'.
    CALL METHOD cl_htmlb_manager=>get_data
      EXPORTING
        request = runtime->server->request
        name    = 'inputfield'
        id      = 'carrid'
      RECEIVING
        data    = w_obj.
    w_carrid ?= w_obj.
    w_scarrid = w_carrid->value.
    w_input = w_scarrid.
    CLEAR: w_obj.
    IF w_scarrid IS INITIAL.
      page->messages->add_message(
  condition = 'w_id1'
  message = 'Enter carrid value'
  severity = page->messages->co_severity_error ).
    ENDIF.
    IF w_scarrid CA '0123456789~!@#$%^&*()_-+='.
      page->messages->add_message(
        condition = 'w_id2'
        message = 'Enter a valid carrid'
        severity = page->messages->co_severity_error ).
      exit.
    ENDIF.
    IF w_scarrid IS NOT INITIAL.
      TRANSLATE w_scarrid TO UPPER CASE.
      IF w_scarrid IS NOT INITIAL.
        r_id-low = w_scarrid.
        r_id-sign = 'I'.
        r_id-option = 'CP'.
        APPEND r_id TO r_carrid.
      ENDIF.
      SELECT carrid connid fldate price seatsmax seatsocc FROM sflight
INTO TABLE t_flight WHERE
  carrid IN r_carrid.
      IF sy-subrc = 0.
        fl_flag = 1.
        EXIT.
      ELSE.
        page->messages->add_message(
        condition = 'w_id'
        message = 'No record exist '
        severity = page->messages->co_severity_error ).
      ENDIF.
    ENDIF.
ENDCASE.
Edited by: Bhavana Amar on Mar 19, 2010 8:35 AM

Similar Messages

  • BSP page result in ABAP

    Hi,
    I have developed the BSP page and calling it from the custome control in module pool
    data: html_control TYPE REF TO cl_gui_html_viewer.
    I have to store the result obtained from BSP page into Z table. The result appears in html control but i am unable to capture rersponse codes in abap program.
    http://sap.laldv1.com:8000/sap/bc/bsp/sap/ztest/test.htm?sap-client=210&sap-language=EN&x_login=fdsf&x_tran_key=fdsfs&x_card_num=4
          DATA : appname      TYPE string VALUE 'ZTEST',
                 ls_page_name TYPE string VALUE 'test.htm',
                 cb_true      TYPE boolean,
                 cb_false     TYPE boolean,
                 url          TYPE string,
                 c_url(2054)  TYPE c.
          MOVE : 'X' TO cb_true,
                 '-' TO cb_false.
          CALL FUNCTION 'UPWB_GET_APPLICATION_URL'
            EXPORTING
              application          = appname
              page                 = ls_page_name
              ib_additional_params = cb_true
              ib_in_subgui         = cb_false
              ic_preview_type      = 'B'
            IMPORTING
              url                  = url.
          c_url = url.
          CONCATENATE c_url '&x_login=' log_id
                            '&x_tran_key=' pws
                            '&x_card_num=' wa_zcreddata-cc_no
                            '&x_exp_date=' wa_zcreddata-exp_date
                            '&x_amount=' wa_zcreddata-so_amt
                            '&sap-user=abap2'
                            '&sap-password=abap2'
                            INTO c_url.
    *break abap2.
          CALL METHOD html_control->show_url
            EXPORTING
              url                  = c_url
            EXCEPTIONS
              cnht_error_parameter = 1
              OTHERS               = 2.
          IF sy-subrc GE 2.
            RAISE cntl_error.
          ENDIF.
    ****the result appears after runing  html_control->show_url which has to be captured in abap program.
    Thanks
    Ganesh

    Hi,
    I have developed the BSP page and calling it from the custome control in module pool
    data: html_control TYPE REF TO cl_gui_html_viewer.
    I have to store the result obtained from BSP page into Z table. The result appears in html control but i am unable to capture rersponse codes in abap program.
    http://sap.laldv1.com:8000/sap/bc/bsp/sap/ztest/test.htm?sap-client=210&sap-language=EN&x_login=fdsf&x_tran_key=fdsfs&x_card_num=4
          DATA : appname      TYPE string VALUE 'ZTEST',
                 ls_page_name TYPE string VALUE 'test.htm',
                 cb_true      TYPE boolean,
                 cb_false     TYPE boolean,
                 url          TYPE string,
                 c_url(2054)  TYPE c.
          MOVE : 'X' TO cb_true,
                 '-' TO cb_false.
          CALL FUNCTION 'UPWB_GET_APPLICATION_URL'
            EXPORTING
              application          = appname
              page                 = ls_page_name
              ib_additional_params = cb_true
              ib_in_subgui         = cb_false
              ic_preview_type      = 'B'
            IMPORTING
              url                  = url.
          c_url = url.
          CONCATENATE c_url '&x_login=' log_id
                            '&x_tran_key=' pws
                            '&x_card_num=' wa_zcreddata-cc_no
                            '&x_exp_date=' wa_zcreddata-exp_date
                            '&x_amount=' wa_zcreddata-so_amt
                            '&sap-user=abap2'
                            '&sap-password=abap2'
                            INTO c_url.
    *break abap2.
          CALL METHOD html_control->show_url
            EXPORTING
              url                  = c_url
            EXCEPTIONS
              cnht_error_parameter = 1
              OTHERS               = 2.
          IF sy-subrc GE 2.
            RAISE cntl_error.
          ENDIF.
    ****the result appears after runing  html_control->show_url which has to be captured in abap program.
    Thanks
    Ganesh

  • How to call BSP page from Webdynpro ABAP ?

    Hi All,
         I have a BSP page which has a page attibute . I need to pass a parameter from Webdynpro ALV table to the BSP page attibute and also need to display that BSP Page . Can any one help me out , how to proceed in this ?
    Regards,
    Kalpana A .

    hi kalpana,
    Use Exit Plug and pass data as URL Parameter.
    http://help.sap.com/saphelp_nw04s/helpdata/en/45/1bc575ba064574e10000000a114a6b/content.htm
    for how to pass url please check this
    http://help.sap.com/saphelp_nw70/helpdata/EN/7b/fb57412df8091de10000000a155106/frameset.htm
    Yogesh N

  • Open new BSP page

    Hi all,
    i am in ABAP report and i want to open new BSP page from the ABAP report
    becuse some time it is open the BSP page in the same session of SAP system.
    and also how i can maximize it automatically in the same way of (F11 key).
    is there any documents that describe and explain the signature of this method.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
    EXPORTING
           DOCUMENT      = 'XXXXXX .......'
         APPLICATION            = 'X'
         PARAMETER              =
         DEFAULT_DIRECTORY      =
         MAXIMIZED              =
         MINIMIZED              =
         SYNCHRONOUS            =
           OPERATION              = 'OPEN'
    EXCEPTIONS
            CNTL_ERROR             = 1.

    If you want to open the BSP in Browsers, you can call the FM CALL_BROWSER & pass your BSP appl URL. This will open the BSP from R/3.
    OR you can use the HTML viewer to call URL..
    Look at the below blog for the same.
    /people/thomas.jung3/blog/2004/08/26/updated-calling-a-bsp-application-from-a-sapgui-transaction
    Hope this will help you.
    <b>*Reward each useful answer</b>
    Raja T

  • How to close bsp page in onInputprocessing eventhandler?

    On my bsp page layout, i have a cl_htmlb_button .i do some db processing in that button's onclick event,at the end of the processing i want to close the page,but i don't want to use onclientclick event (e.g. javascript:window.close() ) of that button.
    so my question: how can i access javascript function to close the current page within onInputprocessing eventhandler ?
    or which abap class method should i call to close the page?

    Hi,
    One can't use JS in the oninputprocessing. There are 2 options:
    - either you submit you form via JS and end with
    window.setTimeout('window.close()',5000);
    check http://www.devguru.com/technologies/ecmascript/quickref/win_settimeout.html for details
    - either you don't specify any page you're navigating to end set a variable.
    in the the <body> tag of your layout  you test on that variable. If set you do a window.close in the onload of the body.
    Check http://www.devguru.com/technologies/ecmascript/QuickRef/evhan_onload.html for details on that.
    Eddy
    PS. Reward the useful answers and you will get <a href="http:///people/baris.buyuktanir2/blog/2007/04/04/point-for-points-reward-yourself">one point</a> yourself!

  • Call an ABAP Function module on click of Button in BSP page

    Hello ,
    i would like to run a ABAP function module on click of a button in BSP page.
    or in other words i want a Funtion module ex: 'test1' to run after clicking this button ex: 'button1'
    and how to pass the values for a function module after clicking the button.
    i an new to bsp application .
    Can anyone help me on this .

    Hi Shalaxy,
    Triggering a URL to WDJ:
    I suppose the URL of WDJ app. is also a portal URL. I assume that from a BSP application inside portal you need to trigger the WDJ url.
    But the catch is that you cannot hotcode this URL, since it varies for a development, quality and production systems(diff. portal environments).
    To solve this issue, ABAP provides a system variable named sy-sysid, which says want system your ABAP system is, normally a development R/3 system will be associated to development portal system and quality R/3 to quality portal ans so forth.
    So you could have a internal table/db table/ variable for dev, quality or prod portal urls and from the bsp on button click based on the value in the sy-sysid you can trigger the url accordingly.
    Creating a URL in WDJ
    The above is about triggering a WDJ from BSP. But if you dynamically want to create a link in WDJ on a button click, then apparently you could not do that from BSP, since the applications are different. All you could do is to pass some URL parameters to WDJ application from BSP app. Then based on the URL parameters the WDJ application has to dynamically create a link and add it to its application.
    Hope it helps.
    Regards,
    Maheswaran
    Edited by: Maheswaran B on Mar 1, 2010 4:17 PM

  • Calling a BSP page from ABAP programme

    Dear Friends...
            I am cslling a BSP... from an ABAP program... for that I have used this class and also a function module to ckeck.. actually from the abap program it invoks the BSP page very nicely and as my logic for invoking the BSP is a part of the Business Object and it is associated with the Enterprise portal so... when i reach the ep and trigger that business object to instantiate the BSP page from my calling logic of abap... it goes to the ITS and port 80 or something and didnt produce the BSP.. and only the blank screen was there...kindly help me how i am supposed to instantiate the BSP from properly from ABAP by interfacing the EP... my code is given below...
    data :
        lv_url type string.
      concatenate
        'http://sapdevbp.sbic.co.za:8041/sap(bD1lbiZjPTIwMA==)'
        '/bc/bsp/sap/z_updatemng/bp.htm?bpid=' object-key-businesspartnerid
        into lv_url.
    call method cl_gui_frontend_services=>execute
      exporting
        document = lv_url
      exceptions
        others   = 1.
    please help....
    me...
    regards
    Naim

    Instead of hard coding the URL try to get the URL of the BSP application with the below code
    CALL METHOD cl_http_ext_webapp=>create_url_for_bsp_application
    EXPORTING
    bsp_application = '<BSP application name'
    bsp_start_page = <start page e.g default.htm>
    bsp_start_parameters = params " any parameter you want to pass along with url
    IMPORTING
    local_url = url.
    Then try out passing the URL to the execute function

  • Trash in BSP-Pages for ABAP-reports

    Hi,
    it´s strange that I´m getting trash in the BSP-Pages that represent an ABAP report. I just can´t identify how it is produced and shows up between Titel and real list. I use
              SUBMIT (progr_name)
                 WITH SELECTION-TABLE sel_table
                 EXPORTING LIST TO MEMORY AND RETURN.
    and then CALL FUNCTION 'LIST_FROM_MEMORY'
    later    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
    I make a loop with the output and save all in a variable of type string, which is later used in the layout page.
    After execution, I get something like:
         Title       page Nr.      User name
         trash
         more trash
         even more trash
         list
    the data that I describe as trash is information from the list, but it also appears where it must.
    Has anyone experience with it ?? Thanks

    I am also getting some "trash" at the beginning of my report in some cases. The report list I am sending the FM contains Material Descriptions and our descriptions (can) contain a combination of slashes (/), colons ( and commas (,) (eg. SPARES:DISPLAY/GASKET,MONO,GEMINI) - I find that if I remove the commas from the descriptions during the reporting, that I do not have this problem. However this is not a viable solution. Any ideas would be very helpful.

  • Launching the BSP page through transcation launcher

    Hi CRM Experts ,
                              How to launch the BSP page through transcation launcher ?

    Hi Mahadevi,
    You can find the detailed information here:
    [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0da6d63-8485-2c10-dab6-bb202e209455|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0da6d63-8485-2c10-dab6-bb202e209455]
    Regards
    Leon

  • Display image in BSP page,images are on a web server outside of SAP

    Hi,
    I am creating a BSP page for employee profile.The page needs to show an emp picture along with other info.The images are not in the MIME repository,they are stored in a separate web server.I am able to display the page using
    <img border="0"                     src="http://.com/xyz/xyz.bmp" >
    However this is a non secured test server. If the images are on a secured server,I am assuming,an id ,pswd authentication will be required.Can I get the authentication done automatically so that the page is rendered seamlessly for the end user?
    Would SSO help if this web server is a portal server?what if the web server is not a portal server?

    Hi Manidipa,
    The Http class in SAP can also be used in passing the required authentication information to the non-SAP portal system.
    http://searchsap.techtarget.com/whitepaperPage/0,293857,sid21_gci1084087,00.html
    There is an article written by Angeli Axel which does the same. The article has got ABAP HTTP classes and methods to get and post the parameters to the non-SAP portal system.
    The same solution can be done by passing the credentials in the url. The custom solution would be to pass the required credentials in the url and the receiving application should grab those information from the url and confirm the authentication. After that it should be able to provide you the image. After getting the image it can be simply displayed in your BSP using iframe tag.
    For eg if the receiving side is in java, then the following code can be used to receive the username and password. Once you get this you can verify the validity depending on the datasource whether LDAP(MS-ADS, Sun one, Novell edirectory) or ordinary database(Oracle, MS SQL Server .. etc) is used for storing the credentials.
    try {
              String userName = request.getParameter("username");
              String password = request.getParameter("password");
              if (validateUser(userName, password)) {
                 response.sendRedirect("mainpage.jsp");
    The main page here you display the image
    } catch (Throwable t) {
    The above code should be considered as pseudo code for any server side language.
    Please let me know if this helps.
    With regards,
    Rajesh Khanna Venkatesan.

  • How to call function module in R/3 from an BSP Page

    Hi Experts,
    I am new to ABAP and BSP as well.
    I am creating an BSP page through which I want to call an function module in R/3 which will fetch a file from the application server and place into an internal table.
    I have identified the function module.
    My questions are:
    Since I am going to have an web interface where on a button click the file should be uploaded to the intrernal table.So how do I call the function module.
    Can I use JSP and ABAP together in an BSP page.
    Thanks
    Ankit

    Hello Ankit,
    Please check the following link:
    http://help.sap.com/saphelp_47x200/helpdata/en/bd/ac1e3a0088e042e10000000a11402f/frameset.htm
    I think it will answer all your queries.
    Regards,
    Siddhesh

  • Call external application through Abap WD application

    Hello All,
    We are trying to call an external application using ABAP.  The details are as below
    1) SAP server on AIX OS
    2) External Apps server: Windows OS
    The external apps takes a file located on windows as input and generates a file on windows as output. The external appls is installed on the windows OS.
    We are unable to trigger the VC apps from ABAP.( AIX OS).
    Appreciate if you can guide and give some examples. Please note that the OS are different.
    Questions:
    1)  How to access windows file system to execute external appls from ABAP ( AIX)
    2)  Would a RFC be required to be made between ABAP and the windows server where external appls is hosted
    3) Any sample code/links is really help ful
    We were able to get it working when the applications was hosted on local file system ( desktop) . Two problems are getting the appls executed on remote and different OS accessing windows file system through unix ( AL11 should help here i guess)
    Regards
    PN

    Hi Lekha
    I want to start a *.bsp page in a new external window and POST Parameters to this *.bsp page.
    So it is not actually showing a bsp in a ABAP WD.
    Kind regards
    Paul
    PS: create_external_window is alway a GET Method and I do not want to show Parameters in the URL.

  • Step by Step Debugging in BSP page

    Hi,
      Can any one tell me How to do the Step by step debugging? In ABAP application we are doing through /h command.Like this any command is there in BSP page for debugging? And where actually we need to place the break point means in Controller or in View?
    Thanks in advance,
    Regards,
    Anu.

    HI
    GOOD
    GO THROUGH THESE LINKS
    http://www.sappro.com/downloads/technical_guides/WebAppDevTOC.pdf
    http://www.sap.com/solutions/netweaver/pdf/50052038.pdf
    THANKS
    MRUTYUN

  • Executing BW Queries in BSP Page

    Hi,
      Can someone provide source code taking one query and accessing it through the BSP event handler page?
      Will the BSP Page can replicate the same functionality of the BEX web application?
      Can i have drilldown,graphics everything in BSP application?
    Thank you
    arun

    Hi,
    Answer to Arun:
    <i>Can someone provide source code taking one query and accessing it through the BSP event handler page?</i>
    You have to use CL_RSR_REQUEST/CL_RSR_DATA_SET classes (other option is OLAP BAPIs where u have to use MDX stts.)to execute BW queries thru ABAP. (sample code is available in ABAP forum)
    <i>Will the BSP Page can replicate the same functionality of the BEX web application?</i>
    No, you have to code everything yourself. but will be a tedious job.
    <i>Can i have drilldown,graphics everything in BSP application?</i>
    Yes you can, but again as i said you have to code everything , it dosent come easy as in the case of WAD.
    Answer to LUCA:
    One of the possible ways is to use redirect url (url poinintg to the BW query url) in the BSP page.
    you can also pass query variable values via URL.
    example:
    TEMPLATEID=<template name>&var_name_1=<variable name>&var_value_ext_1=<var value>&var_name_2=<var name 2>&var_value_ext_2=<variable value 2>
    Hope it helps.
    Regards
    Raja
    Note: Better place for this question would be BSP forum
    Message was edited by: Durairaj Athavan Raja

  • Call function module from BSP page

    Hi Experts,
    I am new to ABAP and BSP as well.
    I am creating an BSP page through which I want to call an function module in R/3 which will fetch a file from the application server and place into an internal table.
    I have identified the function module.
    My questions are:
    Since I am going to have an web interface where on a button click the file should be uploaded to the intrernal table.So how do I call the function module.
    Can I use JSP and ABAP together in an BSP page.
    Thanks
    Ankit

    Hello Ankit,
    Please check the following link:
    http://help.sap.com/saphelp_47x200/helpdata/en/bd/ac1e3a0088e042e10000000a11402f/frameset.htm
    I think it will answer all your queries.
    Regards,
    Siddhesh

Maybe you are looking for

  • Issue with Correlation in 11g related to Number of Instances

    Hi , I am working on the correlation sample application and i observed like correlation is working fine but it seems two instances are creating in EM console, As per my knowledge when we are working with correlation we should only one instance, Can a

  • Modifying existing theme

    Hi ! I use N79. I just want to modify the theme to add a wallpaper so that it sit nicely in the middle of the screen. Where can I find the existing themes ? Thanks

  • PO & Invoice

    Hi i want to generate the report for single vendor complte list from last 4 years. in that report i should maintain the PO details and invoice corresponding to PO. Please help me where i can pick the information for last 4 years tarak

  • Linked Images - Setting the order?

    I have a catalyst project that was 6mb before I linked the images to the assets folder. The problem I'm having now is that the main .swf loads fast, however, the images all load in a random order. I was under the impression they would only download w

  • Merging 2 IPHOTO together

    Hi, I own 2 apple's computer and I have pictures in IPHOTO on each computers. How can I combine all of my pictures on a single machine in IPHOTO. I want to merge my 2 IPHOTO together on 1 machine and keeping the folder, album, rating of both. Regards