2009 Jan 28 11:04 AM
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.
2009 Jan 28 11:14 AM
Did you checked entries in se11 of BSIS table . How many records are available in BSIS table ?
2009 Jan 28 11:06 AM
2009 Jan 28 11:06 AM
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?
2009 Jan 28 11:06 AM
Hi Saurabh,
USe the dynamic select otions.Then u wull get the correct answer.
OK
Thanks,
2009 Jan 28 11:07 AM
Hello Saurabh,
Did you check in BSIS table for the other 2 HKONTs. Are there recs available in BSIS?
BR,
Suhas
2009 Jan 28 11:14 AM
Did you checked entries in se11 of BSIS table . How many records are available in BSIS table ?
2009 Jan 28 11:23 AM
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.
2009 Jan 28 11:26 AM
Then do one thing.
After geetting the data from itab.
USE APPEND itab.
append itab.
THen it will insert two empty rows for you.
2009 Jan 28 11:30 AM
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
2009 Jan 28 11:37 AM
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
2009 Jan 28 11:39 AM
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