Questions on using classes inside BSP pages

Hi Group,
I have a few questions on how to use classes,interfaces,parameters in classes,
and etc., relating to OOPs concepts that can be implemented in BSPs.
Pls send me some link wherein I can explore things and use it in BSPs.
Thanks & Regards,
Vishnu.

Hi Raja,
I am facing issues like this:
1) When I use the code in my BSP as under:
<%
class ZCL_MODEL_03 definition load.
data ref1 type ref to ZCL_MODEL_03.
data cust_id type c value "1000".
data c_id type c.
create object ref1.
c_id = cust_id.
call method ref1->CHECK_CUSTOMER changing cid = cust_id.
%>
Cannot we define variables in the Scriptlet?? or we need to do only in the attributes sections only?? or in both??
2)I am not able to use both exporting & importing things in my method call.
eg.,call method ref1->GET_CUSTOMER
                  exporting cid = cust_id
                  importing c_id = eid.
In the method definition, I am only using simply logic like, I was trying to send a value into the "cid" defined in the method and putting that value into "eid" which was defined exporting, but, still I could not get the value into "c_id" that I have defined in the BSP page.
Note: in both the things(in BSP and class definition as well, I am using the same
        type for defining the attributes.
3)When can we define a "Returning" option in the Class method's parameter    
   Definition? and how can I use it with an example?
Thanks in advance.
Regards,
Vishnu.

Similar Messages

  • How to use GUI_DOWNLOAD inside BSP Application event

    Hi All,
    I am facing one issue while using GUI_DOWNLOAD inside BSP Application. When the processing goes at GUI_DOWNLOAD it gives me unknown error where as the same code is working when used in report program. My requirement is to save password into excel file at my local machine. I am using FM MS_EXCEL_OLE_STANDARD_DAT to save password in excel file but this function module fail when it reach at GUI_DOWNLOAD . Can you please help me out.
    Thanks and Regards
    Pradeep Kr. Rai

    Dear Pradeep,
    Find the below link which explains a simple data download to excel from a table view.
    www.sapt echnical.com/Tutorials/BSP/Excel/Index.htm
    Try to avoid the way your using in the BSP application and it is abdicable to use the standard methods / class available like "cl_bsp_utility"
    Hope this will be helpful.
    Regards,
    Gokul.N
    Edited by: Gokul on Oct 8, 2009 9:57 AM

  • Using classes inside of classes

    I have created a custom sound class called MySoundClass that
    extends the Sound class... it is declared as class
    com.stickyMatters.WineGlassPiano.MySoundClass. I also have another
    class called SongPlayer that is declared as
    com.stickyMatters.WineGlassPaino.SongPlayer... my question is.. how
    do i use the MySoundClass inside of the SongPlayer class... when I
    try to import it says I cannot use the import statement inside of a
    class file. I know in AS3 you can use the package keyword to create
    packages and do that... but as far as I can see there is no package
    keyword in AS2... because I tried, and it just tells me htere is a
    syntax error on the line with the package declaration... can you
    use one custom class inside another? and if so... how?
    P.S. just to be sure... i am using flash CS3 and writing AS2
    files. Thanks!

    ack!!! thank you...I actually tried that and it didn't
    work... but when I went back after you said it and tried it again,
    it did work... so I guess I just had a misspelling or something
    before. ugh! Thanks for the reply!

  • How to use class in JSP page ? In java works in JSP not...

    Hello developers,
    I need check if URL exists.. i use this code in java.. it works fine..
    import java.net.*;
    import java.io.*;
    public class Check {
    public static void main(String s[]) {
        System.out.println(exists("http://www.google.com"));
        System.out.println(exists("http://www.thisURLdoesntexis.com"));
    static boolean exists(String URLName){
      try {
        HttpURLConnection.setFollowRedirects(false);
        // note : you may also need
        //        HttpURLConnection.setInstanceFollowRedirects(false)
        HttpURLConnection con =
           (HttpURLConnection) new URL(URLName).openConnection();
        con.setRequestMethod("HEAD");
        return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
      catch (Exception e) {
           e.printStackTrace();
           return false;
    }in java all works fine.. it shows
    TRUE
    FALSE
    but i have no idea how can i implement this java code to my check.jsp page..
    i tried something like this..
    <%@ page import="java.io.*" %>
    <%@ page import ="java.net.*" %>
    <BODY>
    <%
    static boolean exists(String URLName){
      try {
        HttpURLConnection.setFollowRedirects(false);
        // note : you may also need
        //        HttpURLConnection.setInstanceFollowRedirects(false)
        HttpURLConnection con =
           (HttpURLConnection) new URL(URLName).openConnection();
        con.setRequestMethod("HEAD");
        return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
      catch (Exception e) {
           e.printStackTrace();
           return false;
    String a="http://www.google.com";
    %>
    <%= exists(a)%>and i want to see in my jsp page the result.. it means that JSP page shows
    TRUE
    Thanks in advance,

    Hi there,
    One solution is to use JavaBeans and call the methods for the JavaBean from the JSP page.
    Suppose you have a JavaBean called TestConnectionBean as follows:
    package test22;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.IOException;
      Set the testUrl before checking if connection exists.
    public class TestConnectionBean {
        String testUrl;
        boolean connectionExists;
        public TestConnectionBean() {
        public String getTestUrl() {
            return testUrl;
        public void setTestUrl(String testUrl) {
            this.testUrl = testUrl;
        public boolean getConnectionExists() throws IOException, MalformedURLException {
            HttpURLConnection.setFollowRedirects(false);
            // note : you may also need
            //        HttpURLConnection.setInstanceFollowRedirects(false)
            HttpURLConnection con = null;
            con = (HttpURLConnection) new URL(this.testUrl).openConnection();
            con.setRequestMethod("HEAD");
            return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
        public void setConnectionExists(boolean connectionExists) {
            this.connectionExists = connectionExists;
    }Then you can create a JSP page like this:
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
      <head><title></title></head>
      <body>
      <jsp:useBean id="testConnectionBean" class="test22.TestConnectionBean"/>
      <jsp:setProperty name="testConnectionBean" property="testUrl" value="http://www.google.com" />
      <br/><br/>
      Does the connection exist for http://www.google.com : <jsp:getProperty name="testConnectionBean" property="connectionExists"/>
      <br/><br/>
      <jsp:setProperty name="testConnectionBean" property="testUrl" value="http://www.thisURLdoesntexis.com" />
      <br/><br/>
      <%-- The following will give an exception : java.net.UnknownHostException: www.thisURLdoesntexis.com since the URL doesn't exist. 
      --%>
      <%--
      Does the connection exist for http://www.thisURLdoesntexis.com : <jsp:getProperty name="testConnectionBean" property="connectionExists"/>
      --%>
      </body>
    </html>The output you see looks like:
    Does the connection exist for http://www.google.com : true
    I think it is better to handle the exceptions in the JavaBean itself, so now yyou can change the method signature of getConnectionExists , remove all exceptions from method signature but handle them with a try/catch inside the method itself.

  • Question about using class Scanner

    Hi, everyone. I am a newbie of Java. I am writing a simple program to let user input 3 integers by using Scanner.
    I know Scanner will igrone if more than 3.
    But if i want to tell user if they were wrong when they input more than 3 integers,
    is it possible if just use nextInt() to read?
    Thank you!
    Edited by: AlexChanMC on Feb 21, 2010 12:44 PM

    AlexChanMC wrote:
    javadoc said hasNext and next methods may block waiting for further input
    that is why after i input 3 integers press enter and without response, then i need to input 4th thing to continue?
    so how can i make the program response normally (print out) after input 3 integers and pressing enter and tell user they are wrong if they input 4 integers?
    Edited by: AlexChanMC on Feb 21, 2010 5:39 PMHmmm. I don't think I've ever used a Scanner to read from the standard input ... usually, from files, like so:
          Scanner sc = new Scanner(new File("myNumbers"));
          while (sc.hasNextLong()) {
              long aLong = sc.nextLong();
          }Perhaps you can just get the whole line, and see if it matches the regular expression
    "^(\\d+) (\\d+) (\\d+)$" // may need to trim the input line firstIf not, you don't have exactly three integers. That way, you only do a single nextLine() on the scanner.
    {?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to use Hyperlink in BSP page

    Hi,
    I have a hyperlink content in a table in one field.
    The link content is generated at the runtime, I mean it is not constant every time. It is different for different records in the table. I want to navigate to that link( a new window ) when clicked on that link, a field of table. How can I do that??
    Regards,
    Niranjan

    <%
    data: linkid type string ,
          ttab(5) .
    loop at linktable into wa .
    move: sy-tabix to ttab .
    clear linkid .
    concatenate 'link' ttab into linkid .
    condense linkid no-gaps .
    %>
    <htmlb:link id            = "<%= linkid %>"
                      reference     = "<%= wa-linkurl %>"
                      text          = "<%= wa-linkdescription %>" />
    <% endloop .%>

  • Creating sales order using BAPI, through BSP using 2 pages. one for input

    Hi Friends,
    i have a Requirement that....
    i want to create a BSP pages, in first page i have to give input data (in input fields) which is required to create a sales order through BAPI function module (BAPI_SALESORDER_CREATEFROMDAT1).
    in the second page what ever the result given by BAPI FM, that result i want to display on the second page.
    so how i can i proceed with input fields in first page and result in second page. please through some input on this.
    thanks in advance.
    sree

    Hi Sree,
       If you are going to use MVC pattern to do the following steps.
    For example. company code selection...
    In Model class-INIT() method.
    DATA : S_COMP LIKE LINE OF <table>.
    READ TABLE <table> INTO S_COMP INDEX 1.
      IF SY-SUBRC <> 0.
        S_COMP-TEXT = <variable>.
        S_COMP-KEY = '1'.
        APPEND S_COMP TO <i_table>.
        CLEAR S_COMP.
        INSERT S_COMP INTO <i_table> INDEX 1.
      ENDIF.
    HTML View page.
    <htmlb:dropdownListBox id = "comp"
                      table   = "//model/<table>"
                  selection   = "//model/<variable>"
            nameOfKeyColumn   = "text"
            nameOfValueColumn = "text"
            onSelect          = "<Event name>" />
    Thanks,
    Suriya.

  • Converting a class for use in a jsp page.

    I was just wondering if it is possible/normal to convert complex(ish) classes to change the output from the system.out, to a return value from a method that is displayed via a jsp page. (I am just beginning, and trying to make the coversion from asp with COM to jsp with beans/servlets and I am not yet fully understanding the technologies, and how you import classes etc - please bear with me!)
    first, I made a class that has a method that just returns a string. like:
         public String GetAValue()
              return "Hello there.";
         }and then I made a jsp page that imported the class (test) like:
    <%@ page import="Test" %>
    <jsp:useBean id="tst" scope="page" class="Test" />
    st = tst.GetAValue();
    out.println(st);
    Which to my delight, worked fine! Then I made another class that retrieved a value from a web service. kind of like...
         public String GetAValueFromAWebService(){
              return theWebService.GetValueFromWebServiceMethod();
         }This class also works good when I just run via "java testit". But when I went to do the same as above ,ie, import the class, do a usebean then do st=tst2.GetValueFromWebServiceMethod(), I could not get it to work at all. This class does lots more tricky stuff then the first one though - it loads its properties from a .properties file via an instance of another class, and imports funky stuff like - import org.uddi4j.* and import java.util.Vector; and more.
    Ok, now the question! Is what I am trying to do stupid? If so, how should I do it? If its not stupid, how do I include all the extra import statements on the jsp page (there are about 10)
    Wow, sorry about the length of this post. I hope someone can understand my ramblings!
    Thanks,
    nmoog.

    Sorry, yeah...
    I am actually using the UDDI4J package, and it loads various settings with the
    config = Configurator.load(); (a seperate class to load stuff in with)
    The Configurator.Load method basically just does:
    config.load(new java.io.FileInputStream("samples.prop"));
    and then does System.setProperty() with the config.getProperty()
    values.
    I have a test class when I do "java Test" it runs and in the Main method just instantiates the MyWebService class and does the MyWebService.GetAWebServiceValue() which returns a string.
    As I said, this runs fine. But from the JSP code if I do the same thing it gets a NullPointerException.
    "java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:389)
    at java.util.Properties.setProperty(Properties.java:102)
    at java.lang.System.setProperty(System.java:654)
    at Configurator.load(Configurator.java:43)"
    Why can it load okie-dokey from the test class, but not the jsp page? Any ideas?

  • Extend a Java Class Inside a JSP Page?

    Hello all. I'm not sure if I am thinking about this right. But what I have is a BaseClass that all of my other classes Extend. I'm inside a JSP page and want to use all of the functionality of that BaseClass. Is there anyway I can EXTEND A CLASS INSIDE A JSP PAGE or am I smoking crack?

    Its an attribute of the page directive
    "extends="package.class"
    The fully qualified name of the superclass of the Java class this JSP page will be compiled to. Use this attribute cautiously, as it can limit the JSP container's ability to provide a specialized superclass that improves the quality of the compiled class. "
    http://java.sun.com/products/jsp/tags/12/syntaxref1210.html#15653

  • Error while calling the PDF in BSP pages in ECC6.0: Question BSP Gurus

    Hi BSP experts,
    Any Experts have solutions for below.
    We recently moved BSP pages into ECC 6.0 .Iam getting the error in BSP page while calling the PDF.
    The scenario is like this: The PDF is getting called the via URL:
    The code is like this
      CALL FUNCTION 'GUID_CREATE'
        IMPORTING
          ev_guid_32 = guid.
      CONCATENATE runtime->application_url '/' guid '.pdf'    INTO   URL.
    <u><b>This URL is called in the front end LAYOUT.</b></u>
    <iframe src="<%= URL %>" width="100%" height="600px">
    </iframe>

    you missed one question of mine  <b>Do you create the PDF after creating the GUID ?</b>
    try giving a fixed URL just to test.
    Aman

  • How to login CRM 2007 BSP page use account domain of Microsoft AD

    Dear friends,
    I am finding solution to setup system with the requisite:
    - Login to CRM 2007 Business Server Page use account domain which is managed by Microsoft Acitve Directory.
    - Users use only web browser, they didn't use SAPGUI and they must type username, password ( their username,password are managed in Microsoft AD, not in SAP system) in every login to BSP page, don't use solution like X.509 client certificate.
    I used to configured using SNC and I could login to SAP System using SAPGUI without type SAP username and password when I log in my computer by account domain( my computer is joined in domain).
    But my requisite is have to use account domain( username and password)  and type them in web browser when I want to log in SAP system, could not configured to go to directly SAP application ( BSP page ) without type username/password of account domain.
    After time looking for solution about authentication :
    http://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/8039306e-cea4-2a10-15b9-8e96d40c51ef [original link is broken]
    I think may be I could login to java portal by used username/password of account domain to authenticate after login  to portal I use SSO to switch to BSP page without type username password again. This solution may be accepted because I was login to SAP application from web browser and used account domain.
    Could you show me, there are anymore solution or how could I do to to set up my above solution.
    Thanks and Best Regards.

    The normal way to do this is to configure the authentication stack required on a JAVA stack (e.g. portal or standalone Java instance of NetWeaver or dual stack) and then configure the BSP app in SICF transaction to redirect to Java stack when no SSO2 ticket is sent by browser (e.g. user has already authenticated). The redirect to Java stack will be done, such that after user has authenticated to Java stack they will be issued with an SSO2 ticket and redirected back to the BSP app URL. From end users perspective, they will access the BSP app URL and get authenticated using Active Directory, and they won't know about the redirection since they will be logged into the BSP app once they have authenticated.
    The authentication using Active Directory can be done using two methods:
    - Using credentials already on workstation from workstation logon, e.g. using Integrated Windows Authentication
    - Showing user a form where they enter AD account and password.
    Thanks,
    Tim

  • Uploading PDF as a MIME and using it as a BSP page

    hi BSP gurus,
    I have received a requirement where in we have to create a page with static content ( which has a processes with flow chart diagrams, text content and URL etc). User has provided this as a PDF document.
    Could anyone suggest if we can directly upload this PDF document as a MIME and use it as a page?
    P.S : I was able to upload PDF document as a MIME and create a page with flow logic of type application/pdf.
    Please let me know how can I use this PDF to display as a static page. Let me know if there is any other better solution.
    Appreciate your response.
    Regards,
    Sameena

    Hello,
    yes you can. Make right-click on your web application and then Create --> MIME object --> import. The file is uploaded into the web application and then you can call it, let´s say, like this:
    <htmlb:link id="link1"  reference="programming.pdf" text="presiona aqui"/>
    Application displays the PDF file.

  • Using external classes inside an EBJ

    Hi! Here's a simple question about EJB's:
    I have an EAR file containing a WAR file (WEB-INF/lib, WEB-INF/classes, and all that stuff), and a JAR file. The JAR file contains a MDB. A simple scenary, isn't it?
    Well, my MDB uses classes contained in the WEB-INF/classes of the WAR file. The reason why the classes needed by the MDB are in the war file (web-inf/classes) is that the war application also uses that classes.
    This trick works in some servers and versions, but fails in other cases.
    Now my JBoss 4.02 says:
    ClassNotFoundException: No ClassLoaders found for: com.einforma.sfee.peticiones.PeticionFactura
    Where this class is shared by the MDB and the WAR app, and is stored in WEB-INF/classes of the war file
    Can anybody suggest a workarond to this problem? What should be the 'elegant' way to make this work?

    Ok, it's solved, i just removed the classes from my
    war, made a jar with them, and put the jar into de
    ejb. Now both (war and ejb) can access the classes.you have duplicated the class in your application.
    A better strategy would be to make a jar of common utilities (which are used by both WAR and EJB classes). Put this in the J2EE server's class path.
    Of course, you must ensure that the EJBs and WAR classes dont use some shared resources in those utility classes.
    Packaging of your J2EE application is one of the most important tasks.
    regards

  • Using a BSP page to hide report url ?!

    Hello everybody,
    I would like to 'hide' exact query url.
    I have found in SICF transaction external aliases but I can replace only a part of my url, ie :
    http://host:port/sap/bw/bex?parameters => http://host:port/test?parameters
    I would like to replace all the url in :
    http://host:port/sap/bw/bex?parameters  => http://serveuralias/
    This url has to be the same for each BW reports ... (little bit stupid i think but ...)
    How can i do this ?
    We told me that we can parameter a BSP page in SICF, on bex service, which call bw reports and thus we should only see the bsp url in IExplorer and not BW report url. Is it possible ?
    Thanks a lot,
    CG.

    hi tom,
    can u tell which method u r using for URL parameter passing?
    regards,
    kamaljeet

  • Class connection to BSP page

    I have a error in a bsp app which is dumping in some conditions. The only clue I am getting in ST22 is a pointer to a bsp generated class named something like:
    CL_O2AH7ZCIJP6MCKNV45ALQC...
    Is there an easy way to map this back to the specific BSP page in my application?
    Thanks in advance.
    Nigel

    This is where I award myself 10 points because I found a much better solution.
    Here it is for all your enjoyment.
    1. Go to transaction SE24
    2. Enter CL_O2_RT_SUPPORT in the 'Object Type' box
    3. Press the F8 key. (The Key not the facebook api)
    (with me so far?)
    4. Click the little tick icon to the right of method GET_PAGE_BY_CLASSNAME
    5. Paste your cryptic class name in the P_CLASSNAME box.
    6. Press the F8 key again.
    7. Read the BSP page from the result.
    Phew, I just knew there had to be a better way than guess and debug.
    Thanks again for your answers guys,
    Nigel

Maybe you are looking for