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

ALV Report. filter

Former Member
0 Likes
723

hi,

IF p_hkont IS INITIAL.

IF S_GSBER IS INITIAL.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

lifnr IN s_lifnr AND "Customer

umskz = p_umskz AND

budat <= p_budat.

ELSE.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

lifnr IN s_lifnr AND "Customer

umskz = p_umskz AND

budat <= p_budat.

ENDIF.

else.

IF S_GSBER IS INITIAL.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

hkont = p_hkont AND "GL accnt

umskz = p_umskz AND

GSBER IN S_GSBER AND

budat <= p_budat.

ELSE.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

hkont = p_hkont AND "GL accnt

umskz = p_umskz AND

GSBER IN S_GSBER AND

budat <= p_budat.

ENDIF.

ENDIF.

IF p_hkont IS INITIAL.

IF S_GSBER IS INITIAL.

if s_lifnr is NOT initial.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

lifnr IN s_lifnr AND "Customer

umskz = p_umskz AND

budat <= p_budat.

ELSE.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

lifnr IN s_lifnr AND "Customer

umskz = p_umskz AND

budat <= p_budat.

ENDIF.

ENDIF.

else.

IF S_GSBER IS INITIAL.

if s_lifnr is NOT initiaL.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

hkont = p_hkont AND "GL accnt

umskz = p_umskz AND

GSBER IN S_GSBER AND

budat <= p_budat.

ELSE.

SELECT * FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL' AND

hkont = p_hkont AND "GL accnt

umskz = p_umskz AND

GSBER IN S_GSBER AND

budat <= p_budat.

ENDIF.

endif.

endif.

i am trying to filter gsber and lifnr at atime. but i am not able to filter with this code .give me solution.urgent.

Edited by: vasanth kandula on Jan 1, 2008 10:23 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
696

simple,

SELECT *

FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL'

AND hkont = p_hkont

AND umskz = p_umskz

AND budat <= p_budat.

u can add lifnr + gsber in where condition. do not put obligatory in select-options. if your user want all data they keep blank in gsber and lifnr. if they need data base on gsber and lifnr they will enter filter data on selection-screen only.

raj

simple,

SELECT *

FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL'

AND hkont = p_hkont

AND umskz = p_umskz

AND budat <= p_budat.

u can add lifnr + gsber in where condition. do not put obligatory in select-options. if your user want all data they keep blank in gsber and lifnr. if they need data base on gsber and lifnr they will enter filter data on selection-screen only.

raj

4 REPLIES 4
Read only

Former Member
0 Likes
696

vasanth,

u r confuse between parameter and select-options characteristic.

u do not need to check s_gsber initial or s_lifnr is initial.

Directly u can put in where condition. if is is blank no record will be selected. if possible convert your parameter in select-options and put in where condition. within single select statement u can fetch data...

raj

Read only

0 Likes
696

hi,.

Thanks for you reply.

i need to display with out filter of gsber and lifner also and give me ur syntax also.

my requriment is :

if i given gsber input on selection screen i need to display particular gsber only and

if i given lifner input without gsber i need to display particular lifner details only and

if i given gsber and lifner on selction screen i need to display for particular lifner and plant only and

if i am not given gsber and lifner also i need to display output

here gsber and lifner both are select-options.

please give me solution on that scenario.

Edited by: vasanth kandula on Jan 1, 2008 10:55 AM

Edited by: vasanth kandula on Jan 1, 2008 10:56 AM

Read only

Former Member
0 Likes
697

simple,

SELECT *

FROM bsik

INTO TABLE ibsik

WHERE bukrs = 'DHPL'

AND hkont = p_hkont

AND umskz = p_umskz

AND budat <= p_budat.

u can add lifnr + gsber in where condition. do not put obligatory in select-options. if your user want all data they keep blank in gsber and lifnr. if they need data base on gsber and lifnr they will enter filter data on selection-screen only.

raj

Read only

0 Likes
696

fgffssf

Edited by: vasanth kandula on Jan 2, 2008 3:58 PM