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: 

Error while Download to Excel using XXL_FULL_API

Former Member
0 Kudos

Hi All,

I'm want to download using XXL_FULL_API,But Im unable to downloading the data.My coding as below. Pls advise where I did mistake.

REPORT ZEXCEL_DOWNLOAD.

TABLES: VBAP.

  • header data................................

DATA :HEADER1 LIKE GXXLT_P-TEXT VALUE 'Suresh',

HEADER2 LIKE GXXLT_P-TEXT VALUE 'Excel sheet'.

  • Internal table for holding the vbap data

DATA BEGIN OF T_VBAP OCCURS 0.

INCLUDE STRUCTURE VBAP.

DATA END OF T_VBAP.

  • Internal table for holding the horizontal key.

DATA BEGIN OF T_HKEY OCCURS 0.

INCLUDE STRUCTURE GXXLT_H.

DATA END OF T_HKEY .

  • Internal table for holding the vertical key.

DATA BEGIN OF T_VKEY OCCURS 0.

INCLUDE STRUCTURE GXXLT_V.

DATA END OF T_VKEY .

  • Internal table for holding the online text....

DATA BEGIN OF T_ONLINE OCCURS 0.

INCLUDE STRUCTURE GXXLT_O.

DATA END OF T_ONLINE.

  • Internal table to hold print text.............

DATA BEGIN OF T_PRINT OCCURS 0.

INCLUDE STRUCTURE GXXLT_P.

DATA END OF T_PRINT.

  • Internal table to hold SEMA data..............

DATA BEGIN OF T_SEMA OCCURS 0.

INCLUDE STRUCTURE GXXLT_S.

DATA END OF T_SEMA.

  • Retreiving data from vbap.

SELECT * FROM VBAP INTO TABLE T_VBAP UP TO 10 ROWS.

  • Text which will be displayed online is declared here....

T_ONLINE-LINE_NO = '1'.

T_ONLINE-INFO_NAME = 'Created by'.

T_ONLINE-INFO_VALUE = 'SURESH KUMAR PARVATHANENI'.

APPEND T_ONLINE.

  • Text which will be printed out..........................

T_PRINT-HF = 'H'.

T_PRINT-LCR = 'L'.

T_PRINT-LINE_NO = '1'.

T_PRINT-TEXT = 'This is the header'.

APPEND T_PRINT.

T_PRINT-HF = 'F'.

T_PRINT-LCR = 'C'.

T_PRINT-LINE_NO = '1'.

T_PRINT-TEXT = 'This is the footer'.

APPEND T_PRINT.

  • Defining the vertical key columns.......

T_VKEY-COL_NO = '1'.

T_VKEY-COL_NAME = 'MANDT'.

APPEND T_VKEY.

T_VKEY-COL_NO = '2'.

T_VKEY-COL_NAME = 'VBELN'.

APPEND T_VKEY.

T_VKEY-COL_NO = '3'.

T_VKEY-COL_NAME = 'POSNR'.

APPEND T_VKEY.

T_VKEY-COL_NO = '4'.

T_VKEY-COL_NAME = 'MATNR'.

APPEND T_VKEY.

  • Header text for the data columns................

T_HKEY-ROW_NO = '1'.

T_HKEY-COL_NO = 1.

T_HKEY-COL_NAME = 'MATKL'.

APPEND T_HKEY.

T_HKEY-COL_NO = 2.

T_HKEY-COL_NAME = 'ARKTX'.

APPEND T_HKEY.

T_HKEY-COL_NO = 3.

T_HKEY-COL_NAME = 'ABGRU'.

APPEND T_HKEY.

T_HKEY-COL_NO = 4.

T_HKEY-COL_NAME = 'CHARG'.

APPEND T_HKEY.

T_HKEY-COL_NO = 5.

T_HKEY-COL_NAME = 'POSAR'.

APPEND T_HKEY.

T_HKEY-COL_NO = 6.

T_HKEY-COL_NAME = 'PRODH'.

APPEND T_HKEY.

  • populating the SEMA data..........................

T_SEMA-COL_NO = 1.

T_SEMA-COL_TYP = 'STR'.

T_SEMA-COL_OPS = 'DFT'.

APPEND T_SEMA.

T_SEMA-COL_NO = 2.

APPEND T_SEMA.

T_SEMA-COL_NO = 3.

APPEND T_SEMA.

T_SEMA-COL_NO = 4.

APPEND T_SEMA.

T_SEMA-COL_NO = 5.

APPEND T_SEMA.

T_SEMA-COL_NO = 6.

APPEND T_SEMA.

T_SEMA-COL_NO = 7.

APPEND T_SEMA.

T_SEMA-COL_NO = 8.

APPEND T_SEMA.

T_SEMA-COL_NO = 9.

APPEND T_SEMA.

T_SEMA-COL_NO = 10.

T_SEMA-COL_TYP = 'NUM'.

T_SEMA-COL_OPS = 'ADD'.

APPEND T_SEMA.

CALL FUNCTION 'XXL_FULL_API'

EXPORTING

  • DATA_ENDING_AT = 54

  • DATA_STARTING_AT = 5

FILENAME ='TEST'

HEADER_1 = HEADER1

HEADER_2 = HEADER2

NO_DIALOG = ''

  • no_start = ' '

N_ATT_COLS = 6

N_HRZ_KEYS = 1

N_VRT_KEYS = 4

SEMA_TYPE = 'X'

SO_TITLE = 'TEST'

TABLES

DATA = T_VBAP

HKEY = T_HKEY

ONLINE_TEXT = T_ONLINE

PRINT_TEXT = T_PRINT

SEMA = T_SEMA

VKEY = T_VKEY

EXCEPTIONS

CANCELLED_BY_USER = 1

DATA_TOO_BIG = 2

DIM_MISMATCH_DATA = 3

DIM_MISMATCH_SEMA = 4

DIM_MISMATCH_VKEY = 5

ERROR_IN_HKEY = 6

ERROR_IN_SEMA = 7

FILE_OPEN_ERROR = 8

FILE_WRITE_ERROR = 9

INV_DATA_RANGE = 10

INV_WINSYS = 11

INV_XXL = 12

OTHERS = 13

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thank You,

Pranitha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

As per your code, you have given the schema for 10th column as "NUM". But the 10th column in VBAP table is "PSTYV" which is not a number, leading to the error message.

If you try executing the code by commenting the lines as mentioned below, your code will get executed successfully.

T_SEMA-COL_NO = 10.

  • T_SEMA-COL_TYP = 'NUM'. "Comment this line

  • T_SEMA-COL_OPS = 'ADD'. "Comment this line

APPEND T_SEMA.

Thanks & Regards,

Harish

3 REPLIES 3

Former Member
0 Kudos

Hi,

As per your code, you have given the schema for 10th column as "NUM". But the 10th column in VBAP table is "PSTYV" which is not a number, leading to the error message.

If you try executing the code by commenting the lines as mentioned below, your code will get executed successfully.

T_SEMA-COL_NO = 10.

  • T_SEMA-COL_TYP = 'NUM'. "Comment this line

  • T_SEMA-COL_OPS = 'ADD'. "Comment this line

APPEND T_SEMA.

Thanks & Regards,

Harish

0 Kudos

Thank You very harishkumar

Can anybody send some examples for download to excel with FM 'XXL_FULL_API'.

0 Kudos

Hi,

Please refer the standard program - "XXLFTEST" for details.

Thanks & Regards,

Harish