Application Development and Automation 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: 
Read only

ABAP2XLS Self Defined Internal Table

hardyp180
SAP Mentor
SAP Mentor
0 Likes
712

I am going to ask this question on the ABAP2XLS home page as soon as my membership is approved, but in the meantime I have searched all over the place, and changed the code loads of times trying to get this to work, as everyone who asks a question should do first, so I think I can now ask this...

... does ABAP2XLS work when you have defined your internal table yourself i.e. it is not based on a DDIC standard SAP table?

The spreadsheet opens with a load of moaning about unreadable content. If the internal table only has one field - EBELN - all works well. If the internal table is defined as type SFLIGHT all is well.

Really though everyone will want to define their own internal table....

Can anyone tell me if I am missing something obvious?

Cheersy Cheers

Paul

I am going to ask this question on the ABAP2XLS home page as soon as my membership is approved, but in the meantime I have searched all over the place, and changed the code loads of times trying to get this to work, as everyone who asks a question should do first, so I think I can now ask this...

... does ABAP2XLS work when you have defined your internal table yourself i.e. it is not based on a DDIC standard SAP table?

The spreadsheet opens with a load of moaning about unreadable content. If the internal table only has one field - EBELN - all works well. If the internal table is defined as type SFLIGHT all is well.

Really though everyone will want to define their own internal table....

Can anyone tell me if I am missing something obvious?

Cheersy Cheers

Paul

2 REPLIES 2
Read only

Former Member
0 Likes
614

Dear Paul,

as per my understanding , you may try this. if anything is missing let me know.

DATA: BEGIN OF it OCCURS 0,

      matnr TYPE matnr,

      maktx TYPE maktx,

      END OF it.

it-matnr = '000000000000000001'.

it-maktx = 'TEST1'.

APPEND it. CLEAR it.

it-matnr = '000000000000000002'.

it-maktx = 'TEST2'.

APPEND it. CLEAR it.

START-OF-SELECTION.

  CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

      filename                = 'D:\TEST3.XLS'

      filetype                = 'DBF'

      write_field_separator   = 'X'

    TABLES

      data_tab                = it

    EXCEPTIONS

      OTHERS                  = 1.

  IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

- Avirat Patel

Read only

Former Member
0 Likes
614

Hello,

if this is actual yet

You should use parameter  it_field_catalog = lt_field_catalog in bind_table method.

In order to get lt_field_catalog user this static method call:

lt_field_catalog = zcl_2xlsx_common=>get_fieldcatalog( ip_table = your custom table ).

Also you can loopt through lt_field_catalog and make the changes you need