Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fetch the amt value

Former Member
0 Likes
1,130

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 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

8 REPLIES 8
Read only

tarangini_katta
Active Contributor
0 Likes
1,106

HI Divya,

Welcome to SCN.

First mistake. Select with in the LOOP is peformance wise very low.you should not use select with in the loop.

Can you please explain what you want exactly.

Thanks

Read only

0 Likes
1,106

Hi,

Thanks for ur quick response.

My scenario is have to compare the amount of invoice reciept and goods receipt and after that have perform some tasks.But in this 1st part itself am stuck up.

In the internal table have the values of table EKBE which consists of values of invoice reciept,service reciept and goods reciept.I have to compare only the GR and IR amount.If its same have perform some task else other task.

Hope now am clear..

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,106

Hello Divya,

To identify GR: EKBE-VGABE = '1' & EKBE-BEWTP = 'E'.

To identify IR: EKBE-VGABE = '2' & EKBE-BEWTP = 'R'.

And the corresponding amounts are stored in EKBE-DMBTR.

What do you want in addition to this?

BR,

Suhas

Edited by: Suhas Saha on Feb 12, 2009 5:16 PM

Read only

0 Likes
1,106

I need to know the coding logic how to compare the amount fields from the internal table.Please help

Read only

Former Member
0 Likes
1,106

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

Read only

tarangini_katta
Active Contributor
0 Likes
1,106

HI DIvya,

Manoj code will work for you.

Implement that llogic.

Thanks

Read only

0 Likes
1,106

I have the values in the table which is got using a FM.Am not able to write select query .It specifies the table is not present.Table is declared in the FM as gi_amt like ekbe occurs 0 with header line.

Read only

0 Likes
1,106

HI,

I think same question you asked in another forum also i think Just now i have answered to you.

You don't have the statement select * from itab.

YOu can't write select for the internal table.

Thanks,