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

selection query

Former Member
0 Likes
364

hi guys,

I have a data in internal table.

iam extracting based upon the fields KURST and GDATU.

If i have more than one same currencey conversion like given below , i should display a error message,

-


kurst fcurr tcurr gdatu

-


TCL GBP EUR 13.03.2006

TCL GBP EUR 31.03.2006

It should not have more than one time same currency conversion.

GBP-->EUR

GBP-->EUR.

how can i do it.

please help.

2 REPLIES 2
Read only

Former Member
0 Likes
338

Hi Ahmed

Please try with a logic similar to below:

data: tabix like sy-tabix,
      wa like itab.

sort itab by kurst fcurr tcurr.

loop at itab.
     tabix = sy-tabix.
     tabix = tabix + 1.
     read table itab index tabix.
     if sy-subrc eq 0 and 
        itab-kurst = wa-kurst and
        itab-fcurr = wa-fcurr and
        itab-tcurr = wa-tcurr.
        Write:/ 'Duplicate Record:', itab.
     endif.
endloop.

Kind Regards

Eswar

Read only

Clemenss
Active Contributor
0 Likes
338

Hi,

store the currency combinations into an internal table. As soon as one combination apperas more than once, it can not be stored and you can do what you want in this case to be done.


data:
  begin of ls_conv,
  fcurr like...
  tcurr like...
  end of ls_conv,
  lt_conv like hashed table of ls_conv
   with unique key table_line.
loop at itab.
  move-corresponding itab to ls_conv.
  insert ls_conv into table lt_conv.
  if sy-subrc <> 0.
"Alarm: Here comes the duplicate
*  TAKE ACTION
  endif.
endloop.

At least this is the fastest solution.

Regards,

Clemens