Skip to Content
avatar image
Former Member

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

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 .

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Sep 18, 2008 at 03:26 AM

    change your fields from numeric to type p or i

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 03:27 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 04:13 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 04:24 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 05:14 AM

    Hi,

    You can try this...

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

    if itab-amount2 eq '0'.

    itab-amount = ''.

    endif.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 06:11 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 06:18 AM

    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

    Add comment
    10|10000 characters needed characters exceeded