2009 Mar 26 5:54 AM
I have a problem in my report where
i have made a loop at it_pos into wa_pos
;
;
;
;
in my Read statment
READ TABLE it_bseg INTO wa_bseg WITH KEY belnr = wa_pos-belnr.
IF sy-subrc = 0.
wa_final-gross = wa_bseg-dmbtr.
endif.
iF WA_BSEG-HKONT = '0000500100'.
WA_FINAL-NET = WA_BSEG-DMBTR.
Endif.
if wa_bseg-hkont = '0000301500 '.
wa_final-sertax = wa_bseg-dmbtr.
Endif.
APPEND wa_final TO it_final.
CLEAR: wa_final, wa_kna1, wa_bseg, wa_adv, wa_brand.
ENDLOOP.
.............
my problem is while debugging iam getting all the Gl(hkont) correctly but all the amount
gets updated in wa_final-gross field itself.
i.e for every gl(hkont) it has to corresponding get into that field
ie if hkont = '000301500'
it has to be filled in my wa_final-sertax and so....
but instead it gets filled in my wa_Final-gross itself .
so therefore
gross and net is getting filled in the alv but it is shatered and comes alternatively jumbled.
what to do ... help me out
tjhanx in advance
2009 Mar 26 7:12 AM
Hi,
Plz check in your work area whether the values are coming properly or not, And accordingly you can change your logic, And if the values are proper then plz cross check the structure of your table and work area.
Hi,
Plz check in your work area whether the values are coming properly or not, And accordingly you can change your logic, And if the values are proper then plz cross check the structure of your table and work area.
2009 Mar 26 6:09 AM
Hi,
I think you have some duplicate entries in the table it_bseg. If you need to read the duplicate entries as well, you have to use only the following code:
loop at it_bseg into wa_bseg where belnr = wa_pos-belnr.
wa_final-gross = wa_bseg-dmbtr.
iF WA_BSEG-HKONT = '0000500100'.
WA_FINAL-NET = WA_BSEG-DMBTR.
Elseif wa_bseg-hkont = '0000301500 '.
wa_final-sertax = wa_bseg-dmbtr.
Endif.
APPEND wa_final TO it_final.
clear: wa_bseg.
endloop.
CLEAR: wa_final, wa_kna1, wa_adv, wa_brand.
ENDLOOP.
If your issue cannot be solved with this, then please show your full code. That is the code having loop and endloop. Then it helps you solve the problem easily.
Best Regards,
Suresh
2009 Mar 26 6:11 AM
Hi,
According to me conditions handled in IF conditions are not proper, try this way:
############################
loop at it_pos into wa_pos
;
;
;
;
READ TABLE it_bseg INTO wa_bseg WITH KEY belnr = wa_pos-belnr.
IF sy-subrc = 0.
IF WA_BSEG-HKONT = '0000500100'.
WA_FINAL-NET = WA_BSEG-DMBTR.
ELSEIF wa_bseg-hkont = '0000301500 '.
wa_final-sertax = wa_bseg-dmbtr.
ELSE.
wa_final-gross = wa_bseg-dmbtr.
EndIF.
ENDIF.
APPEND wa_final TO it_final.
CLEAR: wa_final, wa_kna1, wa_bseg, wa_adv, wa_brand.
ENDLOOP.
############################
This should work according to what is been described as expected output.
Hope this solves your problem.
Regards,
Brajvir
2009 Mar 26 6:29 AM
hi thanks for helping out ....but its not fetching the value ....its still the same
i have modified as
READ TABLE it_bseg INTO wa_bseg WITH KEY belnr = wa_pos-belnr.
IF sy-subrc = 0.
iF WA_BSEG-HKONT = '0000500100'.
WA_FINAL-NET = WA_BSEG-DMBTR.
elseif wa_bseg-hkont ='0000300450'.
wa_Final-Educess = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000300455'.
wa_final-cesspay = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000209800'.
. wa_final-gross = wa_bseg-dmbtr.
endif.
ENDIF.
2009 Mar 26 6:32 AM
Hi,
Please mention your code correctly.
In the new code mentioned by you, there is no sertax field.
Please check the code.
Best Regards,
Suresh
2009 Mar 26 6:23 AM
Hi,
I do agree with Brajveer.. if conditions are not properly handled. Please make changes as suggested by him and then post if issue persist.
Regards,
Gaurav
2009 Mar 26 6:31 AM
Hey Rachel...
Can you give.. the part of the code where you are populating WA_FINAL-GROSS .. and also the codes which are above that and below that.......
2009 Mar 26 6:38 AM
hi subzero....
F it_pos[] IS NOT INITIAL.
SELECT bukrs belnr gjahr xref1 xref2 kunnr buzei dmbtr hkont koart
FROM bseg INTO CORRESPONDING FIELDS OF TABLE it_bseg
FOR ALL ENTRIES IN it_pos
WHERE bukrs = it_pos-bukrs
AND belnr = it_pos-belnr
AND gjahr = it_pos-gjahr.
ENDIF.
;
;
;
;
SORT it_bseg BY belnr.
LOOP AT it_pos INTO wa_pos.
READ TABLE it_kna1 INTO wa_kna1 WITH KEY kunnr = wa_pos-konto.
IF sy-subrc = 0.
wa_final-name1 = wa_kna1-name1 .
ENDIF.
wa_final-kunnr = wa_pos-konto.
wa_final-ktokd = wa_pos-ktokd.
wa_final-xref1 = wa_pos-xref1.
COMMENTED SINCE VALUE NOT GETTING STORED IN POS TABLE
wa_final-net = wa_pos-bwwrt.
READ TABLE it_bseg INTO wa_bseg WITH KEY belnr = wa_pos-belnr.
IF sy-subrc = 0.
iF WA_BSEG-HKONT = '0000500100'.
WA_FINAL-NET = WA_BSEG-DMBTR.
elseif wa_bseg-hkont ='0000300450'.
wa_Final-Educess = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000300455'.
wa_final-cesspay = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000209800'.
. wa_final-gross = wa_bseg-dmbtr.
endif.
ENDIF.
APPEND wa_final TO it_final.
Endif.
CLEAR: wa_final, wa_kna1, wa_bseg, wa_adv, wa_brand.
ENDLOOP.
2009 Mar 26 6:46 AM
Hi...rachel..
The problem may be because of the fact that you are not passing all the key fields which reading the table IT_BSEG.
Change the below read statement..as given and check out..
READ TABLE it_bseg INTO wa_bseg WITH KEY bukrs = wa_pos-bukrs belnr = wa_pos-belnr gjahr = wa_pos-gjahr.
If possible, include BUZEI also in the condition.....
Check out and see if this works..
2009 Mar 26 7:02 AM
hi
i specified the condition as u said but then its fetching value only for gross nothing else.....
buzei is not present in it_pos
and one more thing is that when i debugg in it_pos only one hkont is there ie for Gross , is it why its getting value for only gross...wat ele can be done
2009 Mar 26 7:04 AM
2009 Mar 26 7:06 AM
Rachel...
What is the HKONT value comeing for different iterations of the looop..
is the same value comin for each iteration or are you getting different values for HKONT.....
2009 Mar 26 7:13 AM
corresponding value for 209800(hkont) value for gross is getting filled
rest no values is getting populated
for eg
WA_BSEG-HKONT 0000209800
wa_final-gross 20989.00
other than this other Hkont and amt r not populating
2009 Mar 26 7:03 AM
Hi,
Instead of reading, loop at internal table. BSEG has four primary key but you are reading only by Doument number.
Regards,
Prashant.
2009 Mar 26 7:06 AM
yes prashant but now i have corrected and added all my primary key in the coditon but then iam getting value only for one field(Gross) rest not getting filled
2009 Mar 26 7:12 AM
Hi,
Plz check in your work area whether the values are coming properly or not, And accordingly you can change your logic, And if the values are proper then plz cross check the structure of your table and work area.
2009 Mar 26 7:18 AM
hmm.....
jus check whether CESSPAY.. EDUTAX...SERTAX ..fields etc...are of the same type as DMBTR...?
2009 Mar 26 9:02 AM
as read stmet will read only single record i am using loop inside loop but value is not populating in
where condition where belnr = it_pos-belnr
LOOP AT it_pos INTO wa_pos.
READ TABLE it_kna1 INTO wa_kna1 WITH KEY kunnr = wa_pos-konto.
IF sy-subrc = 0.
wa_final-name1 = wa_
;
;
;
;loop at it_bseg into wa_bseg where belnr = it_pos-belnr.
iF WA_BSEG-HKONT = '0000500100'.
WA_FINAL-NET = WA_BSEG-DMBTR.
elseif wa_bseg-hkont ='0000300450'.
wa_Final-Educess = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000300455'.
wa_final-cesspay = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000209800'.
. wa_final-gross = wa_bseg-dmbtr.
endif.
Endloop.
APPEND wa_final TO it_final.
CLEAR: wa_final, wa_kna1, wa_bseg, wa_adv, wa_brand.
ENDLOOP.
2009 Mar 26 9:05 AM
hey.... rachel..
you are doing a mistake..
you are populating the WA_FINAL inside a loop... but you are appending it outside that loop.....
thats where its going wrong..... !!.....
2009 Mar 26 9:06 AM
Try changing the code..as given below
;loop at it_bseg into wa_bseg where belnr = it_pos-belnr.
iF WA_BSEG-HKONT = '0000500100'.
WA_FINAL-NET = WA_BSEG-DMBTR.
elseif wa_bseg-hkont ='0000300450'.
wa_Final-Educess = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000300455'.
wa_final-cesspay = wa_bseg-dmbtr.
elseif wa_bseg-hkont = '0000209800'.
. wa_final-gross = wa_bseg-dmbtr.
endif.
APPEND wa_final TO it_final. " Add this statement
Endloop.
*APPEND wa_final TO it_final.---comment this
Cheers..
2009 Mar 26 9:08 AM
in this where belnr = it_pos-belnr. value not populating
loop at it_bseg into wa_bseg where belnr = it_pos-belnr.
2009 Mar 26 10:37 AM
Rachel..
another silly mistake..
I think you have declared IT_POS as an internal table with header line...
But you looping and putting the value in WA_POS...
So change the below statement
where belnr = wa_pos-belnr.
Cheers
2009 Mar 26 10:42 AM
2009 Mar 26 10:44 AM
rachel...
where was the mistake exactly...
wa_pos was written as it_pos...
here only right...??
Regards,
Subash R
2009 Mar 26 11:01 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |