Application Development and Automation 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: 
Read only

Problem in classical report.

gouravkumar64
Active Contributor
0 Likes
1,418

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,343

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

10 REPLIES 10
Read only

Former Member
0 Likes
1,344

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

Read only

0 Likes
1,343

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.

Read only

0 Likes
1,343

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

Read only

Former Member
0 Likes
1,343

What is the expected output?

Read only

0 Likes
1,343

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.

Read only

Former Member
0 Likes
1,343

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

Read only

Former Member
0 Likes
1,343

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.

Read only

matt
Active Contributor
0 Likes
1,343

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.

Read only

gouravkumar64
Active Contributor
0 Likes
1,343

Dear Matthew,

I will surely remind your suggestion.

Thank you.

Regards

Gourav.

Read only

gouravkumar64
Active Contributor
0 Likes
1,343

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.