02-16-2009 11:03 AM
I am running SAP CRM ABAP 6.0 and I need to provide a program for uploading a spreadsheet with multiple worksheets into CRM.
SAP being SAP does not provide the same function modules in CRM as are available in ECC...
I am over the initial hurdle using F4_DXFILENAME_TOPRECURSION to load the file from either the presentation server or application server...
however, none of the standard FMs are available to convert the spreadsheet into internal tables...
I wonder if anyone has successfully done this and can point me to another function module!
I did try and recreate the TEXT_CONVERT_XLS_TO_SAP but was unsuccessful due to missing type pools.....
02-16-2009 11:07 AM
02-16-2009 11:10 AM
Kiran,
Is it possible to upload multiple worksheets in an excel sheet using ALSM_EXCEL.......,if so what are the parameters that needs to be passed to select the worksheets in an excel.
Thanks,
K.Kiran.
02-16-2009 11:10 AM
Thank you for your prompt response, however this FM is not available within CRM.
02-16-2009 11:12 AM
hi,
For your requirement try out the following function module.
data:
it_text TYPE truxs_t_text_data .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
* DYNPRO_NUMBER = SYST-DYNNR
field_name = ' '
IMPORTING
file_name = p_file.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_tab_raw_data = it_text
i_filename = p_file
TABLES
i_tab_converted_data = t_cust
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks
Sharath
02-16-2009 11:11 AM
Hi Barry,
For the function module you are using:
TEXT_CONVERT_XLS_TO_SAP
Try using type pool: TRUXS.
it wont give error type pool missing.
Hope it helps
Regrds
Mansi
02-16-2009 11:16 AM
Thanks everyone, but I am using CRM 6.0. Not ECC.
These function modules are not available in CRM!
02-16-2009 11:19 AM
02-16-2009 11:23 AM
Thanks, but I know what I need to do once I have the data into SAP, it is just getting into SAP and converting it that I am a struggling with!
03-12-2009 12:33 PM
Maybe not pretty, but works for me!
TYPES: BEGIN OF T_UPLOAD_DATA,
DATA TYPE CHAR16384,
END OF T_UPLOAD_DATA.
DATA: LT_UPLOAD_DATA TYPE STANDARD TABLE OF T_UPLOAD_DATA,
LS_UPLOAD_DATA LIKE LINE OF LT_UPLOAD_DATA.
DATA : LT_FILE_TABLE TYPE FILETABLE,
LV_RC TYPE I.
DATA: LV_FILENAME TYPE STRING.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
CHANGING
FILE_TABLE = LT_FILE_TABLE
RC = LV_RC
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE LT_FILE_TABLE INTO LV_FILENAME INDEX 1.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = LV_FILENAME
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = ','
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
CHANGING
DATA_TAB = LT_UPLOAD_DATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
NOT_SUPPORTED_BY_GUI = 17
ERROR_NO_GUI = 18
OTHERS = 19.