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: 

Download to Excel from ITAB, But the field in 0's shouldnt appear

Former Member
0 Kudos

Hi Gurus,

Im Downloading an Internal table to a Excelfile, But I do not want to see the Numeric fields those are in zeros in the excelfile.

For Ex : I donot want to show Amount2 in the excelfie

Desc--


Amount---- Amount2

costcenter1------ 1000------ 0

costcenter2------ 2000------ 0

But If theres amount in the amount2 then I want to show in the Excel file like below.

Desc Amount Amount2

costcenter1 1000 200

costcenter2 2000 100

Pls help me to solve this , Thanks .

8 REPLIES 8

Former Member
0 Kudos

change your fields from numeric to type p or i

Former Member
0 Kudos

Hi buddy,

you can do onething, pass the data in another internal table with condition where the required field value is not '0' & then pass the new file in your fun Mod.

Loop at it1 where field1 <> 0.

it2-field1 = it1-field1.

it2-field2 = it1-field2.

append it2.

clear it1.

endloop.

now use it2.

Thanks,

Krishna..

SPARTA Infotech.

0 Kudos

use the particular field in c(char) type in internal table definition.

Former Member
0 Kudos

hi,

in your internal table, make the "Amount2" field of type char/string.

whenever the value for "Amount2" field is 0(zero) do not populate the field.

this will surely sove your problem.

Former Member
0 Kudos

Hi,

try it using this function mopdule:

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = wa_crrb_audit-cust_acct_id

IMPORTING

output = wa_crrb_audit-cust_acct_id.

it will definately help you

Regards

Rahul Sharma

Former Member
0 Kudos

Hi,

You can try this...

while passing the Amount2 values jus put a condition that...

if itab-amount2 eq '0'.

itab-amount = ''.

endif.

Former Member
0 Kudos

Dear all,

Thanks for your replies and I appreciate all .

Ok here is the thing,

Fig A :

DESC---AMT1AMT2-AMT3--AMT4

cc1---100001000--0

cc2---100001000--0

cc3---100001000--0

This FIG A : is in the ITAB values but I want to show the Excel file like Below .

Fig B :

DESC -


AMT1---- AMT3

cc1---1000--1000

cc2---1000--1000

cc3---1000--1000

I want to show only the fields which have values other than '0'.

If I change the numeric to 'c', SAP will show that field in the excel file like below,

Fig C :

DESC---AMT1AMT2-AMT3--AMT4

cc1---1000' '1000--' '

cc2---1000' '1000--' '

cc3---1000' '1000--' '

I need to show like Fig B:

Thanks for all your support. Expecting replies ASAP .

Cheers

Vivek.

Former Member
0 Kudos

Hi,

You firstly process your internal tables in a good manner and then create your last, final internal table and send this table's data to excel.

Instead of searching for a multi-purposed function, try to to standardize your internal tables,

for example you can control your itab's columns regarding which one of them is empty, there are many ways to control it

one of which:

Data: begin of itab occurs 0,

matnr like Mara-matnr,

maktx like makt-maktx,

end of itab.

assume you have filled your itab:

loop at itab.

if not itab-maktx is initial.

itab_final = itab-maktx.

endif.

endloop.

you can create many internal tables and then join the corresponding required full fields to itab_final.

deniz.

Edited by: Deniz Toprak on Sep 18, 2008 9:23 AM