10-17-2008 1:39 PM
hi
i have an issue in the report, the problem is
in the selection screen i have an WBS ELEMENT as an select option(there is no belnr in selection scrren)
for eg- if i enter
COMP CODE = 0010
WBS ELEMNT = 23456
YEAR = 2008.
For the above details there are 2 line items in table for that particular belnr as
BUKRS BELNR YEAR BUZEI WBSELT SHKZG
0010 40000050 2008 001 23456 S
0010 40000050 2008 002 00000 H C
there is only one line item for WBS ELEMENT IN BSEG TABLE.
So i am getting debit(SHKZG-S) value but i am not getting credit value if i write the select query as below.
SELECT bukrs
belnr
gjahr
buzei
sgtxt
kostl
aufnr
lifnr
ebeln
projk
FROM bseg
into table gt_bseg
for all entries in i_get
where bukrs eq i_get-bukrs
and belnr eq i_get-belnr
and gjahr eq i_get-ryear
and buzei eq i_get-buzei
and projk in s_projk.
please help how to get both values.help with code
thanks in advance,
Edited by: Julius Bussche on Oct 17, 2008 3:44 PM
10-17-2008 1:52 PM
Hi latha
try this logic
first get the second record , with that BELNR get the first record
For the BSEG it is not possible to use for all entries (cluster table).
SELECT PROJK BELNR KOART HKONT WRBTR FROM BSEG INTO TABLE IT_REV WHERE PROJK = WA_WBS-PSPNR AND KOART = 'S'.
if sy-subrc = 0.
loop at IT_REV INTO WA_REV.
at NEW BELNR.
select single BELNR KOART WRBTR PROJK FROM BSEG INTO WA_REV_VAL WHERE BELNR = WA_REV-BELNR AND KOART = 'D'.
IF SY-SUBRC = 0.
v_total = v_total + WA_REV_VAL-WRBTR.
endif.
endat.
endloop.
revert back for any issue
10-17-2008 1:54 PM
You are using "and buzei eq i_get-buzei" when there are two different buzei values in the data you are trying to retrieve. Check if that is really needed because that could be the problem.
10-17-2008 2:16 PM
along with buzei i have given s_projk in select query so only one belnr has projk, so i am getting only one line item but i need 2 for that particular document,
please help me.
10-17-2008 2:30 PM
if u get one line item , then by using that BELNR u can get the another line item or line items also
10-17-2008 2:34 PM
HI SRINIVASU,
Please help me with my code
SELECT bukrs
belnr
gjahr
buzei
sgtxt
kostl
aufnr
lifnr
ebeln
projk
FROM bseg
into table gt_bseg
for all entries in i_get
where bukrs eq i_get-bukrs
and belnr eq i_get-belnr
and gjahr eq i_get-ryear
and buzei eq i_get-buzei
and projk in s_projk.
10-17-2008 2:44 PM
hi
after the select query all the values which are there with PROJK
will come in gt_bseg.
then
LOOP AT GT_BSEG.
select single BELNR KOART WRBTR PROJK FROM BSEG INTO wa_bseg WHERE BELNR = BSEG-BELNR AND KOART = 'D'.
append the values of wa_bseg to it_bseg.
endloop.
i have faced same problem if u observe the table BSEG if KOART value is D , in that line item you cant get the PROJK value so
from above select statemnt u can retrieve that value
Revert back if furthet issue
10-17-2008 3:10 PM
srinivasu
if for a particualar projk in selection screen i have onle one entry.
for the projk there is a belnr.
this belnr has 2 line items from bseg table but projk is only for one line item.
so from the following select query i will get one line item into gt_bseg but i need other one also.
as you saild if i loopa at gt_bseg.
in gt_bseg there is only one value how can i get second one.
SELECT bukrs
belnr
gjahr
buzei
sgtxt
kostl
aufnr
lifnr
ebeln
projk
FROM bseg
into table gt_bseg
for all entries in i_get
where bukrs eq i_get-bukrs
and belnr eq i_get-belnr
and gjahr eq i_get-ryear
and buzei eq i_get-buzei
and projk in s_projk.
please help me .
thanks in advance.
10-17-2008 3:17 PM
oh my god
SELECT bukrs
belnr
gjahr
buzei
sgtxt
kostl
aufnr
lifnr
ebeln
projk
FROM bseg
into table gt_bseg
for all entries in i_get
where bukrs eq i_get-bukrs
and belnr eq i_get-belnr
and gjahr eq i_get-ryear
and buzei eq i_get-buzei
and projk in s_projk.
then
LOOP AT GT_BSEG.
select single BELNR KOART WRBTR PROJK FROM BSEG INTO wa_bseg WHERE BELNR = BSEG-BELNR AND KOART = 'D'.
append the values of wa_bseg to it_bseg.
endloop.
i have faced same problem if u observe the table BSEG if KOART value is D , in that line item you cant get the PROJK value so
from above select statemnt u can retrieve that value
finally in it_bseg u can get the lineitems which are emitted by your select query
i hope you understood
10-17-2008 3:27 PM
i kept the following code even i am not getting the other value
please check my code.
SELECT bukrs
belnr
gjahr
buzei
sgtxt
kostl
aufnr
lifnr
ebeln
projk
FROM bseg
into table gt_bseg
for all entries in i_join
where bukrs eq i_join-bukrs
and belnr eq i_join-belnr
and gjahr eq i_join-ryear
and buzei eq i_join-buzei
and projk in s_projk.
LOOP AT GT_BSEG.
select single bukrs BELNR gjahr buzei sgtxt kostl aufnr lifnr ebeln projk FROM BSEG INTO wa_bseg WHERE BELNR = gt_BSEG-BELNR.
append wa_bseg to it_bseg.
endloop.
10-17-2008 3:33 PM
The SELECT into table gt_bseg uses the entire key, so of course only one record is selected.
Rob
Edited by: Rob Burbank on Oct 17, 2008 10:36 AM