cancel
Showing results for 
Search instead for 
Did you mean: 

Additional tabs in .xlsx file created through SAP Gateway

Former Member
0 Kudos

Hello Experts,

I am facing an issue while creating a .xlsx file through Gateway Service using Media entity.

We are getting additional tabs 'Input help', 'Column details', 'Column Alias Mapping' apart from 'Sheet 1' which contains the relevant data as per the attached screenshot. Also the name of excel file getting created is coming as $value even though the name is being passed in the class.

Below code is being used in DPC_EXT class.


"create excel file

   GET REFERENCE OF lt_excel_ex INTO lr_data_ref.

   TRY.

       cl_fdt_xl_spreadsheet=>if_fdt_doc_spreadsheet~create_document(

         EXPORTING

           itab               = lr_data_ref

           iv_call_type       = 2

           name               = lv_file_name

           iv_sheet_name      = lv_file_name

         RECEIVING

           xdocument          = cv_xstring ).

     CATCH cx_fdt_excel_core .

   ENDTRY.


This code is being executed via the URL /sap/opu/odata/sap/..MEDIA_ENTITY_SET/$value. The name of file is being taken from the URL. Is there any way of passing the file name and removing additional tabs in .xlsx file.


Regards,

Nishant Arora

Accepted Solutions (0)

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Nishant,

Do you mean to say excel which is attached during POST operation had only 'Input help', 'Column details', 'Column Alias Mapping' sheets but after its saved you are getting additional sheet called 'Sheet1' ?

Regards,

Ashwin

Former Member
0 Kudos

Hello Ashwin,

The below URL is being used as GET operation and used to create a file in the front end which should consist of the custom table entries which has the relevant contents as well as additional tabs.

/sap/opu/odata/sap/..MEDIA_ENTITY_SET/$value

We don't need any additional tabs. We only need one tab with our custom table entries . The additional tabs are created automatically via class which I mentioned in my question. Also the file that is created has the name $value. We need an appropriate name.

Regards,

Nishant

AshwinDutt
Active Contributor
0 Kudos

Ok then its something which we need to see what is happening inside that class. Most likely this extra sheet 'Sheet1' along with actual data is created while media content is getting saved. On reading same media content is being rendered with actual data which is having that extra sheet 'Sheet1'.

However we can use Content-Deposition Header to set with what name you would like to download the file.

Former Member
0 Kudos

Hi Ashwin,

Thanks for the reply. Please note that extra sheets are Input help, column etc. which are being created by class mentioned. The sheet 'Sheet 1' has the data we need and is to be kept.

I will check the link given by you.

Regards,

NIshant

AshwinDutt
Active Contributor
0 Kudos

Ok. I thought its other way around. Checking inside that class may help in finding the issue.

Former Member
0 Kudos

Hi Ashwin,

The code in this standard class loads the number of worksheets based on the relations which depend on the call type being passed. I have tried changing call type to another value but still I am getting the additional sheet.

TRY.

       cl_fdt_xl_spreadsheet=>if_fdt_doc_spreadsheet~create_document(

         EXPORTING

           itab               = lr_data_ref

           iv_call_type       = 2

           name               = lv_file_name

           iv_sheet_name      = lv_file_name

         RECEIVING

           xdocument          = cv_xstring ).

     CATCH cx_fdt_excel_core .

   ENDTRY.


Regards,

Nishant Arora

kammaje_cis
Active Contributor
0 Kudos

Nishant,

Check the content of lr_data_ref. That is causing multiple tabs.

Regards

Krishna

Former Member
0 Kudos

Hi Krishna,

The content of lr_data_ref is the reference to the internal table which has the contents to be passed. Do I need to check anything else apart from that.

Thanks in advance.

Regards,

Nishant