‎2007 Jul 30 9:47 AM
Hiii friends
i have a small problem in my code for displaying debit credit n balance value, when there is dmbtr values present for either Shkzg = 'H' or 'S' the in gives correct output but if for certain g/l codes both values r present then those get displayed of saperat lines, i want them to b printed on same line how can i do that?
‎2007 Jul 30 12:39 PM
Hi Dear check this code,
I have faced similar problem long time back try to solve using this code. Mean time if i recall it then i wil post you..
Reward Points,
Regard
Bohra
select statement to fetch 85% 0f local currency and document currency
*----
IF NOT it_pos[] IS INITIAL.
SELECT belnr wrbtr dmbtr INTO TABLE it_bseg FROM bseg
FOR ALL ENTRIES IN it_pos
WHERE belnr = it_pos-belnr AND
bukrs = it_pos-bukrs AND
gjahr = it_pos-gjahr AND
buzei = it_pos-buzei.
ENDIF.
CLEAR it_pos.
LOOP AT it_pos.
READ TABLE it_bseg INTO wa_bsegg WITH KEY belnr = it_pos-belnr.
IF sy-subrc EQ 0.
*changes new
CLEAR w_dmshb.
IF it_pos-dmshb < 0.
w_dmshb = it_pos-dmshb * -1.
ELSE.
w_dmshb = it_pos-dmshb.
ENDIF.
CLEAR w_wrshb.
IF it_pos-wrshb < 0.
w_wrshb = it_pos-wrshb * -1.
ELSE.
w_wrshb = it_pos-wrshb.
ENDIF.
*end changes
IF it_pos-dmshb < 0.
wa_bsegg-zdmbtr = ( w_dmshb + ( it_pos-zhwbas + it_pos-zhwste ) ) * -1.
wa_bsegg-zwrbtr = ( w_wrshb + ( it_pos-zfwbas + it_pos-zfwste ) ) * -1.
ELSE.
wa_bsegg-zdmbtr = w_dmshb - ( it_pos-zhwbas + it_pos-zhwste ).
wa_bsegg-zwrbtr = w_wrshb - ( it_pos-zfwbas + it_pos-zfwste ).
ENDIF.
MOVE : wa_bsegg-zwrbtr TO it_pos-zwrbtr,
wa_bsegg-zdmbtr TO it_pos-zdmbtr.
MODIFY it_pos.
ENDIF.
ENDLOOP.
select to fectch 100% of local currency and document currency, if doucment is reversed then
posting key for the relevant doucment is changed.
REFRESH rbschl.
CLEAR rbschl.
rbschl-sign = 'I'.
rbschl-option = 'EQ'.
rbschl-low = '40'.
APPEND rbschl.
CLEAR rbschl.
rbschl-sign = 'I'.
rbschl-option = 'EQ'.
rbschl-low = '50'.
APPEND rbschl.
REFRESH rhkont.
CLEAR rhkont.
rhkont-sign = 'I'.
rhkont-option = 'EQ'.
rhkont-low = '0000851001'.
APPEND rhkont.
CLEAR rhkont.
rhkont-sign = 'I'.
rhkont-option = 'EQ'.
rhkont-low = '0000710001'.
APPEND rhkont.
IF NOT it_pos[] IS INITIAL.
REFRESH it_bseg_n1.
SELECT belnr wrbtr dmbtr INTO TABLE it_bseg_n1 FROM bseg
FOR ALL ENTRIES IN it_pos
WHERE bukrs = it_pos-bukrs AND
belnr = it_pos-belnr AND
gjahr = it_pos-gjahr AND
bschl IN rbschl AND
koart = 'S' AND
hkont IN rhkont.
ENDIF.
CLEAR it_pos.
LOOP AT it_pos.
‎2007 Jul 30 9:57 AM
Hi
Sum up the values into a variable like
if itab-shkzg = 'H'.
v_amnt1 = v_amnt1 + itab-dmbtr.
else. "for shkzg = 'S'.
v_amnt2 = v_amnt2 + itab-dmbtr.
endif.
then use this variables further in the code.
<b>Reward points for useful Answers</b>
Regards
Anji
‎2007 Jul 30 10:03 AM
Hi Gaurav,
I think you are getting multiple entries for the given critera that both entries found for SHKZG = 'H' or 'S'. then sumup the value in the body of the loop and process into a final internal table at the AT END OF section. do not forget pass original work area to a local work area when appending to a final int table.
Regards,
Krishnendu
‎2007 Jul 30 11:58 AM
sorry or late reply is my net is not working
actually my problem is not multiple entries but entries which satisfies both
shkzg = 'h' as well as shkzg = 's' i.e. for certaint G/L accounts some amount get credited n some amount get debited and those values get printed on diff lines i want them to b printed on same line how can i do that.
‎2007 Jul 30 12:11 PM
Hi
I think that your problem can be solved ( not very elegant,but it will work ) in this way.
You can transfer ammounts to strings/char,add + or - as you want (by shifting till the end and one place back&putting + or - in this place,and than shifting back untill the end) and than concatenate them into one string (warning : take strings length in mind when you do so) which will be displayed in one line.
Regards
Yossi
‎2007 Jul 30 12:23 PM
‎2007 Jul 30 12:39 PM
Hi Dear check this code,
I have faced similar problem long time back try to solve using this code. Mean time if i recall it then i wil post you..
Reward Points,
Regard
Bohra
select statement to fetch 85% 0f local currency and document currency
*----
IF NOT it_pos[] IS INITIAL.
SELECT belnr wrbtr dmbtr INTO TABLE it_bseg FROM bseg
FOR ALL ENTRIES IN it_pos
WHERE belnr = it_pos-belnr AND
bukrs = it_pos-bukrs AND
gjahr = it_pos-gjahr AND
buzei = it_pos-buzei.
ENDIF.
CLEAR it_pos.
LOOP AT it_pos.
READ TABLE it_bseg INTO wa_bsegg WITH KEY belnr = it_pos-belnr.
IF sy-subrc EQ 0.
*changes new
CLEAR w_dmshb.
IF it_pos-dmshb < 0.
w_dmshb = it_pos-dmshb * -1.
ELSE.
w_dmshb = it_pos-dmshb.
ENDIF.
CLEAR w_wrshb.
IF it_pos-wrshb < 0.
w_wrshb = it_pos-wrshb * -1.
ELSE.
w_wrshb = it_pos-wrshb.
ENDIF.
*end changes
IF it_pos-dmshb < 0.
wa_bsegg-zdmbtr = ( w_dmshb + ( it_pos-zhwbas + it_pos-zhwste ) ) * -1.
wa_bsegg-zwrbtr = ( w_wrshb + ( it_pos-zfwbas + it_pos-zfwste ) ) * -1.
ELSE.
wa_bsegg-zdmbtr = w_dmshb - ( it_pos-zhwbas + it_pos-zhwste ).
wa_bsegg-zwrbtr = w_wrshb - ( it_pos-zfwbas + it_pos-zfwste ).
ENDIF.
MOVE : wa_bsegg-zwrbtr TO it_pos-zwrbtr,
wa_bsegg-zdmbtr TO it_pos-zdmbtr.
MODIFY it_pos.
ENDIF.
ENDLOOP.
select to fectch 100% of local currency and document currency, if doucment is reversed then
posting key for the relevant doucment is changed.
REFRESH rbschl.
CLEAR rbschl.
rbschl-sign = 'I'.
rbschl-option = 'EQ'.
rbschl-low = '40'.
APPEND rbschl.
CLEAR rbschl.
rbschl-sign = 'I'.
rbschl-option = 'EQ'.
rbschl-low = '50'.
APPEND rbschl.
REFRESH rhkont.
CLEAR rhkont.
rhkont-sign = 'I'.
rhkont-option = 'EQ'.
rhkont-low = '0000851001'.
APPEND rhkont.
CLEAR rhkont.
rhkont-sign = 'I'.
rhkont-option = 'EQ'.
rhkont-low = '0000710001'.
APPEND rhkont.
IF NOT it_pos[] IS INITIAL.
REFRESH it_bseg_n1.
SELECT belnr wrbtr dmbtr INTO TABLE it_bseg_n1 FROM bseg
FOR ALL ENTRIES IN it_pos
WHERE bukrs = it_pos-bukrs AND
belnr = it_pos-belnr AND
gjahr = it_pos-gjahr AND
bschl IN rbschl AND
koart = 'S' AND
hkont IN rhkont.
ENDIF.
CLEAR it_pos.
LOOP AT it_pos.