Skip to Content

how to use the power of AMDP for section headings subtotals,total and row coloring

I had a requirement given by the business which was a bit difficult. The data was to be pulled from FI and MM module and combined in one report.

The report had to have 5 sections

  1. For section 1 the data needs to be pulled from FI
  2. Subtotal
  3. For section 2 the data needs to be pulled from MM
  4. For section 3 the data needs to be pulled from FI
  5. Sub total
  6. Grand total

I decided to explore all this by using the AMDP method. Given below is a screen shot of my procedure for the first 2 points.

I added one column called color in the structure which i will be using in the ABAP coding. I am also using the select from dummy to add a heading row.

Finally i do a union all and assign it in the out parameter of the procedure.


This is for retrieving the data


This is for the subtotal


In the ABAP Code


For coloring the line just add the line highlighted in the layout


The final out put


I Hope this helps the fans of code push down.

You must be Logged on to comment or reply to a post.
  • Hi Arun,

    Thanks for your post. I wonder if there is any possibilty to create an AMDP to do a query using a for all entries?

    Something like that

        et_pernr = select

            kokrs as kokrs,

            belnr as belnr,

            pernr as pernr       

          from    COEP    

    -- For all entries it_repo

          where mandt = :iv_mandt and

                kokrs = :iv_repo-kokrs and

                belnr = :iv_repo-belnr 

                ORDER BY pernr;

    Do you have any idea ?

    • Hi Jose

      I am not sure of the for all entries but i have used joins of different result sets like this

      SELECT null aufnr,

                              'Net Balance - Income/Loss ' io_desc,

                              NULL proj ,

                              NULL prj_name,

                              0 expen,

                              0 bud_qty,

                              0 pur_qty,

                              0 avg_pr,

                              (a.sales -(b.expen + c.expen))  Sales,

                              null color

                              from :et_tot a, :et_hsm b, :et_pesu c;

      Thanks and regards


      • Thanks Arun,

        Although, I am still struggling with the data model in ECC ...  Hope everything works  and I can post 🙂 in something new.