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: 

hlp req

Former Member
0 Kudos
108

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?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
68

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.

6 REPLIES 6

Former Member
0 Kudos
68

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

krishnendu_laha
Active Contributor
0 Kudos
68

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

0 Kudos
68

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.

0 Kudos
68

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

0 Kudos
68

hii yossi

im not able to get what u wnat to say...

Former Member
0 Kudos
69

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.