Application Development 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: 

Help in conditions

Former Member
0 Kudos

Hi every one,

I need to populate certain things properly based on some condtion like i have a selection screen with range.

and my select querey is as follows:

SELECT * FROM vbup WHERE vbeln = vbap-vbeln AND

posnr = vbap-posnr AND

lfsta IN s_status AND

( gbsta IN s_bilst OR

fksaa IN s_bilst ).

Now i have to display this sales order based on the gbsta or fksaa this are for whether they are from order realted or invoice related sales orders....

Now the problem is a sales order has the following creteria for the above gbsta and fksaa fields...like below

<b><u>vbeln posnr fkstaa gbsta</u></b>

4000001 10 A A

4000001 20 C B

4000001 30 A A

Now when i give A to B range in the s_bilst selection scree field it should display only 2 entires with item 10 and 30.And when i give C in the range it should display only one entry with item 20...

for this i've got a if conditions to populate the concern output table field.

IF ( NOT vbup-fksaa IS INITIAL ) AND ( vbup-fksaa IN s_bilst ) .

itab-bilst = vbup-fksaa.

ELSEIF vbup-gbsta IN s_bilst.

itab-bilst = vbup-gbsta.

ELSE.

EXIT.

ENDIF.

This if condition works fine when i give only C in the selection screen but when i give A to B range in the selection screen it displays three entries which instead should only be 2 entries <b>without</b> the item 20 with fksaa as C........

The problem is simple when i have the sales order with above creteria but in my scenario why i'm consedering the gbsta is because at times some sales order has empty fksaa so i should then consider the gbsta entries......this is troubling me and i'm not able to find solutions for both this scenario......Please come up with better solution which could solve my above said problem.............

1 REPLY 1

Former Member
0 Kudos

IF s_blist-high is not initial.

SELECT * FROM vbup WHERE vbeln = vbap-vbeln AND

posnr = vbap-posnr AND

lfsta IN s_status AND

gbsta IN s_bilst .

ELSE

SELECT * FROM vbup WHERE vbeln = vbap-vbeln AND

posnr = vbap-posnr AND

lfsta IN s_status AND

fksaa IN s_bilst .

ENDIF

Rewards if useful....................

Minal