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: 

Select-options problem

former_member1284402
Participant
0 Kudos

hi guru's,

i m passing 4 values of HKONT in select options and i want to pic some fields from BSIS table.

but problem is that i m getting only 2 HKONT values in itab according to where condition while i need the other 2 HKONT must be there in itab. so i need total 4 rows in ITAB even we dont get values for other 2 from BSIS.

code.

SELECT bukrs hkont gjahr monat shkzg prctr FROM bsis INTO table itab

WHERE hkont in hkont

AND bukrs IN bukrs

AND prctr IN prctr

AND gjahr IN gjahr

AND monat IN monat.

regards Saurabh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Did you checked entries in se11 of BSIS table . How many records are available in BSIS table ?

10 REPLIES 10

former_member184657
Active Contributor
0 Kudos

duplicate post

pk

ashwin_bhat
Participant
0 Kudos

Query the BSIS table in SE16 transaction. Do you really get 4 records or do the other selection fields that you have added filter them out to two records?

tarangini_katta
Active Contributor
0 Kudos

Hi Saurabh,

USe the dynamic select otions.Then u wull get the correct answer.

OK

Thanks,

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Saurabh,

Did you check in BSIS table for the other 2 HKONTs. Are there recs available in BSIS?

BR,

Suhas

Former Member
0 Kudos

Did you checked entries in se11 of BSIS table . How many records are available in BSIS table ?

0 Kudos

hi all thanx for reply,

i had checked and there are only 2 records present according to where condition. but i need all 4 HKONT in ITAB while for other 2 i dont need values only empty fields wud be there.

Exa:

ITAB : i need like this.

HKONT PRCTR MONAT DMBTR

15000 20000 10 250.00

16000 20000 10 220.00

17000 -


-


-


18000 -


-


-


regards saurabh.

0 Kudos

Then do one thing.

After geetting the data from itab.

USE APPEND itab.

append itab.

THen it will insert two empty rows for you.

0 Kudos

Hi Sourabh,

In that case while you output the data if you are using write then Loop on your select option and write hkont from there..

based on hkont loop on your itab..something like this..

Here you can also fill hkont based on ur select-option hkont range...


LOOP AT hkont.
  LOOP at itab where hkont = hkont-hkont.
    "write..
    "flag = X
  ENDLOOP.
  IF flag <> X
   write hkont.
  clear flag.
  ENDIF.
ENDLOOP.

Also you may append rows in itab based on the entries in hkont table fileed from the hkont range.

For you requirement i will suggest you to get all hkont based on your SO hkont from skb1.

Then append blank lines in your itab for those hkont which donot have any entry...

Reason for this is because you may feed a range also in Select Option...


LOOP AT it_hkont.
READ TABLE itab with key hkont = it_hkont-hkont.
IF sy-subrc <> 0.
itab-hkont = it_hkont-hkont.
APPEND itab.
ENDIF.
ENDLOOP.

Edited by: Ankesh Saharan on Jan 28, 2009 5:05 PM

0 Kudos

Hello Saurabh,

Try this code:


LOOP AT HKONT.
READ TABLE ITAB TRANSPORTING NO FIELDS
WITH KEY HKONT = HKONT-LOW.
IF SY-SUBRC NE 0.
ITAB-HKONT = HKONT-LOW.
APPEND ITAB.
ENDIF. 
ENDLOOP.

You donot have to LOOP at ITAB to fill the HKONT.

BR,

Suhas

Former Member
0 Kudos

Hi

SELECT bukrs hkont gjahr FROM bsis INTO table i_tab

WHERE

(hkont in hkont AND bukrs IN bukrs AND gjahr IN gjahr AND prctr IN prctr)

or hkont in hkont.

sort i_tab.

delete adjacent duplicates from i_tab.

Hope this helps

Regards,

Jayanthi.K