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

regarding select check

Former Member
0 Kudos
195

Hi Friends

Pls help me write this code properly i have to check for rest all select options with s_pernr and without s_pernr. but this code is not checking properly

Its like user can or can't enter value in either of the field but at last with all the combination of data the information shd correct .

my prob is i dont want to make any field mandatory so we cant use AND and if i use OR it give me so many unwanted entrires too

This is with s_pernr

if ( ( PNPSTAT2[] is not initial ) or ( PNPWERKS[] is not initial ) or ( PNPBTRTL[] is not initial )

or ( PNPPERSG[] is not initial ) or ( PNPPERSK[] is not initial ) or ( PCHOBJID[] is not initial )

and ( s_pernr[] is not initial ) ).

if sy-subrc = 0.

select pernr werks persg persk btrtl orgeh

from pa0001 into corresponding fields of table ito1

where pernr in s_pernr

and endda ge sy-datum

and begda le sy-datum

and ( werks in pnpwerks ) or ( werks EQ space )

and ( persg in pnppersg ) or ( persg EQ space )

and ( persk in pnppersk ) or ( persk EQ space )

and ( btrtl in pnpbtrtl ) or ( btrtl EQ space )

and ( orgeh in pchobjid ) or ( orgeh EQ space ).

if sy-subrc = 0.

Do some thing

elseif sy-subrc NE 0.

Message i000(zmess) .

endif.

endif.

this is without s_pernr

elseif ( ( PNPSTAT2[] is not initial ) or ( PNPWERKS[] is not initial )

or ( PNPBTRTL[] is not initial ) or ( PNPPERSG[] is not initial )

or ( PNPPERSK[] is not initial ) or ( PCHOBJID[] is not initial )

and ( s_pernr[] is initial ) ).

select pernr werks persg persk btrtl orgeh

from pa0001 into corresponding fields of table ito2

where ( werks in pnpwerks ) or ( werks EQ space )

and ( persg in pnppersg ) or ( persg EQ space )

and ( persk in pnppersk ) or ( persk EQ space )

and ( btrtl in pnpbtrtl ) or ( btrtl EQ space )

and ( orgeh in pchobjid ) or ( orgeh EQ space ).

do some thing.

Regards

Meeta

2 REPLIES 2
Read only

Former Member
0 Kudos
137

HI,

Check this

if ( (  PNPSTAT2[] is not initial  or  PNPWERKS[] is not initial  or  PNPBTRTL[] is not initial 
or  PNPPERSG[] is not initial  or  PNPPERSK[] is not initial  or  PCHOBJID[] is not initial )
and  s_pernr[] is not initial ).

select pernr werks persg persk btrtl orgeh
from pa0001 into corresponding fields of table ito1
where pernr in s_pernr
and endda ge sy-datum
and begda le sy-datum
and ( werks in pnpwerks or  werks EQ space )
and ( persg in pnppersg  or  persg EQ space )
and ( persk in pnppersk  or  persk EQ space )
and ( btrtl in pnpbtrtl  or  btrtl EQ space )
and ( orgeh in pchobjid  or  orgeh EQ space ).
if sy-subrc = 0.

Do some thing

elseif sy-subrc NE 0.
Message i000(zmess) .
endif.

this is without s_pernr

elseif ( ( PNPSTAT2[] is not initial  or  PNPWERKS[] is not initial 
or  PNPBTRTL[] is not initial  or  PNPPERSG[] is not initial 
or  PNPPERSK[] is not initial  or  PCHOBJID[] is not initial )
and ( s_pernr[] is initial ) ).

select pernr werks persg persk btrtl orgeh
from pa0001 into corresponding fields of table ito2
where ( werks in pnpwerks  or  werks EQ space )
and ( persg in pnppersg  or  persg EQ space )
and ( persk in pnppersk  or  persk EQ space )
and ( btrtl in pnpbtrtl  or  btrtl EQ space )
and ( orgeh in pchobjid  or  orgeh EQ space ).

do some thing.

Read only

Former Member
0 Kudos
137

ok