Fetch the amt value

Hi Gurus,
  Am new to ABAP..Similar kind of post was there but soln was not provided..Need  help from you..In my code have written as
loop at gi_amt
select  belnr gjahr dmbtr into table gi_bseg from bseg
endloop.
gi_amt is a table which contains the value of EKBE which has the details of invoice reciept ,goods reciept and service entry.From the old post it was given as VGABE has the value of 1 and 2 which helps to differenctiate the invoice reciept and Goods reciept.My pblm is also same as posted before ie)have to compare the amount of invoice reciept and goods reciept alone.How to do it.Please help in coding

Hi Divya,
Check the below logic, it may help you.
TYPES: ty_ekbe TYPE ekbe.
DATA: it_ekbe TYPE TABLE OF ty_ekbe,
      wa_ekbe TYPE ty_ekbe,
      wa_ekbe1 TYPE ty_ekbe.
SELECT * UP TO 20 ROWS
       INTO TABLE it_ekbe FROM ekbe. "For example i have selected 20 records, you can hv condn here
LOOP AT it_ekbe INTO wa_ekbe WHERE vgabe = 1. "only IR
"Read corresponding GR
  READ TABLE it_ekbe INTO wa_ekbe1 WITH KEY ebeln = wa_ekbe-ebeln vgabe = 2.
  IF wa_ekbe-dmbtr EQ wa_ekbe1-dmbtr. "Compare the amounts
    WRITE: / 'Amounts are equal for Document: ', wa_ekbe-ebeln. "If equal do some action
  ELSE.
    WRITE: / 'Amounts are not equal for Document: ', wa_ekbe-ebeln.
  ENDIF.
ENDLOOP.
Revert in case of any help.
Regards,
Manoj Kumar P
Edited by: Manoj Kumar on Feb 12, 2009 1:37 PM
Edited by: Manoj Kumar on Feb 12, 2009 1:43 PM

Similar Messages

  • Cursor not fetching the latest value in the loop.

    Hi!
    I'm facing a peculear problem. I've a procedure which will check the total number of records in a loop. It will fetch that value. If that value mathced with certain condition then the outer loop execution need to stop. Here is my script -
    <<Outer Loop Script>>
    declare
      j  number(5);
    begin
      j := 1;
      dbms_output.enable(100000);
    while j <> 3 and j <=3
    loop
      sel_pri(3,j);
      dbms_output.put_line('J is : '||j);
    end loop;
      dbms_output.put_line('Executes.....');
    exception
      when others then
        dbms_output.put_line(sqlerrm);
    end;
    -- Procedure Script --
    create or replace procedure sel_pri(x  in number,y out number)
    is
      pragma autonomous_transaction;
    begin
       select count(a.flg) cnt
       into y
       from (
             select flg
             from   t_priority
             where  flg <= x
             and    flg < 4
             union
             select flg
             from   t_priority
             where  flg > x
             and    flg < 4
           ) a;
      --commit;
    end; Now, the problem is -
    Suppose i've two records are there in t_priority table. So, when i run my anonymous pl/sql block it won't satisfy the condition - as a result the loop will iterate untill the condition satisfiy. Now, if i insert data from a different session and commit the value in table t_priority which have only one field named flg and if count is 3. Then the process of the while loop should be stopped. But, it that is not happening. Infact it is fetching the old value. Why is it so?
    Thanks in advance for your reply.
    Regards.
    Satyaki De.

    sir i cannot understand your example.
    SQL> declare
      2 
      3   cursor bc is
      4   select ename from emp;
      5 
      6   procedure change_in_another_trans
      7   is
      8    pragma autonomous_transaction;
      9   begin
    10    update emp set ename = ename || '?';
    11    commit;
    12   end;
    13  begin
    14 
    15   for v in bc loop
    16 
    17    if bc%rowcount = 3 then
    18     change_in_another_trans;
    19    end if;
    20 
    21    dbms_output.put_line(v.ename);
    22 
    23   end loop;
    24 
    25  end;
    26  /
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.
    Procedure change_in_another_trans is autonomous and is executed
    only once in the loop - when I fetched 3 rows from cursor. It updates
    the data I fetch in cursor loop and commits autonomous transaction.
    If Oracle would not support the read consistency for queries you had
    SMITH
    ALLEN
    WARD
    JONES?
    MARTIN?
    BLAKE?
    CLARK?
    SCOTT?
    KING?
    TURNER?
    ADAMS?
    JAMES?
    FORD?
    MILLER?
    But you see the data as they were at the moment (exactly SCN - System Change Number) of the query issue dispite they have been changed by another transaction after the cursor has been open. Hope I'm clear now.
    Rgds.

  • Need to fetch the column value which is not null

    Hi All,
    I have table
    please find the table with the values
    emp
    eno     ename     addr1     addr2     addr3     postcode     phone     Default
    1     null     null     null     null     null     null     Abc
    null     name     null     null     null     null     null     Abc
    null     null     null     null     null     null     123     Abc
    5     null     null     abcdef     null     null     123     Abc
    i need select the column with value alone.
    Is it possible with a query.
    My output for 1 row should be
    eno,default
    1, abc
    I dont want to fetch the null value columns. I need to query to fetch for whole table.
    Regards,
    Mohanarangan K

    Table values
    eno     ename     addr1     addr2     addr3     postcode     phone     Default
    1     null     null     null     null     null     null     Abc
    null     NAME     null     null     null     null     null     Abc
    null     null     null     null     null     null     123     XYZ
    5     null     null     abcdef     null     null     123     XYZ
    select from emp where default = 'XYZ'
    It should fetch the
    O/P:
    phone default
    123 XYZ
    eno addr2 default
    5 abcdef xyz
    this way my output should appear. can you help me in this

  • How to fetch the maximum values of 2 columns

    Hi All,
    I need to fetch the maximum value of 2 columns. For example I need to fetch the latest record for which i have to fetch the latest date and time. Date and time fields are 2 different columns. As of now am doing it the crude fetching the latest date records and then fetching the latest time record.
    Is there any other smarter way to do it. The one am doing rite now is turning out to be very performance intensive at the moment for me.  Also I could not apply max condition for two fields together.
    Please guide.
    Thanks,
    Nagraj

    Hi Jaspreet,
    Thanks for your response. But the problem am facing with this approach is I have to do this for n number of records in another internal table which is making it to cumbersome and affecting performance.
    Please suggest is there any better way to do it.
    Thanks,
    Nagraj

  • How to fetch the junk values of a column and the column name in oracle

    Hello,
    Can anyone help me in writing a procedure/dynamic SQL to fetch the column where the junk values appears and its value. Eg: If emp table contains ID and Name columns, and ID column contains junk values, the result should be the Id column and the junk value/s. It should be dynamic because next time if the other column contains junk values(like $,%...), the query should display the other column too..
    Thanks in advance..

    Try this, I'm not sure if it'll help... and get some idea...
    try to modify it as per your requirement -
    select * from junk_vals;
    1     ranit1
    2#     ranit2
    3     ranit3
    4$     ranit@4
    5     ranit5
    6     r^anit6
    select 'ID', id, val from junk_vals
        where regexp_like(id,'[^a-zA-Z0-9]')
    UNION
    select 'VALUE', id, val from junk_vals
        where regexp_like(val,'[^a-zA-Z0-9]');
    -- "Output :"
    ID     2#     ranit2
    ID     4$     ranit@4
    VALUE     4$     ranit@4
    VALUE     6     r^anit6
    NOTE - I've considered anything other than Alphabets and Numbers as a Junk Value
    Edited by: ranit B on Jan 4, 2013 5:07 PM
    -- o/p added

  • To fetch the srtfd value from PCL2 based on Pernr

    Hi,
    is there any function module to fetch field (srtfd ) value from PCL2 based on the pernr. My selection screen is having only pernr as the input and now have to get the srtfd value from PCL2.
    Kindly suggest me if any FM or best procees existed.
    Thanks,
    Murthy.

    Please somebody reply.

  • How to fetch the condition value per line item in PO o/p

    Dear Experts ,
    I need to fetch the value of the all valid condition types in the PO item , for its o/p .
    For this i should know
    1.what all are the  condition types involved in the item .
    2.what is the condition rate
    3. what is the condition value .
      Pleas etell me how do i fetch this data ??
    Thanks in advance
    Regards
    Anis

    Hi Anis,
    At first collect the doc.condition-KNUMV from EKKO table.
    Later enter the above doc.condition no in KONV and KONP to get the details.
    Regards
    Ramesh Ch

  • How to Fetch the Row value in SBO Formatted search

    Hi Experts,
    I have created a Sales order, in which i  have 4 UDF Fields(A,B,C,D) in the following:
    Example values:
    A  B  C  D 
    2   2   4  4
    3   2   6  10
    C=A*B
    D=1st value of D + 2nd col value of C
    i have written query for C, but how to write the Formatted search Query for generation of D values. plz reply as soon as possible.

    Magesh,
    I quite understand what you are trying to do.   If you look at the example below I added a third row to show how you want the D to be a running total of column C. RIGHT !!
    A B C D
    2 2 4 4
    3 2 6 10
    <b>4 2 8 18</b>
    Honestly, it is not going to be simple as you do not have a way in SBO to access a particular column from a row.  When you say $[$38.U_C] it refers to the context row OR the row which has the highlight OR the row which has the curson on it.
    It is not possible to say $[$38.U_C from row 2]  JUST  NOT POSSIBLE ...
    You have to write a tricky code by using a temp table referencing the value of column C.  Also you have to keep track if Rows gets deleted and a new row added. 
    I will test a sample code and will come back.
    Suda

  • Can we fetch the email  value directly from exchange by reconciliation

    Hi all,
    My query is when we provision a user to exchange usng OIM ; in the exchange process form we do not need to mention e-mail but we do have to mention the alias .
    So my thought is that the alias would be sent exchange then it would be changed to e-mail.
    In our case I need to reconcile the e-mail from the exchnage and compare it to user profile - email , if there is a mismatch then I would like to update it in exchange.
    Can anyone suggest how to reconcile an email from exchange to OIM.

    Scenario one you can implement using entity adapters. (one for update and one for insert for Exchange resource object)
    Depending on how you have set up your trusted reconciliation you might end up in a situation where any changes done through this process will be overwritten if the same user is changed in Pplsoft.
    Scenario two I have implemented with custom adapters a number of time. I don't know how flexible the "Create Mailbox" function is so it might be possible to do this with the out of the box functionality. I have not used the connector recently so there might be some new interesting functionality available.
    How does PplSoft know what email address the user has? Is it filled in by the HR person or is this information somehow copied from the Exchange system.
    My experience is that that you need to start by whiteboarding all processes on a business level (where is the information born?, how does the information flow?, what is the trusted source for each pierce of information?)
    Once you know how you would like the information to flow in all key scenarios you can start looking at how to implement this on the technical level. OIM is very flexible and you can get it to do almost anything but step one is always to know what you want to do.
    Best regards
    /M

  • How to fetch data from an internal table by comparing the a value in loop

    i have an internale table with two fields like parvw and vtext.
    acc to valuue in parvw in loop we sholud fetch the corresponding value of vtext.
    we should not use loop in loop .
    ex code
    select parvw vtext from tpart into table i_vtext where spras = sy-langu.
        LOOP AT I_OUTPUT.
          CASE I_OUTPUT-tabname.
            WHEN 'VBPA'.
              IF I_OUTPUT-fname = 'KUNNR' OR
                 I_OUTPUT-fname IS INITIAL.
                MOVE I_OUTPUT-tabkey TO vbpa.
               READ TABLE i_vtext WITH table KEY parvw = vbpa-*parvw .
                IF sy-subrc = 0.
                  REPLACE '&' WITH i_vtext-vtext INTO I_OUTPUT-indtext.
                ENDIF.
              ENDIF.
            WHEN 'VBAP'.
              IF I_OUTPUT-fname IS INITIAL.
                REPLACE '&' WITH 'item' INTO I_OUTPUT-indtext.
              ENDIF.
          ENDCASE.
          IF I_OUTPUT-indtext(1) EQ '&'.
            REPLACE '&' WITH I_OUTPUT-ftext(40) INTO I_OUTPUT-indtext.
          ENDIF.

    Loop the main ITAB
    and then use READ TABLE to fetch a row from the 2nd ITAB.
    sort the main itab abd use binary search option in READ to improve the performance
    Narendra

  • How to set the value of an LOV in CO prgramatically and get the Pkey value?

    Hi,
    I need to set a value to a LOV, say ItemLOV in a page through CO and get the Primaykey that LOV will return. How can I achieve this?
    Req:
    1. Set the Item_Name, say 'DELL_1618' so that the page displays this in the LOV.
    2. Fetch the PK value returned by LOV in the backend into a VO attribute say Item_ID, '100009881'.
    Thanks,
    Santosh.

    Hi Santosh,
    Sorry, I replied for General LOV Scenario, but want to set it programatically right,
    You need to execute your LOV query in Controller for Item 'DELL_1618' using prepared statement, get the value for both dispaly value and Id and set it to LOV and FormVlaue Item in PR of controller.
    Regards,
    Reetesh Sharma

  • APEX4: Populating fields from database based on the SelectList value

    Hi,
    I've a Select List and 4 Text Fields on a form. On selecting a value on the Select List, I've to populate the Text Fields by fetching its values from the database by using the Select List value as the primary key.
    How can I do this in APEX 4?
    Thanks for the help.
    --Hozy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thank you so much for helping me out.
    Yes, it comes from the same table account.
    These are the sqls to fetch the 4 values in each dynamic action:
    select a.address1 from account a where a.account_id = :P14_ACCOUNT
    select a.address2 from account a where account_id = :P14_ACCOUNT
    select a.city from account a where a.account_id = :P14_ACCOUNT
    select a.postal_code from account a where a.account_id = :P14_ACCOUNT
    Right now, I only have one dynamic action for text field P14_BILLING_ADDRESS_1, and even for just one the value is not showing up in it. Please note that when I added for dynamic actions, the the values were showing up in all the 4 text fields before.
    Then when I added 4 more dynamic actions for a different Select List (P14_CUSTOMER), but for the same text fields, it all stopped working. And now even a single dynamic action is not working. This is how the sql for next 4 dynamic actions looked like:
    select c.address1 from customer c where c.customer_id = :P14_CUSTOMER
    select c.address2 from customer c where c.customer_id = :P14_CUSTOMER
    select c.city from customer c where c.customer_id= :P14_CUSTOMER
    select c.postal_code from customer c where c.customer_id= :P14_CUSTOMER
    }

  • Performance troubles when fetching the descriptions

    Hello,
    I have some bad performances in a web interface. I could correct some of them help to aggregates, but I am facing a bizarre situation.
    I have one variable for 0EMPLOYEE. I fetch the characteristic values help to an exit function, and this works fast and well.
    However, I display the description of the employees and not their key codes. I am not coding anything for fetching the descriptions, I let SAP BPS standard do the job.
    When I trace the system, it appears that SAP creates a view joining the tables /BI0/QEMPLOYEE and /BI0/TEMPLOYEE, in order to get TXTMD. I do not understand why ... I already have the key codes needed to fetch the descriptions. I do not use any attributes for the descriptions.
    Here is the generated code :
    CREATE OR REPLACE VIEW "/BI0/0302679610" AS SELECT "Q"."SOURSYSTEM" ,"Q"."EMPLOYEE" ,"T"."TXTMD" FROM "/BI0/QEMPLOYEE" "Q" , "/BI0/TEMPLOYEE" "T" WHERE "Q"."SOURSYSTEM" = "T"."SOURSYSTEM"() AND "Q"."EMPLOYEE" = "T"."EMPLOYEE"() AND
    ( "Q"."CHANGED" = ' ' OR "Q"."CHANGED" = 'I' ) AND "Q"."DATETO" >= '20070101' AND "Q"."DATEFROM" <= '20070101' AND "Q"."SOURSYSTEM" = 'R1' AND ( "Q"."EMPLOYEE" = '00904096' OR "Q"."EMPLOYEE" = '00904085' OR "Q"."EMPLOYEE" = '00904077'
    OR "Q"."EMPLOYEE" = '00904065' OR
    "Q"."EMPLOYEE" = '00904056' OR
    "Q"."EMPLOYEE" = '00904053'   ...................
    I have the same problem with 0VENDOR, whose variable is not based on exit function but hierarchies. No problem to collect the list of the vendors, but the same problem when fetching their descriptions.
    Regards
    Laurent

    Laurent,
        For a similar problem which I had faced earlier with
    Material InfoObject, we had to create indexes on the
    Master Data and also we put restrictions on the level
    definitions on the Material InfoObject to look at some
    selective Materials rather than million of them.This
    approach worked and the amount of time it took to
    display reduced to one eighth of the original time.
    Hope this helps.
    Cheers
    Srini

  • Not able to fetch the correct line in interactive list

    Dear All,
    I am making an interactive report wherein I want to fetch the data as per the line clicked by the user.
    e.g.
    Particulars        value
    ABC                  12
    PQR                  14
    XYZ                    20
    Whenever I am clicking the list on ABC, the system is fetching the last value in the internal table.
    Can anyone please guide me on this?

    Hi Aasim,
    Please look into the below code. for simple interactive report
    DATA : BEGIN OF itab OCCURS 0,
             name(10),
             num TYPE i,
           END OF itab.
    itab-name = 'ABC'.
    itab-num = 123.
    APPEND itab.
    itab-name = 'BDC'.
    itab-num = 125.
    APPEND itab.
    itab-name = 'xyz'.
    itab-num = 345.
    APPEND itab.
    LOOP AT itab.
      WRITE : / itab-name,
                itab-num.
      HIDE itab-name.
    ENDLOOP.
    AT LINE-SELECTION.
      WRITE : itab-name.
    Regards
    Kumar M.
    Edited by: mukesh kumar on Oct 29, 2008 6:54 AM
    Edited by: mukesh kumar on Oct 29, 2008 6:55 AM

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

Maybe you are looking for

  • Javax.mail.internet.ParseException while busrting report using control file

    Hi everyone... I am trying to run a concurrent program that will burst emails using a control file. In the data definition i want to use few parameters whose values will be passed from concurrent program.In the data definition i am calling an after r

  • Air installer won't display window in Mac OS 10.6.4

    Hi, I'm having problems installing Air. I just bought a $79 app running only on Air and am quite frustrated about this. I downloaded the latest Air installer but when I launch it, the icon appears in the dock but the window is nowhere to be seen – so

  • Broadcasting workbooks to a printer or PDF format files

    Hello, I know these are two features not available in the system, but, Does anybody create such a functionality as a "customer enhancement"? May i have some guideline how to develop them? Thanks in advance, Gabriel.

  • Best 2D Graphics to Timeline workflow?

    Hello, I'm currently in the latest version of Final Cut and mostly working in the HDV 1080i format. I'm trying to figure out what the most professional workflow to import graphics and images into my timeline is. I have Photoshop and Fireworks CS3 as

  • Using Spaces in Yosemite

    I had my hard drive replaced recently and Yosemite was installed. I set up spaces but can't seem to set it up so that different applications only open in an assigned space. For example when I open Firefox in Space 2 the next time I click on Firefox i