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

help with internal table required

Former Member
0 Likes
434

I have an internal table of such structure

VB , VC , VALUE - Fields

a , a1 , 1

a , a2 , 3

a , a3 , 2

b , b1 , 1

b , b2 , 2

b , b3 ,0

b , b4 ,1

I need to loop and somehow check that if that field value against any one of the VC corresponding to one VB is 0, then i need to check if all the other values for that same VB are 0 or not.if even for a single VB not all values are 0 i need to throw an error message.I need to check this for all VBs in the table.

The requirement is that if for one VB any value is zero all values for that VB should be zero or else all should be non zero.

for example, here above since the 3rd value entry against VB = B is 0 and other are non zero i need to throw an error. no error for VB = A since all are non zero. How do I go about processing this internal table. Immediate help would be appreciated.

3 REPLIES 3
Read only

Former Member
0 Likes
403

Hint for you

loop at itab.

read table itab with key VC = '0'

VB= itab-VC.

if sy-subrc eq 0.

endif

endloop.

Read only

Former Member
0 Likes
403

Hi Aditi

Assume the below mentioned values are in itab1.

take a copy to itab2 and itab3.

in itab2.

delete itab2 where value = '0'.

in itab3 delete itab2 where valuen ne = '0'.

loop at itab2.

read table itab3 with key vb = itab2-vb.

if sy-subrc = 0.

*Means there is value other zero

error message

endif.

endif.

endloop.

Let me know, whether it works

Regards

MD

Read only

Former Member
0 Likes
403

Thanks!