ABAP Substring?

Hi,
I'm looking for a substring command in ABAP.
I have a string like this...
text = 'hello, how are you today'.
Here's my goal...
I want to separate my string at the 10th character into two strings (text1 and text2).
so the result would be
text1 has the value 'hello, how'
text2 has the value ' are you today'
of course, the characters in the string 'text' will vary.
Can anyone help?
Thanks.
Audrey

Hi Audrey
You can use offset and length additions.
DATA lv_str TYPE string .
lv_str = 'hello, how are you today' .
write:/ lv_str+7 ,
      / lv_str+7(3) ,
      / lv_str(7) .
The output should be:
how are you today
how
hello,
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Similar Messages

  • ABAP Substring function from right side

    Hi,
    I want a substring function in ABAP, which starts from right instead of left to display some character out of a complete string.
    Suppose there is a variable zdatavar -
    zdatavar = 'MyNameIsBush'.
    zdatavar = zdatavar+4(2).
    The above will start from the left.
    I want some function which start from the right.
    Your help will be greately appreciated.
    Regards,
    SC

    Hi,
    Please check if this is working.
    REPORT  Z0804.
    DATA str TYPE STRING.
    DATA str2 TYPE STRING.
    str = 'MyNameIsBush'.
    WRITE: / str.
    PERFORM rsubstring
        USING
            str
            2
        CHANGING
            str2
    WRITE: / str2.
    FORM rsubstring
        USING
            str TYPE STRING
            len
        CHANGING
            out TYPE STRING
        DATA:
            strln TYPE i,
            l_offset TYPE i,
            l_len TYPE i
        strln = STRLEN( str ).
        if strln GE len.
        l_offset = strln - len.
        l_len = len.
        out = str+l_offset(l_len).
        endif.
    ENDFORM.
    result:
    MyNameIsBush
    sh
    regards,
    Xiang Li

  • Substring in ABAP?

    I have earlier worked with Java and wonder now if there is any function in ABAP like "substring"?

    output = month+4(2).
    Hope this helps. Many answered.
    In addition to that read this
    <u><b>Substring in SAP's ABAP programming</b></u>
    Unlike many of the higher level languages there is no stand-alone substring call. We have split, shift, replace, translate and condense but no substring. So if we want to know the first four characters from the start of a field how do we do it?
    The WRITE statement is what we use to substring a field. The syntax is as follows:
    WRITE fieldname+starting_position(field_length) to variable
    The fieldname is the source (or input). The plus sign precedes the starting position of the substring. IMPORTANT The traditional method of counting on computers is followed. The first position in the string is 0. Immediately after (no space) comes the length of the substring you are going to use. You can also substring the variable that you are writing the string to (the target). I have included an example that illustrates substringing on the source and target fields.
    A real-life use of the substring functions
    I needed to build a character date field for a cross-platform integration project I was working on. First, I defined the date field:
    data: datechar(10).
    To build the date lets use sy-datum, which has the current system date.
      write SY-DATUM+4(2) to datechar+0(2).
      write '/' datechar+2(1).
      write SY-DATUM+6(2) to datechar+3(2).
      write '/' TO datechar+5(1).
      write SY-DATUM+0(4) to datechar+6(4).
    Value of SY-DATUM 20010616
    Here's how the field changes with the execution of each line.
    06________
    06/_______
    06/16_____
    06/16/____
    06/16/2001
    This is just one of the great functionalities of WRITE.
    http://goldenink.com/abap/
    Kindly reward points and close the thread.

  • ABAP: search substring on string

    Hi,
    is there any ABAP function to validate if a substring appears on a string ?, something like:
    - 'world' into 'Hellow worldXX'  =>  TRUE
    - 'world' into 'The working..'   =>  FALSE
    thanks

    Does this help ...
    CA (Contains Any):
    c1 contains at least one character from the string c2.
    If c1 or c2 is of type C, the comparison takes into account the full length of the field, including blanks at the end.
    If c1 or c2 is of type STRING and empty, the result of the comparison is always negative.
    If the result of the comparison is positive, the system field SY-FDPOS contains the offset of the first character in c1 which is also in c2.
    If the result of the comparison is negative, the system field SY-FDPOS contains the length of c1.
    The comparison is case-sensitive.
    Examples:
    'ABCDE' CA 'CY' is true; SY-FDPOS = 2.
    'ABCDE' CA 'XY' is false; SY-FDPOS = 5.

  • How to Substr field in SAP Query.

    Dear Developer,
    How to substr any field in SAP Query ?
    Regards,
    Ujed.

    Hi Ujed,
    if SUBSTR stands for substring, then possibly your question may be how to get the substr method as konown in languages like php in ABAP.  If SAP Query points to a SAP query as created in transaction SQ01, then you should explain what you want to achieve.
    Note: Better ask a specific question and get am answer you can or which is already generalized.
    If I need a substr function, I'd create a functional method for that:
    method substr
      importing
        anyfield type any
        offset type i
        length type i
      returning substring type string.
      try.
        substring = anyfield+offset(length).
      catch cx_root.
    * handle error
      endtry.
    endmethod.
    Regards,
    Clemens

  • Mapping string to n substring and then to m subsubstrings

    Hi,
    I need some advice/input for a mapping.
    MT_Source            Occurence
       ROW                  1
          Customer         1
          Article              1
    MT_Target
       ROW                   1:n
          Customer          1
          field1                 1
          field2                 1
          field3                      1
    Article field from source is a string of N-times 5 characters
    Requirements for mapping are:
    The target structure must have N rows
    Then the string must be substringed to N-strings
    Each field1,2,3 is substring of one substring.
    Example
    MT_Source looks like:
    <row>
    customer is X
    article is string "12345ABCDE"
    </row>
    MT_Target must be like:
    <row>
    customer X
    field1       12
    field2       34
    field3       5
    </row>
    <row>
    customer X
    field1       AB
    field2       CD
    field3       E
    </row>
    Can it be done with graphical mapping and udf?
    Or is it better to do it all in one XSLT or JAVA or ABAP mapping?
    Any coding examples u can give are much appreciated.
    Kr
    Robert

    Hi Anand, Sarvesh,
    First of all: thx a lot for all your valuable inputs.
    The only issue left for me was the customer. Just Copyvalue never worked because in source structure there is one and only one value, and it never became two.
    I've solved this also inside my UDF now. I've added one input (var2) and one output (result5) it and looks like this now:
    public void allinONE(String[] var1, String[] var2, ResultList result1, ResultList result2, ResultList result3, ResultList result4, ResultList result5, Container container) throws StreamTransformationException{
    int test=var1[0].length();
    test=test/5;
    for(int i=0;i<test;i++){
         result1.addValue("");
        result5.addValue(var2[0]);
        result5.addContextChange();
    String str="";
    for(int j=0;j<test;j++)
    str=var1[0].substring(j*5,(j*5)+5);
    result2.addValue(str.substring(0,2));
    result3.addValue(str.substring(2,4));
    result4.addValue(str.substring(4,5));
    result2.addContextChange();
    result3.addContextChange();
    result4.addContextChange();
    This gets me exactly the output i need.
    Again thx for the input
    I'll keep exploring
    kr
    Robert

  • Substring in script logic

    Hi,
    We have a customer dimension, where we can extract a lot of information. However the information depends on the sales organization.
    Since the client currently have 30 sales organization and we can deduct information like: billing currency, sold-to-country and profitcenter from the combination of sales organization and customer this means I have to create 90 properties to hold this information (30 salesorg * 3 informations pr salesorg).
    Therefore I would like to concatenate the information in 1 property per sales organization. This however means I have to be able to make a substring on the property, e.g. in a select statement to retreive the relevant information (it is not possible to do it in the report, since the properties hold information I need to save the data).
    Does anyone know if this is possible?
    Thanks,
    Lars

    Hi Lars -
    Sorry, string manipulation commands are not available in script Logic.  You will need to call a BAdI from script logic and use the rich string manipulation tools available in ABAP.
    Regards,
    Sheldon

  • How to compare substring in two tables fields

    Hi ABAP expert,
    When I want to select database two tables, we just want to compare two table substring. For Example, both fields have yyyymmdd. But I have interested yyyymm. In the Oracle database and SQL server database, I can easily to use substr to achieve those goals. How in the ABAP program to archive those goals.
    Thanks in advance,
    Cliff Fan

    Hi you can access substrings in ABAP the following way:
    data: s type string value 'yyyymmdd'.
    write: / s(6). "yyyymm
    write: / s+4(4). "mmdd
    so the number after '+' determines the position in the string and the number in parenthesis () determines the length of the substring.
    Now you can just loop over both of your tables and perform the necessary comparison in the nested loop.

  • Using ABAP Proxies

    Hi all,
    I am trying to achieve the following scenario:
    Read a file from a specific directory and directly insert the records into the SAP table by using ABAP proxies.
    But during execution, I am getting the following error:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="INTERNAL">HTTP_RESP_STATUS_CODE_NOT_OK</SAP:Code>
      <SAP:P1>405</SAP:P1>
      <SAP:P2>Method not allowed</SAP:P2>
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html dir=ltr> <head> <style> a:link a:visited </style> <META NAME="ROBOTS" CONTENT="NOINDEX"> <title>The page cannot be displayed</title> <META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252"> </head> <script> function Homepage(){ <!-- // in real bits, urls get returned to our script like this: // res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm //For testing use DocURL = "res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm" DocURL=document.URL; //this is where the http or https will be, as found by searching for :// but skipping the res:// protocolIndex=DocURL.indexOf("://",4); //this finds the ending slash for the domain server serverIndex=DocURL.indexOf("/",protocolIndex + 3); //for the href, we need a valid URL to the domain. We search for the # symbol to find the begining //of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker. //urlresult=DocURL.substring(protocolIndex - 4,serverIndex); BeginURL=DocURL.indexOf("#",1) + 1; urlresult=DocURL.substring(BeginURL,serverIndex); //for display, we need to skip after http://, and go to the next slash displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex); InsertElementAnchor(urlresult, displayresult); } function HtmlEncode(text) { return text.replace(/&/g, '&').replace(/'/g, '"').replace(/</g, '<').replace(/>/g, '>'); } function TagAttrib(name, value) { return ' 'name'="'HtmlEncode(value)'"'; } function PrintTag(tagName, needCloseTag, attrib, inner){ document.write( '<' + tagName + attrib + '>' + HtmlEncode(inner) ); if (needCloseTag) document.write( '</' + tagName +'>' ); } function URI(href) { IEVer = window.navigator.appVersion; IEVer = IEVer.substr( IEVer.indexOf('MSIE') + 5, 3 ); return (IEVer.charAt(1)=='.' && IEVer >= '5.5') ? encodeURI(href) : escape(href).replace(/%3A/g, ':').replace(/%3B/g, ';'); } function InsertElementAnchor(href, text) { PrintTag('A', true, TagAttrib('HREF', URI(href)), text); } //> </script> <body bgcolor="FFFFFF"> <table width="410" cellpadding="3" cellspacing="5"> <tr> <td align="left" valign="middle" width="360"> <h1 style="COLOR:000000; FONT: 13pt/15pt verdana"><!Problem>The page cannot be displayed</h1> </td> </tr> <tr> <td width="400" colspan="2"> <font style="COLOR:000000; FONT: 8pt/11pt verdana">The page you are looking for cannot be displayed because the page address is incorrect.</font> </td> </tr> <tr> <td width="400" colspan="2"> <font style="COLOR:000000; FONT: 8pt/11pt verdana"> <hr color="#C0C0C0" noshade> <p>Please try the following:</p> <ul> <li>If you typed the page address in the Address bar, check that it is entered correctly.<br> </li> <li>Open the <script> <! if (!((window.navigator.userAgent.indexOf("MSIE") > 0) && (window.navigator.appVersion.charAt(0) == "2"))) { Homepage(); } //--> </script> home page and then look for links to the information you want.</li> </ul> <h2 style="COLOR:000000; FONT: 8pt/11pt verdana">HTTP 405 - Resource not allowed<br> Internet Information Services</h2> <hr color="#C0C0C0" noshade> <p>Technical Information (for support personnel)</p> <ul> <li>More information:<br> <a href="http://www.microsoft.com/ContentRedirect.asp?prd=iis&sbp=&pver=5.0&pid=&ID=405&cat=web&os=&over=&hrd=&Opt1=&Opt2=&Opt3=" target="_blank">Microsoft Support</a> </li> </ul> </font></td> </tr> </table> </body> </html></SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>HTTP response contains status code 405 with the description Method not allowed XML element Envelope missing in SOAP message header (SAP XI Extension)</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Could anyone please help me in this regard?
    Thank you in anticipation.

    Use this 3 blogs for proxies.
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies(do the required configuration for activating proxies)
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies(server proxies)
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy(client proxies)

  • ABAP code for character search

    Hello Gurus
    I have a variable e.g. lv_txtsh which is meant to store a string. Now I want to parse through lv_txtsh and find if it contains a character "x".  The length of the string stored in lv_txtsh is going to be dynamic. Can you please help me to code this scenario in ABAP OO (the new version of ABAP)
    Any help is appreciated and points will be assigned.
    Thanks,
    Rishi

    Hi,
    Pease go through this. You will get an idea.
    FIND
    Syntax
    FIND [{FIRST OCCURRENCE}|{ALL OCCURRENCES} OF] pattern
      IN [section_of] dobj
      [IN {BYTE|CHARACTER} MODE]
      [{RESPECTING|IGNORING} CASE]
      [MATCH COUNT  mcnt]
      { {[MATCH OFFSET moff]
         [MATCH LENGTH mlen]}
      | [RESULTS result_tab|result_wa] }
      [SUBMATCHES s1 s2 ...].
    Extras:
    1. ... {FIRST OCCURRENCE}|{ALL OCCURRENCES} OF
    2. ... IN {BYTE|CHARACTER} MODE
    3. ... {RESPECTING|IGNORING} CASE
    4. ... MATCH COUNT mcnt
    5. ... MATCH OFFSET moff
    6. ... MATCH LENGTH mlen
    7. ... RESULTS result_tab|result_wa
    8. ... SUBMATCHES s1 s2 ...
    Effect
    : The data object dobj is searched for the byte or character sequence specified by the search string pattern. The addition OCCURRENCE[S] determines whether only the first, or all occurrences are searched. The addition section_of can be used to restrict the search range. The addition CASE is used to determine whether upper/lower case is taken into account in the search. The additions MATCH, SUBMATCHES, and RESULTS are used to determine the number, position, and length of the found sequence(s).
    The search is ended when the search string is found for the first time or when all the search strings in the search range have been found, or when the end of the search range is reached. The user is informed of the search result by setting sy-subrc.
    In character string processing, the closing blanks are taken into account in data objects dobj of fixed length.
    Note
    The statement FIND IN TABLE is available for searching in internal tables.
    System fields
    sy-subrc Meaning
    0 The search string was found at least once in the search range.
    4 The search string was not found in the search range.
    8 The search string contains an invalid double-byte character in character string processing.
    Addition 1
    ... {FIRST OCCURRENCE}|{ALL OCCURRENCES} OF
    The optional addition {FIRST OCCURRENCE}|{ALL OCCURRENCES} OF determines whether program only searches for the first occurrence, or all occurrences of the search string. If the addition FIRST OCCURENCE, or none of the additions is specified, only the first occurrence is found. Otherwise, all occurrences are found.
    If sub_string is an empty string in the pattern or is of type c, d, n or t and only contains blank characters, when searching for the first occurrence, the space in front of the first character or byte of the search range is found. If searching for all occurrences, in this case the exception CX_SY_FIND_INFINITE_LOOP is triggered.
    If regex contains a regular expression in pattern that matches the empty character string, the search for one occurrence also finds the space before the first character. When searching for all occurrences, in this case, the search finds the space before the first character, all intermediate spaces that are not within a match, and the space after the last character.
    Addition 2
    ... IN {BYTE|CHARACTER} MODE
    Effect
    : The optional addition IN {BYTE|CHARACTER} MODE determines whether byte or character string processing takes place. If the addition is not specified, character string processing is performed. Depending on the processing type, dobj and sub_string in pattern must be byte-like or character-type. If regular expressions are used in pattern, only character string processing is permitted.
    Addition 3
    ... {RESPECTING|IGNORING} CASE
    Effect
    : This addition is only permitted for character string processing. It determines whether upper/lower case is taken into account in pattern and dobj when searching. If RESPECTING CASE is specified, the text is case-sensitive, and if IGNORING CASE is specified, the text is not case-sensitive. If neither of the additions is specified, RESPECTING CASE is used implicitly. If a regular expression is entered for pattern as an object of the class CL_ABAP_REGEX, this addition is not permitted. Instead, the properties of the object are taken into account in the search.
    Addition 4
    ... MATCH COUNT mcnt
    Effect
    : If the search string pattern is found in the search range, the addition MATCH COUNT stores the number of found locations in the data object mcnt. If FIRST OCCURRENCE is used, this value is always 1 if the search is successful. For mcnt, a variable of the data type i is expected. If the search is unsuccessful, mcnt is set to 0.
    Addition 5
    ... MATCH OFFSET moff
    Effect:
    If the search string pattern is found in the search range, the addition MATCH OFFSET stores the offset of the last found location in relation to the data object dobj in the data object moff. If FIRST OCCURRENCE is used, this is the offset of the first found location. For moff, a variable of the data type i is expected. If the search is not successful, moff contains its previous value.
    Note
    : The system field sy-fdpos is not supplied by FIND.
    Addition 6
    ... MATCH LENGTH mlen
    Effect:
    If the search string pattern is found in the search range, the addition MATCH LENGTH stores the length of the last found substring in the data object mlen. If using FIRST OCCURRENCE, this is the length of the first found location. For mlen, a variable of data type i is expected. If the search is not successful, mlen contains its previous value.
    Addition 7
    ... RESULTS result_tab|result_wa
    Effect:
    If the search string pattern is found in the search range, the addition RESULTS stores the offsets of the found locations, the lengths of the found substrings, and information on the registers of the subgroups of regular expressions, either in an internal table result_tab or in a structure result_wa.
    The internal table result_tab must have the table type MATCH_RESULT_TAB, and the structure result_wa must have the type MATCH_RESULT from the ABAP Dictionary. The line type of the internal table is also MATCH_RESULT.
    When an internal table is entered, this is initialized before the search and a line is inserted in the table for every match found. When a structure is entered, this is assigned the values of the last found location. If FIRST OCCURRENCE is used and the search is successful, only one line is inserted in the internal table.
    The line or structure type MATCH_RESULT has the following components:
    OFFSET of type INT4 for the offset of the substring
    LENGTH of type INT4 for the length of the substring
    SUBMATCHES of table type SUBMATCH_RESULT_TAB with the line type SUBMATCH_RESULT for the offset and length of the substrings of the current found locations that are stored in the registers of the subgroups of a regular expression.
    The lines of result_tab are sorted according to the columns OFFSET and LENGTH. An additional component LINE is only important in the variant FIND IN TABLE.
    Following an unsuccessful search, the content of an internal table result_tab is initial, while a structure result_wa contains its previous value.
    Note
    The addition RESULTS is particularly suitable for use with the addition ALL OCCURRENCES when specifying a table, and for use with the FIRST OCCURRENCE when specifying a structure.
    Example:
    The following search for a regular expression finds the two substrings "ab" at offset 0 and "ba" at offset 2, and fills the internal table result_tab with two rows accordingly. As the regular expression contains three subgroups, the component submatches contains three lines in each case. The first line of submatches refers to the outermost bracket, the second line refers to the first internal bracket, and the third line refers to the second internal bracket. For the first found location, the first and second lines contains the offset and length while the third line is undefined. For the second found location, the first and third lines contains the offset and length, while the second line is undefined.
    DATA: result_tab TYPE match_result_tab.
    FIND ALL OCCURRENCES OF REGEX `((ab)|(ba))`
         IN 'abba'
         RESULTS result_tab.
    Addition 8
    ... SUBMATCHES s1 s2 ...
    Effect:
    This addition is only permitted if a regular expression is used in pattern. The current contents of the register of subgroups of the regular expression for the current found location are written to the variables s1, s2, ..., for which a character-type data type is expected. When ALL OCCURRENCES is used, the last found location is evaluated. If more variables s1, s2, ... are listed than subgroups are available, the superfluous variables are initialized. If fewer variables s1, s2, ... are listed than subgroups are available, the superfluous subgroups are ignored.
    Example
    : The regular expression after REGEX has two subgroups. The search finds the substring from offset 0 of length 14. The content of the register of the subgroups is "Hey" and "my".
    DATA: text TYPE string,
          moff TYPE i,
          mlen TYPE i,
          s1   TYPE string,
          s2   TYPE string.
    text = `Hey hey, my my, Rock and roll can never die`.
    FIND REGEX `(\w)\W\1\W(\w)\W+\2`
         IN text
         IGNORING CASE
         MATCH OFFSET moff
         MATCH LENGTH mlen
         SUBMATCHES s1 s2.
    Reward points if helpful.
    Thanks and Regards.

  • ABAP Code + API

    Hello Friends,
    I have to write a method in ABAP equivelent to java method, here is the jave source code.
    private String constructID(String id)
        StringBuffer str = new StringBuffer("0000000000");
        str.append(id);
        return str.substring(id.length());
    (Just explain shortly what it is doing!)
    I am trying to call the BAPI (BAPI_BUPA_CENTRAL_GETDETAIL), and in oder to call this BAPI I have to export the BUSINESSPARTNER parameter. This parameter has been stored in DB with 10 char e.g 0000000001 . As I am developing web interface so the user can enter BUSINESSPARTNER No = 1, and this java code will map the user enter 1 to 0000000001.
    I want to ask, is there online API avaiable for ABAP which helps me to write this equivelent code or is there any method like append() or subString() in ABAP ( as I am very new to ABAP so please excuse me if I bothers you )
    Many thanks!
    Marek.

    If I understand correctly, you need to make "1" look like "0000000001" using ABAP code.   Try the following code.  This should work for you.
    Regards,
    Rich Heilman
    report zrich_0004 .
    data: char(10) type c value '1'.
    data: numc(10) type n.
    numc = char.
    write:/ char.
    write:/ numc.

  • Reading BLOB in Native SQL from ABAP program

    Hello,
    I'm trying to read content of a BLOB field from a table with Native SQL in ABAP like this:
    DATA: l_bytes type xstring.
    EXEC SQL.
      SELECT bytes INTO :l_bytes FROM tablename
    ENDEXEC.
    But when I'm using xstring it returns only 32768 bytes. When using type x length 65000 for l_bytes it returns 65000 bytes, but x is limited to 65535 bytes only. So why it returns only 32768 bytes in direct sql? For DB2 I found note 610342 where you need to add \lob to the statement, I tried with Oracle but doesn't work.
    DATA: CLOB_VAR TYPE STRING.
    DATA: BLOB_VAR TYPE XSTRING.
    EXEC SQL.     
      SELECT FCLOB, FBLOB FROM ZZTAB        INTO :CLOB_VAR\lob, :BLOB_VAR\lob
    ENDEXEC.
    Regards
    Markus

    Hi Markus,
    you have to read it in chunks (remember a blob could be up to 4 Gbyte!).
    I assume you store the byte stream in the field (no bfile pointer to a file ).
    Give you a pseudocode that you get the picture.
    Would recommend that you read the Oracle manual (db Version?)
    9i
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_lob2.htm#1008611
    10g
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#ARPLS600
    chunksize = 32768 .  " or use 65000 . This is the amount of the blob part you want to read
    offset = 1.
    *get the row of interest and retrieve blob's length
    Exec sql.
    select  dbms_lob.getlength(your_blob)  :blob_length from blob_table where my_primary_key = 1
    end exec.
    *calculate times to read from blob  until the end (well, leave the adjustment to you
    * in case of an uneven  fraction)
    ntimes = blob_length / chunksize .
    Do ntimes
    *loop and get the chunks into your variable:
    * start reading from offset chunksize of bytes
    exec sql.
    select dbms_lob.substr(your_blob, :chunksize,:offset) into  :xblobvar  from blob_table
    where my_primary_key = 1
    endexec.
    *don't know what you want to do with the blob chunk...
    *process  :xblobvar
    offset = chunksize * ntimes .
    enddo.
    bye
    yk

  • Forming generic sql query   for joining multiple sap tables in ABAp

    Hi,
    I am new to this abap field ,facing an issue onsap-jco project . I have used RFC_READ_TABLE  FM ,Customized this FM but facing an issue how to write generic  open SQl select statement  for joining multiple tables  using RFC_READ_TABLE .Kindly help on this issue.
    Thanks.

    something like this? If your tuples are not single columns, then you'll have to use dynamic sql to achieve the same result.with
    table_1 as
    (select '|Xyz|Abc|Def|' tuple from dual
    table_2 as
    (select '|Data1|Data21|Data31|Data41|Data51|' tuple from dual union all
    select '|Data2|Data22|Data32|Data42|Data52|' tuple from dual union all
    select '|Data3|Data23|Data33|Data43|Data53|' tuple from dual union all
    select '|Data4|Data24|Data34|Data44|Data54|' tuple from dual union all
    select '|Data5|Data25|Data35|Data45|Data55|' tuple from dual
    select case the_row when 1
                        then tuple
                        else '|---|---|' || substr(tuple,instr(tuple,'|',1,3) + 1)
           end tuple
      from (select substr(a.tuple,instr(a.tuple,'|',:one_one),instr(a.tuple,'|',:one_one + 1)) ||
                   substr(a.tuple,instr(a.tuple,'|',1,:one_two) + 1,instr(a.tuple,'|',1,:one_two + 1) - instr(a.tuple,'|',1,:one_two)) ||
                   substr(b.tuple,instr(b.tuple,'|',1,:two_one) + 1,instr(b.tuple,'|',1,:two_one + 1) - instr(b.tuple,'|',1,:two_one)) ||
                   substr(b.tuple,instr(b.tuple,'|',1,:two_two) + 1,instr(b.tuple,'|',1,:two_two + 1) - instr(b.tuple,'|',1,:two_two)) tuple,
                   rownum the_row
              from table_1 a,table_2 b
    order by the_rowRegards
    Etbin
    Message was edited by:Etbin
    user596003

  • SUBSTRING

    In the select query how to search for a particular part of data. (in ABAP code)
    Table         : ABC
    Field name    : Category
    Field content : Enterprise.
    Query : Select * from ABC where substr(category,1,3) ='Ent'.
    [The query should check the complete table ABC and list all the category where the first three characters are = 'Ent']

    Hi,
    Query : Select * from ABC where category like '%Ent%'.
    More info about LIKE in the SAP documentation:
    f [NOT] LIKE g
    Addition:
    ... ESCAPE h
    Effect
    The condition is met for a table entry if the statement "f (does not) equal the pattern in g" is true for the values of f and g. f must always be a field descriptor, and g an ABAP field or an ABAP string. If f has the value NULL, then the result of the check for the statement is unknown. Within a pattern, there are two special characters:
    '_' (underscore) stands for any single character.
    '%' (percentage sign) stands for any sequence of characters, including an empty string.
    Examples
    Example to select all customers whose name begins with 'M':
    DATA SCUSTOM_WA TYPE SCUSTOM.
    SELECT ID NAME FROM SCUSTOM
           INTO CORRESPONDING FIELDS OF SCUSTOM_WA
           WHERE NAME LIKE 'M%'.
      WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.
    ENDSELECT.
    Example to select all customers whose name contains 'huber':
    DATA SCUSTOM_WA TYPE SCUSTOM.
    SELECT ID NAME FROM SCUSTOM
           INTO CORRESPONDING FIELDS OF SCUSTOM_WA
           WHERE NAME LIKE '%huber%'.
      WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.
    ENDSELECT.
    Example to select all customers whose name does not contain 'n' as the second character:
    DATA SCUSTOM_WA TYPE SCUSTOM.
    SELECT ID NAME FROM SCUSTOM
           INTO CORRESPONDING FIELDS OF SCUSTOM_WA
           WHERE NAME NOT LIKE '_n%'.
      WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.
    ENDSELECT.
    Notes
    LIKE can only be used for alphanumeric database fields. In other words, table field f must have Dictionary type ACCP, CHAR, CLNT, CUKY, LCHR, NUMC, UNIT, VARC, TIMS or DATS. The comparison field g must always have type C.
    The maximum length of the pattern is 2n - 1 characters, where n is the length of field f.
    Trailing spaces are ignored in comparison field g. If a pattern contains trailing spaces, you must enclose it in single inverted commas ('). If your pattern is enclosed in inverted commas and you also want to include inverted commas as part of the pattern, the inverted commas in the pattern must be doubled.
    You cannot use this variant in the ON addition to the FROM clause.
    Thanks,
    Ramakrishna

  • WD ABAP and PORTAL: Logging the user out

    I have a requirement where I need to logout the user of my web dynpro abap application(the application resides in portal).
    I need to log him out of portal.
    How would I do that?
    Thanks in advance

    Deleting the Authentication in Logoff
    When you log off from some applications, the authentication of the user may also have to be reset in the browser, which means that a new authentication is needed when the application is called again. If basic authentication is used for the logon, this information can only be deleted in the browser with Internet Explorer 6.0 SP1 and higher.
    document.execCommand( 'ClearAuthenticationCache' );
    If an SSO2 cookie is used for the authentication, you can delete the cookie with JavaScript:
    function DelSso2Cookie(sName,sPath)
        var sso2Domain = location.hostname;
        if (location.hostname.indexOf(".")>0)
          sso2Domain = location.hostname.substr(location.hostname.indexOf(".")+1);
        p="";
        if(sPath)p=" path="sPath";";
          document.cookie = sName"=0; expires=Fri, 31 Dec 1999 23:59:59 GMT;"p + "domain="sso2Domain";";
    You can also include this JavaScript in logoff pages.

Maybe you are looking for

  • Lumia 900 - WEIRD - Hairline Crack appeared out of...

    First let me start by telling: - I take amazing care of my phone and I DID NOT dropped the phone and neither did anyone else in my family - I always make sure that I don't even keep my car keys or wallet in the same pocket as the phone - I ABSOLUTELY

  • Error while creating Shipment Creation

    Hi all,          when am creating Collective shipment vth Tcode:VT04, am getting the below error- " Unit of measure between L&KG are not maintained" - we have previous del documents for which shipment doc was created through VT04. but this time, amno

  • Unlock iPhone 1 - carrier AT&T denies to be the carrier

    Today i tried to unlock my iPhone 1, since it is locked due to a ios upgrade (to 3.1.3) i made yesterday. Apple service center checked my imei number, cross referenced it to the serial number and concluded that the carrier is AT&T. Service incident n

  • Sql proposed to use case statement

    Hi All Can anyone help me here This code works fine,here inthe inner sub queries(b,c,d,e,f),i am getting the weekly counts of usage data from the table mf_wer_OBI_USAGE_reqq. As this is hitting same table with the similar set of queries so i was advi

  • Connecting iBook to internet via Airport

    I just bought a used 14" G3 iBook 700MHz w/ Airport card and can't get it to the internet via my home wireless network. The home network has no problems connecting w/ our MacBook, 12" PowerBook and 13" G3 iBook via Airport. My wireless router is a D-