Sorting techinque without using sort statement /Comparing table fields.

Hi,
How to achieve sorting techinque without using sort statement in tables.
Also how to compare fields of 2 custom tables and check their compatability without using code ?

Hi,
Refer the below program, it will be helpful.
types: begin of t_int,
         int type i,
        end of t_int.
data: it_int type standard table of t_int,
       wa_int type t_int,
       wa_int1 type t_int.
wa_int-int = 70.
append wa_int to it_int.
clear wa_int.
wa_int-int = 50.
append wa_int to it_int.
clear wa_int.
wa_int-int = 20.
append wa_int to it_int.
clear wa_int.
wa_int-int = 30.
append wa_int to it_int.
clear wa_int.
wa_int-int = 23.
append wa_int to it_int.
clear wa_int.
wa_int-int = 23.
append wa_int to it_int.
clear wa_int.
wa_int-int = 32.
append wa_int to it_int.
clear wa_int.
wa_int-int = 77.
append wa_int to it_int.
clear wa_int.
wa_int-int = 99.
append wa_int to it_int.
clear wa_int.
wa_int-int = 1.
append wa_int to it_int.
clear wa_int.
wa_int-int = 11.
append wa_int to it_int.
clear wa_int.
wa_int-int = 90.
append wa_int to it_int.
clear wa_int.
wa_int-int = 40.
append wa_int to it_int.
clear wa_int.
data: wk_line type i.
data: cnt type i.
data: cnt1 type i.
describe table it_int lines wk_line.
clear: cnt,cnt1.
data wk_flag type c.
   clear wk_flag.
while wk_line gt cnt1.
   cnt = cnt + 1.
   read table it_int into wa_int index cnt.
   cnt1 = cnt + 1.
   read table it_int into wa_int1 index cnt1.
   if wa_int-int lt wa_int1-int.
     modify it_int from wa_int index cnt1.
     modify it_int from wa_int1 index cnt.
     wk_flag = 'X'.
   endif.
   if cnt1 eq wk_line.
     clear: cnt, cnt1.
     if wk_flag eq 'X'.
     clear wk_flag.
     continue.
     else.
       exit.
     endif.
   endif.
endwhile.
loop at it_int into wa_int.
   write: / wa_int-int.
endloop.

Similar Messages

  • Updating data without using update statement

    Hi,
    A quick question...
    Can any table data could be updated without using update statement from backend.
    Just wanted to make sure.
    Thanks in advance.

    Hi,
    What is your definition of Update?
    Since your question is vague and you dont explain what exactly you mean.
    here are my thoughts
    1) A record can be deleted and isnerted with new values.Where the nes values have only few columns changed from previous ones.
    2) I use pl/sql developer.If i need to update i can write select.. for update.Change the values (as in notepad)Commit.
         This is infact a update but with nice UI
    3) even your application can update data in your tables, if you code it and give correct privileges to the userRegards,
    Bhushan

  • Compare Table fields

    I want to compare tables and fields(not values)... which Tcode I can use?

    Hi,
    Compare Tables.  --> SCU0
    Compare Tables.  --> OY19
    Regards
    Sudheer

  • I'm trying to draw a candlestrick chart without using the open and close fields

    I'm trying to draw a candlestrick chart without using the
    open and close fields, however I am seeing nothing on the cart. The
    horizontal and vertical axis are displaying their labels correctly
    for the data. Any ideas what is going on here?

    "nikos101" <[email protected]> wrote in
    message
    news:gi5rh4$ptn$[email protected]..
    > Is it not to draw the line between the high and low
    then? The data I
    > recieve has no open and close data :(
    >
    I've never seen a candlestick that didn't have all 4
    properties.
    You may find the floating columns do what you want here
    http://demo.quietlyscheming.com/ChartSampler/app.html
    or possibly the
    vertical line type will work for you.
    HTH;
    Amy

  • Delete internal table rows without using loop statement

    i have an internal table which consists of 100 records.
    i need to keep only first 5 records.
    without using the loop statement i need to delete the rest of the records. how can we achieve this result.
    i.e.  delete itab1 where  "recordno"  > 5.
    regards.
    ZG

    Hi,
    Delete itab [FROM idx1] [TO idx2] {Where (log_exp)]
    To delete several lines at once, you have to specify at least one of the additions FROM, TO, or WHERE. You can only use the additions FROM and TO with standard tables and sorted tables.
    Delete itab [FROM idx1]
    If you specify FROM, all the table rows from the table index idx1 onwards are included.
    Delete itab [TO idx2]
    If you specify TO, all the table rows from the table index idx2 onwards are included.
    PARAMETERS: p_carrid TYPE sflight-carrid,
                p_connid TYPE sflight-connid.
    DATA: BEGIN OF seats,
            fldate    TYPE sflight-fldate,
            seatsocc  TYPE sflight-seatsocc,
            seatsmax  TYPE sflight-seatsmax,
            seatsfree TYPE sflight-seatsocc,
          END OF seats.
    DATA seats_tab LIKE STANDARD TABLE OF seats.
    SELECT fldate seatsocc seatsmax
           FROM sflight
           INTO TABLE seats_tab
           WHERE carrid = p_carrid AND
                 connid = p_connid.
    LOOP AT seats_tab INTO seats.
      seats-seatsfree = seats-seatsmax - seats-seatsocc.
      MODIFY seats_tab INDEX sy-tabix FROM seats.
    ENDLOOP.
    ENDLOOP.
    SORT seats_tab BY seatsfree DESCENDING.
    DELETE seats_tab FROM 5.
    Thanks & Regards,
    ShreeMohan
    Edited by: ShreeMohan Pugalia on Jul 21, 2009 4:28 PM

  • Sorting HashSet without using the tree set?

    Hi,
    I need to sort the hash set by using the comparator, if i use the comparator in tree set to sort my hash set then it will check the uniqueness condition also using the same comparator. So i will lose some elements in the set.
    So i want to sort no need to check the uniqueness.
    Is there any API is available in java to achieve this. Like sorting the list we use the Collections.sort method. Like this any API is available to sort the hash set or any other ways can we achieve this (without using tree set sorting the hash set.)?
    Thanks in advance.

    906738 wrote:
    Thanks for your reply.
    I had done those things earlier like you said, the application i am using is frequently running out of memory i don't want to use more objects. If i am converting to list then it will create the another object to hold the elements of the hash set. Because of this only i am seeking for any other API is available.Perhaps you should try to find the source of your memory problems in stead of doing your very best to not have to do that; the way you're trying to "solve" things now is only going to lead to epic failure, I mean you're now as far gone as trying to not create objects in an object oriented language.
    Try a profiler.

  • Remove duplicates without using Sort OR Script compnent OR Staging ?

    Team , Can some advise on how do we go about removing duplicates without using  either of above option quoted in the subject lines ? My source is a huge  flat file  .
    Thanks in advance !
    Rajkumar Yelugu

    I think you can do like this
    1. Add a Data Flow Task with flat file source
    2. Add a multicast to flat file source
    3. Join an output from Multicast to Aggregate transform and group by your required field and take min or max over a unique valued column(s) (id or date or primary key)
    4. Add a Merge join transform and  add the multicast output and Aggregate Transform outputs as sources. join on the group by fields from aggregate and include min/max column also in output
    5. Add a conditional split and define an output as unique valued column(s) >(<) Min/Max value from aggregate
    6. Join the defined output to your destination to get only distinct records from the duplicate sets
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Fill table using different statements for each field (newbie question)

    Hi all, I'm about to fill table table1 (field1, field2, etc.) using different statements (and maybe variables) for each field.
    My statements are too different to combine them into one query, but my example is simple:
    statement 1:
    SELECT ttt AS field1 FROM dual
    statement 2:
    SELECT yyy AS field2 FROM dual
    Each statement returns one value. Maybe I need some variable for each value, so var_field1 = field1, var_field2 = field2, etc.
    As a result I have to fill table table1 using my variables, so it must be some procedure.
    I know I can do it using one statement below, but I have more than 100 queries, so they should be executed one by one.
    with t1 as(
    select (SELECT 'ttt' FROM dual) field1, (SELECT 'yyy' FROM dual) field2 from dual
    select * from t1;
    Could you please show me some example, how this procedure should be written?
    Thanks ahead.

    This hasn't got anything to do with Oracle Reports, but here we go anyway. Your query can simply be:
    with t1 as(
    select 'ttt' field1, 'yyy' field2 from dual
    select * from t1;
    FIE FIE
    ttt yyy
    1 row selected.But maybe your example was an over simplification of your problem.

  • How can i construct this query without using CASE statement?

    I've a following code. I'm using this script in Hibernet. So, i cannot use CASE there. Because, hibernet doesn't support case in select statement. How can i construct the same thing which will give me the same result without using CASE?
    SELECT ofc.FLT_LCL_ORIG_DT
         , ofc.CARR_IATA_CD
         , ofc.FLT_NBR
         , ofc.ORIG_ARPT_CD
         , ofc.DEST_ARPT_CD
         , sum( ofc.CNCT_PSGR_CNT) AS BOOKED_CNCT_PSGR_CNT
         , sum( CASE WHEN o.fsdr_mrkt_cd = 'D' AND d.fsdr_mrkt_cd = 'D'           THEN '0'
            ELSE to_char(ofc.CNCT_PSGR_CNT,'99')                             END ) AS BOOKED_INTL_CNCT_PSGR_CNT
         , sum(CASE WHEN o.fsdr_mrkt_cd||d.fsdr_mrkt_cd = 'DD'
                    THEN '0'
            ELSE to_char(ofc.CNCT_PSGR_CNT,'99')
            END) AS NEW_BCNT
    FROM OPS_FLT_CNCT ofc
                        , STN o
                        , STN d
                    WHERE ofc.CNCT_ORIG_ARPT_CD = o.STN_CD
                      AND ofc.CNCT_DEST_ARPT_CD = d.STN_CD
                     -- AND TRUNC(ofc.FLT_LCL_ORIG_DT) = trunc(to_date('22-MAY-2007','DD-MON-YYYY'))
                      AND ofc.CARR_IATA_CD = 'UA'
                      AND ofc.FLT_NBR = '1218'
                      AND ofc.ORIG_ARPT_CD = upper('DEN')                AND ofc.DEST_ARPT_CD = upper('IAD')                  GROUP BY ofc.FLT_LCL_ORIG_DT
                           , ofc.CARR_IATA_CD
                           , ofc.FLT_NBR
                           , ofc.ORIG_ARPT_CD
                           , ofc.DEST_ARPT_CD ;And, the output look like this --
    FLT_LCL_O CARR FLT_N ORI DES BOOKED_CNCT_PSGR_CNT BOOKED_INTL_CNCT_PSGR_CNT   NEW_BCNT
    22-MAY-07 UA   1218  DEN IAD                    9                         0          0
    23-MAY-07 UA   1218  DEN IAD                    1                         0          0
    24-MAY-07 UA   1218  DEN IAD                    2                         1          1
    25-MAY-07 UA   1218  DEN IAD                    1                         0          0Thnaks in advance for reply.
    Regards.
    Satyaki De.
    #####

    2 ideas:
    1. Inline function to perform the CASE funcionaltity for you
    2. Piplelined function to generate the entire dataset
    Both will be slower than just using CASE in a query, but we're working around big constraints

  • Constructing actionPerformed method without using if statements

    Hi,
    I'm currently writing a basic swing program, and have used 'if' statements within the actionPerformed methods. I wondered if there was a better, neater way of doing this without using the 'if' statements.
    My code so far is as follows,
    method 1:
    static private class IncrementDecrementAction implements ActionListener {
            boolean oddNumberClick = true;
            public void actionPerformed(ActionEvent e) {
                if (oddNumberClick= !oddNumberClick)
                    SimpleSwing.label.setText(labelPrefix + "Decrement");
                else
                    SimpleSwing.label.setText(labelPrefix + "Increment");
        }method 2:
    static private class ClickAction implements ActionListener {
            public int numClicks = 0;
            public void actionPerformed(ActionEvent e) {
                if (SimpleSwing.label.getText().equals(labelPrefix + "Increment"))
                    numClicks++;
                else
                    numClicks--;
                SimpleSwing.label2.setText(labelPrefix2 + numClicks);
        }Any ideas or advice appreciated.
    Thanks

    I think there's a way, but it is very similar to your code:
    public void actionPerformed(ActionEvent e) {
         numClicks = SimpleSwing.label.getText().equals(labelPrefix + "Increment")?numClicks + 1: numClicks - 1;
         SimpleSwing.label2.setText(labelPrefix2 + numClicks);
    }But keep in mind this: each time a button is pressed it will always call actionPerformed of all its listeners, so there is no way to call different methods (unless you use different listeners like Mouse listeners...).

  • Query slow when executing using prepared statement compared to sqlDeveloper

    Oracle version is 10.2.0.1.0.
    I have got a query which when submitted from java code using prepared statement and parameter substitutions, takes more than 20 seconds to give results.
    I can see this SELECT sql sitting there when I run Monitor Sessions through sqlDeveloper, with its wait time increasing and then finally getting through. During that time no other SQLs are waiting.
    DURING THAT TIME then I am able to run the same query (with values included) multiple times using sqlDeveloper, and it gives results in no time.
    Sqldeveloper connects using thin client using lib provided by oracle in windows.
    Java code runs from linux and uses the thin client using lib provided by oracle in linux.
    Both are hitting the same DB running on a separate Linux machine.
    What could be the cause of this problem?
    What db parameters, queries should I run to identify the bottleneck?
    Edited by: user10390517 on Jun 14, 2010 3:06 AM

    Hi Rob,
    at least you should see some differences in the statistics for the different child cursor (the one for the execution in the application should show at least a higher value for ELAPSED_TIME). I would use something like the following query to check the information for the child cursors:
    select sql_id
         , PLAN_HASH_VALUE
         , CHILD_NUMBER
         , EXECUTIONS
         , ELAPSED_TIME
         , USER_IO_WAIT_TIME
         , CONCURRENCY_WAIT_TIME
         , DISK_READS
         , BUFFER_GETS
         , ROWS_PROCESSED
      from v$sql
    where sql_id = your_sql_idRegards
    Martin

  • Showing sort icons without applying sort to the collection in AdvancedDataGrid

    Hi All,
    We have a scenario in our application where all the sorting has to be handled by the web services and the client just needs to show the sorted data in an Advanced Data Grid.
    The web services though returns details for the column on which it is being sorted and also the sort order i.e. ASC or DESC. So based on the same we need to simply show a ASC or DESC icon on the specified column header.
    We tried different options, but it seems the sort icons only show up when sorting is actually applied to the collection. But since the sorting is to be dealt with from the web services, it is not possible to apply sorting on the client side as it may result is differentiating data.
    So, can anyone please suggest a solution for this.
    Thanks,
    Eshaan

    Hi All,
    We have a scenario in our application where all the sorting has to be handled by the web services and the client just needs to show the sorted data in an Advanced Data Grid.
    The web services though returns details for the column on which it is being sorted and also the sort order i.e. ASC or DESC. So based on the same we need to simply show a ASC or DESC icon on the specified column header.
    We tried different options, but it seems the sort icons only show up when sorting is actually applied to the collection. But since the sorting is to be dealt with from the web services, it is not possible to apply sorting on the client side as it may result is differentiating data.
    So, can anyone please suggest a solution for this.
    Thanks,
    Eshaan

  • SELECT statement comparing 2 fields in a table.

    Hi,
    Can someone help me out  in making a efficient SELECT statement for the follwing requirement.
    Say, I want to select all the records from a database table where the field, PLANT is equal to field SALESORG in the table (i.e., when both fields are equal select that record).
    Thanks & regards,
    Sree

    Hello,
    I think this is the answer to your question... if you explain a bit more we can formulate a query.
    Subquery
    Variants:
    1. ( select )
    2. ALL ( select )
    3. ANY ( select )
    4. SOME ( select )
    Effect
    A subquery is a SELECT statement select that occurs within a
    SELECT,
    OPEN CURSOR,
    UPDATE, or
    DELETE statement
    in the WHERE clause or HAVING clause, to check whether data from database tables or views meets certain criteria.
    Subqueries have a restricted syntax in comparison to the normal SELECT statement:
    SELECT result FROM source [WHERE where] [GROUP BY fields]       [HAVING having].
    Variant 1
    ( select )
    If the subquery returns a single value, you can use any relational operator except LIKE and BETWEEN.
    Example
    Selecting the flights with the most passengers:
    DATA: WA TYPE SFLIGHT.
    SELECT * FROM SFLIGHT
        INTO WA
        WHERE SEATSOCC = ( SELECT MAX( SEATSOCC ) FROM SFLIGHT ).
      WRITE: / WA-CARRID, WA-CONNID, WA-FLDATE.
    ENDSELECT.
    Note
    If you use a subquery with a relational operator instead of EXISTS, you may only specify one column in the SELECT clause. This can be either a field from the database table or an aggregate expression. Subqueries of this kind are referred to as scalar subqueries.
    Variant 2
    ALL ( select )
    If the subquery returns several lines, each containing one value, you specify that the comparison should apply for all of the values it returns.
    Example
    This example shows how to use ALL. It displays a list of the customer IDs of the customer (or customers) who have made the most bookings:
    DATA: ID TYPE SBOOK-CUSTOMID, CNT TYPE I.
    SELECT CUSTOMID COUNT( * ) AS C FROM SBOOK
        INTO (ID, CNT)
        GROUP BY CUSTOMID
        HAVING COUNT( * ) >=
          ALL ( SELECT COUNT( * ) FROM SBOOK GROUP BY CUSTOMID ).
      WRITE: / ID, CNT.
    ENDSELECT.
    Variant 3
    ANY ( select )
    Variant 4
    SOME ( select )
    If the subquery returns several lines each containing one value, this variant specifies that the comparison should apply to at least one of the values returned. The IN operator is the same as the combination = ANY.
    &ABAP_HINT
    If you use a subquery with the EXISTS operator, the expression is true if the subquery selects at least one line. You can useuse * in the SELECT clause of subqueries that use EXISTS.
    Example
    Selecting all flights from Frankfurt to New York between 1.1.1999 and 31.3.1999 that are not yet full:
    DATA: WA_SFLIGHT TYPE SFLIGHT.
    SELECT * FROM SFLIGHT AS F INTO WA_SFLIGHT
        WHERE SEATSOCC < F~SEATSMAX
          AND EXISTS ( SELECT * FROM SPFLI
                        WHERE CARRID = F~CARRID
                           AND CONNID = F~CONNID
                           AND CITYFROM = 'FRANKFURT'
                           AND CITYTO = 'NEW YORK' )
          AND FLDATE BETWEEN '19990101' AND '19990331'.
      WRITE: / WA_SFLIGHT-CARRID, WA_SFLIGHT-CONNID,
               WA_SFLIGHT-FLDATE.
    ENDSELECT.
    Subqueries such as the one in this example, in which the WHERE clause uses fields from the main query, are known as correlated subqueries. Subqueries can be nested, and a given subquery may contain any fields from other, hierarchically-superior subqueries.
    In a correlated subquery, the subquery is executed for each line r returned by the main query. In the above example, the main query finds all flights in table SFLIGHT that are not full and that have a date that meets the selection criterion. The statement then performs the subquery for each of the records returned by the main query, using the corresponding values of CARRID and CONNID, to check whether the relevant flight operates between Frankfurt and New York.
    Additional help
    Subqueries

  • XML in PLSQL without using SELECT statements

    It maybe crazy but I cannot find a book or an example to differentiate between these two ones, if it is english or french based on XML below.
    set serveroutput on size 1000000
    DECLARE
    l_doc VARCHAR2(2000);
    l_domdoc dbms_xmldom.DOMDocument;
    l_nodelist dbms_xmldom.DOMNodeList;
    l_node dbms_xmldom.DOMNode;
    l_value VARCHAR2(30);
    l_xmltype XMLTYPE;
    l_empx XMLTYPE;
    l_index PLS_INTEGER;
    l_col_ind PLS_INTEGER;
    v_namespace_prfx varchar2(20):= 'ns0:';
    v_namespace varchar2(200):= 'xmlns="http://www.rona.ca/SharedResources/SchemaDefinitions/Canonical"';
    l_nsmap varchar2(200);
    BEGIN
    l_doc := '<?xml version = "1.0" encoding = "UTF-8"?>          
    <ns0:Product type = "DEPAS" xmlns:ns0 = "http://www.rona.ca/SharedResources/SchemaDefinitions/Canonical">          
         <ns0:ProductIDs>     
              <ns0:ID type = "RONCD">48535003</ns0:ID>
         </ns0:ProductIDs>     
         <ns0:ProductUom Usage = "PURCU">     
              <ns0:Quantity uomCode = "EA">1</ns0:Quantity>
         </ns0:ProductUom>     
         <ns0:ProductUom Usage = "SALEU">     
              <ns0:Quantity uomCode = "EA">1</ns0:Quantity>
         </ns0:ProductUom>     
         <ns0:CreateDateTime>2003-02-16T00:00:00-04:00</ns0:CreateDateTime>     
         <ns0:Status>     
              <ns0:Code>ACTV</ns0:Code>
         </ns0:Status>     
         <ns0:Description languageCode = "fra" type = "REGID">DEPOT BOUTEILLE</ns0:Description>     
         <ns0:Description languageCode = "eng" type = "REGID">BOTTLE DEPOSIT</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "LONGD">DEPOT BOUTEILLE D''EAU</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "LONGD">DEPOSIT WATER BOTTLE</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "REGI4">DEPOT BOUTEILLE</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "REGI4">BOTTLE DEPOSIT</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "CLEI4">DEPOT</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "CLEI4">DEPOSIT</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "LONG4">DEPOSIT WATER BOTTLE</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "LONG4">DEPOT BOUTEILLE D''EAU</ns0:Description>          
    </ns0:Product>';
    l_xmltype := XMLTYPE(l_doc);
    -- Method 3
    dbms_output.new_line;
    dbms_output.put_line('Method 3');
    l_index := 1;
    l_nsmap:=v_namespace;
    --dbms_output.put_line('ID type = ' || l_xmltype.extract('/GetRequest/ProductIDs/ID[2]/@type', l_nsmap).getStringVal());
    WHILE l_xmltype.Existsnode('/Product/'||'Description[' || To_Char(l_index) || ']',v_namespace) > 0
    LOOP
    dbms_output.put_line('I am here');
    -- dbms_output.put_line('ID = ' || l_xmltype.extract('/GetRequest/ProductIDs/ID/text()', l_nsmap).getStringVal());
    dbms_output.put_line('ID type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/@type', l_nsmap).getStringVal());
    dbms_output.put_line('ID type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/text()', l_nsmap).getStringVal());
    -- is it english or french ? how can I capture the difference ? my example does not work
    dbms_output.put_line('ID type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || '][languageCode = "eng"]/text()', l_nsmap).getStringVal());
    --dbms_output.put_line('Emp Name: '||l_value);
    l_index := l_index + 1;
    END LOOP;
    END;

    I think you already know this since you extract the "type" attribute too.
    As well, languageCode is an attribute so you must access it with the "@" notation (or the attribute:: axis).
    Now, it depends on what you want to do :
    1- extract only Descriptions in a given language ?
    2- extract all Descriptions along with their language ?
    For 1) the current iteration method is not appropriate and you can't just add the corresponding predicate in the existsNode test because there's no correlation between the node position and the languageCode.
    You have to count how many nodes of the given language there are and then loop from 1 to this count.
    Or, fall back to case 2) and test the language within the loop after having extracted it.
    For 2) add another extract call that targets the attribute :
    WHILE l_xmltype.Existsnode('/Product/'||'Description[' || To_Char(l_index) || ']',v_namespace) > 0
    LOOP
      dbms_output.put_line('type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/@type', l_nsmap).getStringVal());
      dbms_output.put_line('languageCode = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/@languageCode', l_nsmap).getStringVal());
      dbms_output.put_line('Description = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/text()', l_nsmap).getStringVal());
      l_index := l_index + 1;
    END LOOP;XMLTable is so much simpler to use in any case.

  • How to use select statement for one field

    I want to fetch the data from table and only one field  , the below code i written is correct or not , because only for one field i used endselct  if i am not giving endselect it is  showing error. Please suggest me.
    DATA : SBELN TYPE VBAK-VBELN.
    parameters : s_vbeln type vbak-vbeln.
    select vbeln from vbak into sbeln
    where vbeln = P_VBELN.
    endselect.

    Hi ,
    As because you want single field but not single record so SELECT  SINGLE is not correct .
    You need to create a internal table with the field of VBELN.
    Then you need to fetch the records from the VBELN field of table VBAK.
    Try this code --
    DATA : t_itab like table of VBAK-VBELN.
    parameters : s_vbeln type vbak-vbeln.
    select vbeln from vbak into table t_itab
    where vbeln = s_VBELN.
    Regards
    Pinaki

Maybe you are looking for