Application Development 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: 

General Abap ALV report

nayan_sahu
Explorer
0 Kudos

Hi,

I have written an ALV report. it is working fine. in Reports my out put is coming like this.

Account group G/L Account No

Name

-


Liability 100000

100010

100020

100030

Assets 200000

200010

200020

but my problem is when I am exporting into Excel sheet my Account group is repeating for every G/L account number.

But I want out like this in my Excel Sheet also.So can any one tell me solution for it.

Thanks

Nayan kumar sahu

Moderator message: please choose more descriptive subject lines for your posts.

Edited by: Thomas Zloch on May 24, 2011 9:53 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

if your passing account grp field in sort itab while calling the ALV_GRID_Display you get the output like this but in case of exporting into Excel sheet it wont come.

if you want to come the same format means you have manually pass the account group once the account group is changed.before doing the code dont pass the filed name in sort itab while calling the ALV_Grid display.

Please do the below coding.

sort itab by "Account group and G/L Account No.

read table itab index 1.

pass the acc group to some other variable like (lv_accgrp).

loop ITAB .

if lv_accgrp NE accgrp.

pass the account group to final itab.

and pass the accgrp to lv_accgrp.

endif.

pass the all field in final itab except accgrp.

endloop.

Hope it will help full.

Regards,

Dhina..

5 REPLIES 5

former_member184578
Active Contributor
0 Kudos

Hi.,

You used sort up in your ALV., Account group will still be there(in Internal table) but it will just hide that., So whenever you export to excel it will export the contents in internal table.

If you want in excel also like the above output., you have to do it manually.,

sort the internal table.,

loop internal table to wa.

at new account group

append it to final internal table.

end at.

endloop.

now pass final internal table to ALV.

now if u export to excel only the above output will come in excel also.

hope this will help u.,

reply if u need some more clarifications.,

Thanks & Regards

Kiran

Former Member
0 Kudos

Hi,

if your passing account grp field in sort itab while calling the ALV_GRID_Display you get the output like this but in case of exporting into Excel sheet it wont come.

if you want to come the same format means you have manually pass the account group once the account group is changed.before doing the code dont pass the filed name in sort itab while calling the ALV_Grid display.

Please do the below coding.

sort itab by "Account group and G/L Account No.

read table itab index 1.

pass the acc group to some other variable like (lv_accgrp).

loop ITAB .

if lv_accgrp NE accgrp.

pass the account group to final itab.

and pass the accgrp to lv_accgrp.

endif.

pass the all field in final itab except accgrp.

endloop.

Hope it will help full.

Regards,

Dhina..

0 Kudos

Hi,

I did the same thing but my client want out put should come like as reports.

I know we can't control while transporting to excel sheet. If any one have any

idea please help me out form here.

Thanks

Nayan kumar sahu

0 Kudos

Hi,

I think this one we cant do that. we have to do the similar way like above i told.

if your passing account grp field in sort itab while calling the ALV_GRID_Display you get the output like this

but in case of exporting into Excel sheet the account grp is repeating each row.

if you want to come the same format means you have manually pass the space while repeating the acc grp in the final itab.

once the account group is changed that time u pass the changes acc grp in the final itab.

before doing the code dont pass the filed name in sort itab while calling the ALV_Grid display. do the above coding wht i given.

Regards,

Dhina..

0 Kudos

Hi,

I resolved the issue. I convinced my client.

Thanks all for your support.

Thanks

Nayan kumar sahu

Edited by: nayan kumar sahu on Jun 3, 2011 11:08 AM

Edited by: nayan kumar sahu on Jun 10, 2011 2:36 PM

Edited by: nayan kumar sahu on Jun 10, 2011 2:36 PM