cancel
Showing results for 
Search instead for 
Did you mean: 

Count Logic

Former Member
0 Kudos

Hi,

i have a rquirement here,

in a start routine, we are reading an internal table after checking one condition i.e. field 1 and field 2 are not initial.

if we get any records,what we are doing is we are populating some fields through another table.

now my requirement is:

-if field1 and field2 are not blank then check for no. of such records.

-if count is only 1 then populate the other fields as usual

-else other condition.

can anyone plese tell me , how can i be able to implement this logic (count logic)??

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186445
Active Contributor
0 Kudos

a thought....

in a start routine, we are reading an internal table after checking one condition i.e. field 1 and field 2 are not initial.

Copy this internal table to a temp table in the beginning of the loop (so you always start with all the records)

loop at ....

temp_itab[] = itab[].

now delete all the records from temp_itab that do not meet the condition:

delete temp_itab where field1 is initial.

delete temp_itab where field2 is initial.

now you can count the number of lines left in temp_itab:

describe temp_itab lines v_count.

if v_count = 0.

.....

elsif v_count = 1.

.....

else.

.....

endif.

endloop.