BSP string handling

Hi,
I'm currently in the process of modifying some ITS Templates for our ESS Open Enrollment application. Based on who is logging in, I must either prompt them for a screen to allow employees to reset their passwords or proceed to reset their passwords automatically.
To differenciate these two groups, I'm comparing the login ID (~login) against a temporary ID that begins with ID followed by 6 digits (i.e. ID400088). I have the following command:
`if (~login=="ID400088")`
`else`
`end`
So, what I would like to do is to have an IF statement that would work for all IDs. In ABAP, it would be something like this:
`if (~login+0(2)=="ID")`
`else`
`end`
Can you please provide some assistance or suggestions?
Thanks,
Paul (new to BSP)

Yes, you can use substrings in IF statements in ABAP.
if login+0(2) = 'ID'.
* Do Something.
endif.
or are you trying to do this directly in the BSP code.
Regards,
Rich Heilman

Similar Messages

  • Concerning String Handling

    Hello To Every One,
    I have a query concerning String Handling.
    String s3 = "Java is a wonderful language";
        System.out.println("s3 is: "+s3);
        System.out.println("lastIndexOf(a, 23) = " + s3.lastIndexOf('a', 23));
        System.out.println("********");
    String s4= "Java is a wonderful language";
        System.out.println("s4: "+s4);
        System.out.println("lastIndexOf(a, 19) = " + s4.lastIndexOf('a', 19));Output is:
    s3 is: Java is a wonderful language
    lastIndexOf(a,23)=21
    s4 is: Java is a wonderful language
    lastIndexOf(a,19)=8what is basic difference in s3.lastIndexOf('a', 23)); and
    s4.lastIndexOf('a', 19));
    that output is lastIndexOf(a,23)=21 and
    lastIndexOf(a,19)=8
    Please clarify..
    Thanks.

    Even without reading the API you should be work out what it is doing
    - by reading the source code for the method.
    - debugging it with a debugger.
    - inferring what it does from its name.
    But reading the API is the most obvious, that what the documentation is for.

  • Switching off BSP delta handle.

    Hello All,
      I want to switch of the <b>delta handler</b> for a BSP page. I have been told that there are 2 delta handlers. One on the server side and another on the client side as a JavaScript optimizer.
      Please suggest on how I can switch off the functionality for a particular page.
      At the moment I have a page where the unchanged data doesn't flow back to the server because of the delta handler.  This results in incorrect posting of data.
    The effort for persisting the values on the server side is very high and hence I would prefer to switch off the delta handler.
    Thanks and regards,
    Murli Rao

    Hello Gregor,
      This javascript has to be added in the view in which you want to disable client side delta handling.
      This is not a modification to standard. I had a Z view in which I wanted to switch of client side delta handling.
      If you want to do that for a standard view then there are two options.
    1. Do a modification to standard.
    2. Do a controller replacement and when you copy the
        view into your own package then you can add the
        javascript.
    I hope I have answered your question satisfactorily. If you still have any doubts please feel free to post a new question.
    Thanks and regards,
    Murli Rao

  • Doubt in String handling...

    Hi
    Here i have a code snippet.
    public class StringComp
         public static void main(String[] args)
              String a = "abc";
              String b = "def";
              String c = "abcdef";
              String d = "xyz";
              String e = "xyz";
              a+=b;
              System.out.println("Value of a = :" + a);
              System.out.println("Value of c = :" + c);
              System.out.println("Value of d = :" + d);
              System.out.println("Value of e = :" + e);
              if(a==c)
                   System.out.println("TRUE");
              else
                   System.out.println("FALSE");
              if(e==d)
                   System.out.println("TRUE");
              else
                   System.out.println("FALSE");
    if i compile and run this code snippet i am getting the result as
    Value of a = :abcdef
    Value of c = :abcdef
    Value of d = :xyz
    Value of e = :xyz
    FALSE
    TRUE
    here i add the value of a and b to a. so a=abcdef, value of c also abcdef.
    but if i check (a==c) the result is False why??
    Can anyone tell me how the string is handled in java (behind the scene) where they are stored ? and how the == operator works on String?
    thanks in advance
    chithrakumar

    Strings are pooled. This means that if you writeString a = "1";
    String b = "1";you have a good chance that a == b.
    For new Strings (as "abc" + "def" returns), the pool is bypassed. This explains why "abc + "def" != "abcdef". To make sure a String is pooled, use intern (). ("abc" + "def").intern () == "abcdef", guaranteed.
    This is all very opaque behaviour and you shouldn't really rely on this in your code, except in very rare circumstances (extreme performance concerns or if you're stuck with an identity hash map [not that that's very likely]).

  • Anybody have some unicode string handling code I could use?

    Text handling plugins are not working for some users, since Lua and Lr are not on the same page char-representation-wise.
    For example, if you enter
    À
    in Lightroom, it's getting interpreted as
    À
    in Lua.
    in non-plugin environment, one could just use slnunicode, however in plugin one needs pure lua solution.
    Anybody?
    ref: http://lua-users.org/wiki/LuaUnicode
    R

    Try
    Debug.pause( "uni-find", string.find( photo:getFormattedMetadata( 'title' ), 'À' ) )
    when title field has an 'À' in it.
    Instead of seeing the coordinates of the 'À' that is there, you'll see nil.
    PS - this code looks promising (?) found at http://forums.gaspowered.com/viewtopic.php?f=19&t=29879
       function conv2utf8(unicode_list)
          local result = ''
          local w,x,y,z = 0,0,0,0
          local function modulo(a, b)
             return a - math.floor(a/b) * b
          end
          for i,v in ipairs(unicode_list) do
             if v ~= 0 and v ~= nil then
                if v <= 0x7F then -- same as ASCII
                   result = result .. string.char(v)
                elseif v >= 0x80 and v <= 0x7FF then -- 2 bytes
                   y = (v & 0x0007C0) >> 6
                   z = v & 0x00003F
                   y = math.floor(modulo(v, 0x000800) / 64)
                   z = modulo(v, 0x000040)
                   result = result .. string.char(0xC0 + y, 0x80 + z)
                elseif (v >= 0x800 and v <= 0xD7FF) or (v >= 0xE000 and v <= 0xFFFF) then -- 3 bytes
                   x = (v & 0x00F000) >> 12
                   y = (v & 0x000FC0) >> 6
                   z = v & 0x00003F
                   x = math.floor(modulo(v, 0x010000) / 4096)
                   y = math.floor(modulo(v, 0x001000) / 64)
                   z = modulo(v, 0x000040)
                   result = result .. string.char(0xE0 + x, 0x80 + y, 0x80 + z)
                elseif (v >= 0x10000 and v <= 0x10FFFF) then -- 4 bytes
                   w = (v & 0x1C0000) >> 18
                   x = (v & 0x03F000) >> 12
                   y = (v & 0x000FC0) >> 6
                   z = v & 0x00003F
                   w = math.floor(modulo(v, 0x200000) / 262144)
                   x = math.floor(modulo(v, 0x040000) / 4096)
                   y = math.floor(modulo(v, 0x001000) / 64)
                   z = modulo(v, 0x000040)
                   result = result .. string.char(0xF0 + w, 0x80 + x, 0x80 + y, 0x80 + z)
                end
             end
          end
          return result
       end
    or maybe this: (?)
    function unichr(ord)
        if ord == nil then return nil end
        if ord < 32 then return string.format('\\x%02x', ord) end
        if ord < 126 then return string.char(ord) end
        if ord < 65539 then return string.format("\\u%04x", ord) end
        if ord < 1114111 then return string.format("\\u%08x", ord) end
    end
    from http://stackoverflow.com/questions/7780179/what-is-the-way-to-represent-a-unichar-in-lua
    R

  • RETURN statement "kills" my BSP event handling

    Hi,
    I've gone through [this|Downloaded Excel data is shown using Chinese characters (!); and everything went just fine. At the end of that code, to make my BSP react and finally display that popup, I had to insert a RETURN statement, and by doing so, the BSP virtually "dies": stops reacting to any ohter event, and finally makes me close the browser. This is the relevant section of my code:
    cFolders
    OnInputProcessing event
    response->set_data( data   = lv_xstring ).
    navigation->response_complete( ). " signal that response is complete
    return.
    Why is that happening? What could I do to avoid that behavior, and keep working my custom pushbutton functionality?
    Thanks in advance, hope someone could help me.
    Regards,
    Federico.

    Hi Frederico,
    I think there is a misunderstanding, what you want your application to do and what response_complete is used for.
    Do I understand your requirement right: You want a popup-window with excel content and in background-window the standard application should run unchanged?
    That doesn't work with response_complete in OnInputProcessing, because the statement is used to prevent creating the default response of a page in onLayout method
    If you use RETURN, the processing of your page is stopped and the response consists only of the content you filled in but not of any default page layout => excel appears but your application seems to be dead
    If you do not use RETURN, you navigate to another page (statement cl_cfx_util_ui=>navigate). As navigation in BSPs is realized by a browser redirect, a complete new request-response-zyklus is started => no excel appears, your response seems to be overwritten
    Possible solutions are:
    1. Instead of sending the response object back to the client, store it in the server-cache (method SERVER_CACHE_UPLOAD of class CL_HTTP_SERVER) in OnInputProcessing and open a new browser window with url of object in server-cache.
    OR
    2. Open a new browser window with url of a new custom bsp page and generate the response in onInitialization of the new custom page.
    Search the forum, you'll find a lot of examples how to use the server-cache and how to open a new window with javacript.
    Anyway: read also SAP help to understand the control flow of BSPs: [http://help.sap.com/saphelp_nw70/helpdata/en/a3/4b9afa7aa511d5992e00508b6b8b11/frameset.htm] 
    Best regards,
    CW

  • Regular Expressions and string handling

    I'd like to be able to make a method that takes a String and removes certain substrings from that string. What I'm doing is that I'm getting some text from the internet (an HTML doc) and I'd like to remove all the tags from it.
    my method is:
         String DeTokenString(String s)
    String t=new String(s.replaceAll("<regex>",""));
              return t;
    What would I put in place of <regex> to remove all html tags? s has already had its leading and following whitespace removed elsewhere with .trim() before being passed to DeTokenString.
    Is there any other simple way to accomplish this?

    It does on whatever manages to get through my 17
    firewall, hand-woven packet destroyers, and
    titanium-lead armor.So! That is your final defense mechanism. Bwah hah hah hah hah! Now I have you. That was all I needed to improve my 17-firewall-sneaking-through, hand-woven-packet-destroyer-unweaving, titanium-lead-armor-piercing virus!
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • JTextArea methods + String Handling

    Hi There,
    My Question was, that i have made a small text editor application, and i was hoping that some one could tell me how to add the text, which is opened in a JTextArea to a Vector (or another data structure if this is more appropriate), which i can then parse using Regular expressions??
    Also, could u point me in the direction of a resource that has examples of how to use regular expressions in java 1.4 (util.regex)?
    Thanks in advance,
    much appreciated!

    I'd use getText() and put the text in a String, like the previous poster said. From there you can parse the string using the Pattern and Matcher objects.
    Here's a link that has some examples of regular expressions:
    http://developer.java.sun.com/developer/technicalArticles/releases/1.4regex/

  • Output String Handling in Java

    Hi, guys...............
    How can I format my output I have a long text formula which consist of alot of "()","{ }" "[ ]" and some other special char. I want to see in a readable format. This output formula is approximately you can say 1 or 2 pages but there is no any space or a break line e.g. [sdsadadfdfsdffwesdfsdfsdf{sdsdddsd^afasdfadfsdfasdfasdfasdf(asdfaf(asfasdfbvdcbyrey)eyydfhghghshgfghfg)fghfghfg}hfg]hfg$sdfsdfsdfsdg[fsdgdfhd{[dsfassd{sdfsgsggdfbergdfvgg}dfgdfgdfgdfg]gdfgdfgdfgdfgdg(hfghfghsdfhgasdfasdffdghdfhbdfgd^sdfgasdfgdfgdfgdfbsd|dfsdggdfgdfhdgh)dfhdfh}dfhdfhvnbvbnmghmjyky] and so on.....upto more than 1 page. so how can I control my string. which is readable for me.
    kind regards
    for replying
    merry

    Do you actually want to read a couple of pages of text without white space?
    If the bracket things nest you could output them like code (with the content nested):
       sdsetc {
          asadddetc
          ^
          asasdsetc
       hfg
    ]It's never going to be easy to read, however.

  • RealServer plugin bad string-handling

    Having had trouble with the RealServer plugin for a couple of days we have finally got it to work on Oracle 9i database and Realserver 8.
    In rmserver.cfg, we had a list with a <Var Database> tag that contained many lines, with newlines, tabs and spaces.
    <List Name="Oracle DB system select">
    <Var Database="
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = SULE22)(PORT = 1521))
    (CONNECT_DATA =
    (SID=tennis.idi.ntnu.no)
    "/>
    </List>
    This didn't work, however, when we changed it to be on one line as in:
    <List Name="Oracle DB RealVideo movie">
    <Var Database="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sule22.idi.ntnu.no)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=dipvideo.idi.ntnu.no)(INSTANCE_NAME=dipvideo)))"/>
    </List>
    it worked.
    We don't know if it was the newlines (Windows/UNIX encoding), the Tab-characters or the spaces that triggers this difficult-to-find bug, but we suspect one of the first.

    Hmmmm, probably a problem with the parsing of an XML document by realserver. A plugin gets the values from a realServer api, not by parsing XML. Normally newlines in an XML attribute are normalized to whitespace by an XML parser.

  • Handling HTMLB events in BSPs???

    Hi all,
    can anybody tell me the how to handel events in BSPs??

    Hi Aravind,
    Follow the link  /people/brian.mckellar/blog/2004/07/28/bsp-programming-handling-htmlb-events u can understand.

  • What's different between event handle by bsp frame & MAC

    Hi,
    Can anyone know the different between event handle by BSP frame & handle by MAC?
    and how to know which event is handle by BSP frame or MAC?
    thanks
    Gang

    Hi Abdul,
    So that means the add_entry event is standard event handle by BSP frame.
    thanks
    Gang

  • BSP(Business Server Page) in ABAP

    Hi Sapient
    I would like to knw how to use BSP (Busines Server Pages) wats the tcode and to navigate thru it?
    Pls explain
    Rewards of helpful answer
    Regards
    Santosh.

    Hi,
    to work on BSP's , goto SE80 transaction(object navigator),
    and select BSP Application from the dropdown list provided.
    and here u can create BSP application.
    and by using the tagbrowser u can use html/htmlb tags for writing the code.
    --->
    BSP Concepts
    Application Class
    The application class, is a regular ABAP Objects class, that can be assigned to the BSP application, to ebcapsulate the BSP logic ans store data and make it available across BSP pages. This data is stored as attributes.
    The only requirement for an application is that the constructor is parameter-less. If not, the application class cannot be generically instantiated by the BSP runtime environment.
    The global object application can be used in the BSP application to access the attributes and methods of the application class.
    You do not have to use an application class in your BSP application. It is an optional way for you to structure your BSP application .
    The application class is assigned to the properties of the BSP application:
    Application Basis Class CL_BSP_APPLICATION
    If an application class does not already have a super class, it can be derived from the predefined base class CL_BSP_APPLICATION. This class provides methods that are typically required by a BSP application for embedding in a Web environment. This is how information about the current BSP application (such as session timeout, current URL of BSP application, state mode, and so on) can be called or set.
    As the application object is an application attribute in every BSP event handler, the methods of the CL_BSP_APPLICATION class are also available with the corresponding inheritance. This makes it easy to provide the relevant functionality to lower application levels using a single object reference
    Using the application class in an event
    The application class is used just as an ordinary class
    CALL METHOD application->kunde_gettable
    IMPORTING
    kunde_table = i_zkunder.
    Statefull/Stateless
    Statefull
    A stateful BSP application is executed like a normal SAP transaction, – independent of all user interactions - in one single context (roll area). This means that data specified by the user during the application execution or data determined by the application itself is available potentially throughout the entire execution duration of the session.
    Stateless
    Stateless BSP applications only block resources on the SAP Web Application Server during the time one single request is being processed. When the request has been processed, all resources in particular the application context are returned to the system for use in other requests.
    Statefull or Stateless ?
    As a rule of thumb, it is recommended that Internet scenarios used at the same time by a large number of users operate in stateless mode. Stateful programming is recommended for more complex applications that are used by a limited number of users in parallel and that operate with data that is expensive to determine.
    BSP Tips and Tricks
    How to use form fields in the event handler
    This examples shows how to read the value of a form field, and use it in an event handler.
    The user keys in the field zzkunnavn in the form nand presses then Save button.
    Layout
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <html>
    <title>Use form field</title>
    <h1>Use form field</h1>
    <body> <form method = "post" name="x">
    <input type="text" size="50" maxlength="50"
    name="zzkunnavn">
    <input type=submit name="onInputProcessing(save)"
    value="Save">
    </form>
    </body>
    </html>
    Page attributes
    The field zzkunnavn must be defined in the Page attributes of the screen
    Event handler OnInputProcessing
    CASE event_id.
    data: l_kunnavn type string.
    WHEN 'save'.
    Sets value of parameters, i.e. gets value from screen
    navigation->set_parameter( name = 'zzkunnavn').
    Gets value of parameter, so can be moved into abap field
    Note: zzkunnavn declared in page attributes
    l_kunnavn = navigation->get_parameter( name = 'zzkunnavn').
    Regards,
    vineela.
    Edited by: Radha Vineela Aepuru on Mar 12, 2008 8:12 AM

  • GUI_DOWNLOAD inside a BSP METHOD

    Hi all!
    I have a BSP application and, in the application class, I have a method named TXT_FACTURA.
    Inside of it, I need to save a txt file to local machine, so I tried to use the FM:
    GUI_DOWNLOAD
    or
    WS_DOWNLOAD
    but when the BSP arrives to execute this FM, a HTTP 500 error raise me... anybody knows why???
    I tested this FM with the same data in a separated report, and all is ok!
    Thanks!

    You cant use GUI_DOWNLOAD or WS_DOWNLOAD in BSP.
    Look at the below link to know how to upload & download..
    /people/thomas.jung3/blog/2004/08/09/bsp-download-to-excel-in-unicode-format
    /people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table
    /people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
    <i>*Reward each useful answer</i>
    Raja T

  • File download via BSP using different SAP versions

    Hi Everyone,
    I have been using code based on Brian McKellar's excellent Blog (/people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents). The code works great in the following system:
    SAP_BASIS     620     0038     SAPKB62038     SAP Basis Component
    SAP_ABA     620     0038     SAPKA62038     Cross-Application Component
    However i am now trying the same code in our new 7.00 SAP system which is a
    SAP_ABA     700     0013     SAPKA70013     Cross-Application Component
    SAP_BASIS     700     0013     SAPKB70013     SAP Basis Component
    When I try it in our 7.00 system, the download does not work. It tells me that the document is incomplete or corrupted.
    Specifically the code that is being used is as follows:
    data: cached_response type ref to if_http_response,
           lv_xlen type i,
           lv_guid type guid_32.
    create object cached_response
           type cl_http_response exporting add_c_msg = 1.
    lv_xlen = xstrlen( lv_xstring ).
    cached_response->set_data( data   = lv_xstring
                        length = lv_xlen ).
    cached_response->set_header_field(
          name  = if_http_header_fields=>content_type
          value = lv_mtype_string ).
    cached_response->set_status( code = 200 reason = 'OK' ).
    cached_response->server_cache_expire_rel( expires_rel = 120 ).
    call function 'GUID_CREATE'
      importing
        ev_guid_32 = lv_guid.
    concatenate runtime->application_url '/' lv_guid '.'
                lv_doc_hdr-obj_type
                into lv_cached_url.
    cl_http_server=>server_cache_upload( url      = lv_cached_url
                                         response = cached_response ).
    call method runtime->server->response->redirect( url = lv_cached_url ).
    navigation->response_complete( ). " signal that response is complete
    So now I have a choice: I can log an OSS but I doubt SAP will help as this is 'custom code'. It is in our Z BSP.
    Can anyone suggest how I can even begin to debug this issue?
    Regards,
    Alon

    i tried the following code on a WAS 7.00 SP14 and it works as expected.
    create object cached_response type cl_http_response exporting
      add_c_msg = 1.
        cached_response->set_data( file_content ).
        cached_response->set_header_field( name  =
      if_http_header_fields=>content_type
                                           value = file_mime_type ).
        cached_response->set_status( code = 200 reason = 'OK' ).
        cached_response->server_cache_expire_rel( expires_rel = 180 ).
        call function 'GUID_CREATE'
          importing
            ev_guid_32 = guid.
        concatenate runtime->application_url '/' guid into display_url.
        cl_http_server=>server_cache_upload( url      = display_url
                                             response = cached_response ).
    call method runtime->server->response->redirect( url = display_url ).
    navigation->response_complete( ).

Maybe you are looking for