Grand total is not working...please help

Hi, here is my code
SORT S_ENDT BY LIFNR.
  LOOP AT S_ENDT WHERE BUDAT IN P_BUDAT.
    WRITE:          1  S_ENDT-BKTXT,
                    11 S_ENDT-BUKRS,
                    16 S_ENDT-LIFNR,
                    24 S_ENDT-NAME1,
                    49 S_ENDT-BLART,
                    53 S_ENDT-BELNR,
                    64 S_ENDT-AUGBL,
                    75 S_ENDT-AUGDT,
                    86 S_ENDT-BUDAT,
                    97 S_ENDT-WRBTR,
                    113 S_ENDT-WAERS,
                    117 S_ENDT-XBLNR,
                    130 S_ENDT-ZUONR.
    AT END OF BKTXT.                         " Subtotal by Draft #
      ULINE.
      SUM.
      WRITE: 20 'Total of draft', 37 S_ENDT-BKTXT, 97 S_ENDT-WRBTR.
    ENDAT.
    AT LAST.                                 " Grand total
      SUM.
      SKIP.
      WRITE: 20 'Grand Total', 97 S_ENDT-WRBTR.
    ENDAT.
    SKIP.
  ENDLOOP.
EXIT.
ENDIF.
I am not getting the right total..I am getting it for all LIFNR and not the value in P_LIFNR only (which is what I want).
please help
thanks
Brian

Hi,
try this coding.
SORT S_ENDT BY LIFNR.
*data : gt(16) type p decimals 2.*
LOOP AT S_ENDT WHERE BUDAT IN P_BUDAT.
*gt = gt + S_ENDT-WRBTR.*
WRITE: 1 S_ENDT-BKTXT,
11 S_ENDT-BUKRS,
16 S_ENDT-LIFNR,
24 S_ENDT-NAME1,
49 S_ENDT-BLART,
53 S_ENDT-BELNR,
64 S_ENDT-AUGBL,
75 S_ENDT-AUGDT,
86 S_ENDT-BUDAT,
97 S_ENDT-WRBTR,
113 S_ENDT-WAERS,
117 S_ENDT-XBLNR,
130 S_ENDT-ZUONR.
AT END OF BKTXT. " Subtotal by Draft #
ULINE.
SUM.
WRITE: 20 'Total of draft', 37 S_ENDT-BKTXT, 97 *gt*.
ENDAT.
AT LAST. " Grand total
SUM.
SKIP.
WRITE: 20 'Grand Total', 97 S_ENDT-WRBTR.
ENDAT.
SKIP.
ENDLOOP.
EXIT.
ENDIF.
U are using where condition in a Loop ,while executing last record may or may not get executed becoz of restiction.Better declare a variable and SUM under such scenarios.
Regards,
Ballack.
Reward Points if helpful.

Similar Messages

Maybe you are looking for

  • EXPDP Error in Oracle 11.2.0.1.0

    Hello Team, I have a problem in executing expdp/impdp in oracle version 11.2.0.1.0. Following is the error output. Traditional exp/imp is working fine. Note: command executed on Oracle Linux on VMware [oracle1@rac1 test]$ expdp Export: Release 11.2.0

  • OMG... $1,000s in downloads gone... Please help!

    Hi there everyone. I just lost all of my iTunes Music Store downloads (back-up hard drive failure and was in the middle of a format on my MacBook Pro)... so I don't have any of my .m4p and .m4v files that I've downloaded over the past 2 years from th

  • Running Process Chains via abap

    Hi all, I have scenario in loading text file to cube via chains using abap, here the step: Start from abap code to check the file, if exist run the Process chains <b>Process Chains</b> a. <b>start</b> b. <b>load data</b>   c. <b>updt from PSA</b> d.

  • Hidden color in PNG transparency. How does photoshop define it and can i change it?

    There is hidden colorinformation in PNG transparency. I need to set the hidden color to black.ow can i change this information? You can see the false colorinformation of the PNG, when you open the file in Paintshop Pro. My workaround of this is using

  • Photoshop Elements 7 Folders

    Hi, I am using Adobe Photoshop Elements 7 Can someone please explain to me why I have So many folders on the left hand side in the Organise View? Just about all the folders on my computer are there? All I want is just My Pictures Folder there Can I d