cancel
Showing results for 
Search instead for 
Did you mean: 

problem in ALV Grid report

Former Member
0 Kudos

Hi experts,

I have requirement for ALV grid report.

That report is already displaying some fields from an internal table(itab) with one of the field as PERNR .

Now i have three more fileds BETRG(HR:Payroll Amount), ANGHL(HR:Payroll Number) and LGART(Wage type).

And the requirement is to

For every PERNR, add all of their BETRG and add all of thier ANGHL where LGART = '1206' OR '9513'.

Then for every PERNR divide their total of BETRG by total of ANGHL (BETRG/ANGHL).

Now multiply (BETRG/ANGHL) by HOURS which is available in above internal table itab.

Suppose (BETRG/ANGHL) * HOURS = c

Then display c in the report(Current report which has above internal table itab.), for every PERNR.

Can anyone give me direction to start coding for this. Please help.

If i have made this explanation very complex, then please let me know.

Thanks in Advance.

..anusha

Edited by: anusha singh on Sep 21, 2008 9:34 AM

Edited by: anusha singh on Sep 21, 2008 9:54 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member224404
Active Participant
0 Kudos

Hi Anusha,

You have one internal table itab which now has got all the required data that you need to print in the ALV.

Now create a internal table which only display only those fields you'd be displaying in the ALV. Lets say it i_final.

Now you can write a code something like this.

data: l_v_total type i.

sort itab by pernr.

loop at itab into wa_itab

where lgart eq '1206' or

lgart eq '9513'.

at end of pernr.

sum.

l_v_total = wa_itab-betrg / wa_itab-anghl.

l_v_total = l_v_total * wa_itab-hours.

wa_final-pernr = wa_itab-pernr.

wa_final-hours = l_v_total.

append wa_final to i_final.

endat.

endloop.

Mainak Aich