Skip to Content
0
Former Member
Sep 19, 2007 at 09:43 PM

Conditions problem

22 Views

Hi every one,

my requirement is as below.....

SELECT lfsta

fksaa

gbsta FROM vbup INTO TABLE t_vbup

WHERE vbeln = vbap-vbeln AND

posnr = vbap-posnr AND

lfsta IN s_status AND

gbsta IN s_bilst AND

fksaa IN s_bilst.

IF sy-subrc NE 0 .

SELECT lfsta

fksaa

gbsta FROM vbup INTO TABLE t_vbup

WHERE vbeln = vbap-vbeln AND

posnr = vbap-posnr AND

lfsta IN s_status AND

fksaa IN s_bilst.

ELSEIF sy-subrc NE 0.

SELECT lfsta

fksaa

gbsta FROM vbup INTO TABLE t_vbup

WHERE vbeln = vbap-vbeln AND

posnr = vbap-posnr AND

lfsta IN s_status AND

gbsta IN s_bilst.

ENDIF.

when the first query fails it should check in second and then if it fails then it should check in third.....all the conditions for first to entries are satisfying and my logic is working gud.....but there is a problem in third query if never populates into table......but when i take this query out of the if and elseif condition it works properly but my requirement fails for the given scenario.....how can i make this third qurey work properly without effecting my scenario requirement.....