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

take appropiate value.

Former Member
0 Likes
558

hi Experts,

i have an Internal table and i have two records where i

HIST_TYPE = 'E' and

HIST_TYPE = 'Q'.

if i find both E and Q then i should take into consideration of = Q.

If i find only E then i should take E alone.

the second one is fine. but if i have both E and Q how can i take Q Into consideration?

can i have some input please?

thank you,

pasala.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
507

Hello

Try logic:


read itab with key HIST_TYPE = 'E'.
if sy-subrc = 0.
  read table itab with key HIST_TYPE = 'Q'.
  if sy-subrc = 0.
    result = 'Q'.
  else.
    result = 'E'.
  endif.
endif.

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
507

No big deal


read table itab with key HIST_TYPE = 'E'.
if sy-subrc = 0.
  "then look for Q
  read table itab with key HIST_TYPE = 'Q'.
  if sy-subrc = 0.
      "take Q
  else.
     "take E
  endif.
endif.

Regards

Marcin

Read only

Former Member
0 Likes
507

//

i have an Internal table and i have two records where i

HIST_TYPE = 'E' and

HIST_TYPE = 'Q'.

if i find both E and Q then i should take into consideration of = Q.

If i find only E then i should take E alone.

the second one is fine. but if i have both E and Q how can i take Q Into consideration?//

just to give an idea .

if the itab has only two records then set up a flag for condition 1 when E and Q are there.

loop will iterate for two times . one first occurance of E set it to 1 . for occurance of Q set it to 2 .

When the flag becomes 2 it means you have to consider Q.

If iterated for 1 then you can see it is E.

if inside the loop u need to clear thh count eveytime for new item / Uniqe no and process this with ctrl break statements .

Br,

VIjay.

Read only

Former Member
0 Likes
508

Hello

Try logic:


read itab with key HIST_TYPE = 'E'.
if sy-subrc = 0.
  read table itab with key HIST_TYPE = 'Q'.
  if sy-subrc = 0.
    result = 'Q'.
  else.
    result = 'E'.
  endif.
endif.