‎2014 Apr 25 6:29 AM
Dear all,
I am facing a problem with alignment in one classical report.
Requirement is debit ,credit amount's sum will at end of every g/l as new line.
Text will be closing balance - then amount.
My amount & text is coming ,but not properly.
All document will come & then closing balance will come as new line with ULINE.
Code part is: -
SORT it_bsas by hkont.
LOOP AT it_bsas INTO wa_bsas.
if wa_bsas-shkzg = 'H'.
WA_OUT-DMBTR = WA_BSaS-DMBTR.
WRITE : wa_out-dmbtr UNDER f LEFT-JUSTIFIED.
lv_sum1 = lv_sum1 + wa_out-dmbtr.
ELSEIF wa_bsas-shkzg = 'S'.
WA_OUT-DMBTR1 = WA_BSaS-DMBTR.
WRITE : wa_out-dmbtr1 UNDER g LEFT-JUSTIFIED.
lv_sum2 = lv_sum2 + wa_out-dmbtr1.
endif.
at END OF hkont.
ULINE at /93(50).
WRITE : /93 'Closing balance' ,
109 lv_sum1,
127 lv_sum2.
ULINE at /93(50).
CLEAR lv_sum1.
CLEAR lv_sum2.
endat.
Any help in this?
‎2014 Apr 25 6:38 AM
Hi Gourav,
Is HKNOT the first field in your table it_bsas because the at new and at end of functionality compares all the fields to the left of your specified field.
Make it the first field of your internal table and try.
Regards
‎2014 Apr 25 6:38 AM
Hi Gourav,
Is HKNOT the first field in your table it_bsas because the at new and at end of functionality compares all the fields to the left of your specified field.
Make it the first field of your internal table and try.
Regards
‎2014 Apr 25 6:49 AM
Hi yakub,
TYPES : BEGIN OF ty_bsas,
hkont TYPE bsas-hkont,
bukrs TYPE bsas-bukrs,
.....
end of...
and select query is
if p_clear = 'X'.
SELECT hkont bukrs augdt GJAHR belnr budat bldat xblnr SHKZG
dmbtr sgtxt INTO TABLE it_bsas FROM bsas
WHERE bukrs in s_buk
AND hkont in s_kun.
It is my structure now.
Thanks
Gourav.
‎2014 Apr 25 7:48 AM
Then use the same code as you are using to output dmbtr
WRITE : lv_sum1 UNDER f LEFT-JUSTIFIED.
WRITE : lv_sum2 UNDER g LEFT-JUSTIFIED.
Would recommend using pre-sorted ALV with sub-total on these amount fields
Regards
‎2014 Apr 25 6:40 AM
‎2014 Apr 25 6:46 AM
Hi Mansih,
Expected output is as per image five line items will be shown & at last of All items ,debit sum amount will be shown below debit & same for credit also,but as a new line with that text .
It is coming,but I do not know why that sum line is showing in upper & last line is showing in below!!
Thanks
Gourav.
‎2014 Apr 25 6:49 AM
Hi,
instead of useing at at endof hknot use the below code.
at end of belnr.
sum.
write : / lv_sum1, under wa_output wa_out-dmbtr1 .
lv_sum2, under wa_output wa_out-dmbtr .
endat.
Regards,
Raman
‎2014 Apr 25 6:51 AM
Just like what Mohammed said, you have to put the field to be compared by AT NEW and AT END at the very first field.
‎2014 Apr 25 6:58 AM
In your programming you are performing calculations during output. Bluntly, this is bad programming. For any report the process should be:
1. Get data
2. Perform transformations/calculations on data
3. Display data
In this way, if you later decide you want to, e.g. display the report in an ALV Grid control, or download the data, you only have to adjust the third stage.
So, as a start, i suggest you re-write your program following the paradigm above.
‎2014 Apr 25 8:07 AM
Dear Matthew,
I will surely remind your suggestion.
Thank you.
Regards
Gourav.
‎2014 Apr 25 8:06 AM
Dear all,
Problem solved.
I just write at end part before end loop line.
It works for this time.
Yes I changed HKONT sequence.
Thanks all for your time.
Thanks
Gourav.