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

urgent....plz help...simple code

Former Member
0 Likes
1,579

data.....

i_pernr type p0001-pernr,

i_parea type p0001-werks,

i_barea type p0167-barea,

i_btype type p0167-pltyp,

i_bplan type p0167-bplan,

......

select-options s_pernr for i_pernr.

  • default '1000' option EQ sign I.

select-options s_parea for i_parea.

select-options s_barea for i_barea.

select-options s_btype for i_btype.

select-options s_bplan for i_bplan.

......

select pernr barea pltyp bplan begda endda from pa0167 into

corresponding fields of table i_0167

where ( barea in s_barea and

pltyp in s_btype and

bplan in s_bplan and

begda <= sy-datum and

endda >= sy-datum ).

......

select pernr werks from pa0001 into corresponding fields of table

i_0001 for all entries in i_0167 where pernr = i_0167-pernr and begda

<= sy-datum and endda >= sy-datum.

....

syntax is correct

but when i do the select options and select single employee it does not work...

not even for other select options....

my other statements are all right ...only problem is select options

plz hel

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
1,549

Hello new Abaper,

select pernr barea pltyp bplan begda endda from pa0167 into
corresponding fields of table i_0167
where ( barea in s_barea and
pernr in s_pernr                         <--- add!
pltyp in s_btype and
bplan in s_bplan and
begda <= sy-datum and
endda >= sy-datum ).

Cheers

old Abaper

16 REPLIES 16
Read only

Former Member
0 Likes
1,549

Hi,

Use

Tables:pa0001,pa0167.

to ur below code...n then try...

Regards,

Kaveri

Read only

Former Member
0 Likes
1,549

hai u have used d structures.. plz use d tables pa0001 for d selection of pernr(employee)

regards,

raji

Read only

former_member404244
Active Contributor
0 Likes
1,549

Hi,

U cannot use select single statement for slect-options.instead use upto 1 rows statement for select.

Regards,

Nagaraj

Read only

Former Member
0 Likes
1,549

i tried all these options but none work

i ma not using single select i

i am selecting data into inernal table

plz any on ehelp

Read only

0 Likes
1,549

Hi ,

Do u mean to say when making a selection for i_0167 ,

your select-options chek is getting neglected , or there is some other issue .

Read only

0 Likes
1,549

i_0001 is my driver internal table.... during filling and writing data i am looping that internal table .....

i also have in my code these select statements

select pernr subty favor fanam fgbdt from pa0021 into table i_0021

for all entries in i_0001 where pernr = i_0001-pernr and

subty ne '7' and begda <= sy-datum and endda >= sy-datum.

select pernr perid stras locat ort01 state land1 pstlz telnr from pa0106

into table i_0106 for all entries in i_0001 where pernr = i_0001-pernr

and begda <= sy-datum and endda >= sy-datum.

and from here i am filling data into my final internal table

i hope my logic is correct ...

when i run the final program ...my select options are not working....whatever i enter on screen has no effect on output.....

rest of the code is fine.....

i made the s_pernr change ...but for some reason its not working.

Read only

ThomasZloch
Active Contributor
0 Likes
1,550

Hello new Abaper,

select pernr barea pltyp bplan begda endda from pa0167 into
corresponding fields of table i_0167
where ( barea in s_barea and
pernr in s_pernr                         <--- add!
pltyp in s_btype and
bplan in s_bplan and
begda <= sy-datum and
endda >= sy-datum ).

Cheers

old Abaper

Read only

0 Likes
1,549

Thanks Old abaper

now ...after your ur changes...my output is strange...if i include a single value its working fine...for some ranges is its ok.....dont kknow why its not working for some values...

I guess i am demanding more here...i will try and debug again...but i dont have enough time

...any suggestions would be helpful....i will try everthing...i ma struck here for past few hours...

have to solve today

thanks again

Read only

0 Likes
1,549

Hi ,

While declaring ur select options ,

directly refer to the table fields

Include the line

TABLES: pa0001,pa0167.

select-options s_pernr for pa0001-pernr.

  • default '1000' option EQ sign I.

select-options s_parea for pa0167-parea.

select-options s_barea for pa0167-barea.

select-options s_btype for pa0167-btype.

select-options s_bplan for pa0167-bplan.

And while making a selection

try to select the fields in the order they appear in the table

like

pernr

endda

begda

barea

etc

and so on .

And then check .

Regards

Read only

0 Likes
1,549

Hi ,

Am sorry for the last msg , please revet to it .

While declaring ur select options ,

directly refer to the table fields

Include the line

TABLES: pa0001,pa0167.

select-options s_pernr for pa0001-pernr.

  • default '1000' option EQ sign I.

select-options s_parea for pa001-werks.

select-options s_barea for pa0167-barea.

select-options s_btype for pa0167-pltyp.

select-options s_bplan for pa0167-bplan.

And while making a selection

try to select the fields in the order they appear in the table

like

pernr

endda

begda

barea

etc

and so on .

And then check .

Regards

Read only

0 Likes
1,549

almost ther....

now....while i enter an invalid number ..it does not work...it is giving me all the data....

god..this is getting more and more comples for me....

can any one clear me with select-options logic.......

thnaks santosh and other for ur time

plz help

Read only

0 Likes
1,549

that's a classic error, always check that internal table has values before doing FOR ALL ENTRIES:

if i_0167[] is not initial.      <-- add!
  select pernr werks from pa0001 into corresponding fields of table
  i_0001 for all entries in i_0167 where pernr = i_0167-pernr and begda
  <= sy-datum and endda >= sy-datum.
endif.       <-- add!

Read only

0 Likes
1,549

thnx Old abaper.... Thomas....cheers buddy

for some reason ur statement did not work

i have to do it this way...

if not i_0167[] is initial.

very curious to know why?

thanks kaveri and other for your time

...atlast solved

u may or may not answer my question....

but some feed back will be good for this....

Abaper New

Read only

Former Member
0 Likes
1,549

Hi Abaper,

select query picks up un ne cessary values when the select options value are not valid..

u need to validate it by..

if it is a select option ..if u give the low value which is invalid then it takes all values...

select single pernr from pa0000 where pernr in s_pernr.

if sy-subrc eq 0.

continue.........

else.

message 'enter valid pernr' type 'I'.

endif.

as i said earlier give tables:pa0000,pa0001,,..

Regards,

Kaveri

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,549

s_parea and s_parea are passed no where in u r query....include it...it will get okay...

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,549

s_pernr and s_parea are passed no where in u r query....include it...it will get okay...