2018 Nov 09 9:46 AM
I am trying to download a table with headerline usign opendatasets however the header name its not aligned with the field like this:
P0001-WERKS P0000-PERNR P0000-MASSG TEXT_P0000_MASSG P0000-STAT2 ....ZEMAIL(first field)
,3000,30000007,01,New position,3,Active,Mr,Georgi,.....
the code which generates the following:
CONCATENATE HEADER LSI_STRING INTO DATA(HEADER) SEPARATED BY SPACE.CONCATENATE V1_STRING <FS_FIELD> INTO DATA(V1_STRING) SEPARATED BY ','.
then after the loop I transfer the files into the directory:
TRANSFER HEADER TO LVS_DOWNLOAD_PATH.
TRANSFER V1_STRING TO LVS_DOWNLOAD_PATH.
I also noticed smth strange,some fields have additional zeros from 600 to 000600.I dont know why them are added.
Please keep in mind that the file type must be XLS
I am trying to download a table with headerline usign opendatasets however the header name its not aligned with the field like this:
P0001-WERKS P0000-PERNR P0000-MASSG TEXT_P0000_MASSG P0000-STAT2 ....ZEMAIL(first field)
,3000,30000007,01,New position,3,Active,Mr,Georgi,.....
the code which generates the following:
CONCATENATE HEADER LSI_STRING INTO DATA(HEADER) SEPARATED BY SPACE.CONCATENATE V1_STRING <FS_FIELD> INTO DATA(V1_STRING) SEPARATED BY ','.
then after the loop I transfer the files into the directory:
TRANSFER HEADER TO LVS_DOWNLOAD_PATH.
TRANSFER V1_STRING TO LVS_DOWNLOAD_PATH.
I also noticed smth strange,some fields have additional zeros from 600 to 000600.I dont know why them are added.
Please keep in mind that the file type must be XLS
2018 Nov 09 10:30 AM
To do such operations you should use functions, which are available. So you can avoid strange findings in your data.
Function: CBRC_LIB2_CONVERT_ITAB_TO_CSV is one example.
Afterwards you can transfer your data to a folder or whatever you want to do with this file.
Additional zeros come from the respective datatypes. If your not familiar with it, I recommend you to have a look at the basic-instructions.
For example here:
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/de-DE/abenddic_builtin_types.htm
2018 Nov 09 12:29 PM
will this work with dynamic tables?I will try this but where does this take the table ??I see no place to import the table..please correct me if I am wrong!
2018 Nov 09 1:56 PM
I just tested this,this is the dump that it throws:
The following are protected against changes: - Character literals or numerical literals, - Constants (CONSTANTS), - Parameters of category IMPORTING REFERENCE in functions and methods, - untyped field symbols that have not been assigned a field using ASSIGN, - TABLES parameters, if the actual parameter is protected against changes.
CODE:
<E_GFS_DYN_TABLE> and <GFS_DYN_TABLE> type table.
CALL FUNCTION 'CBRC_LIB2_CONVERT_ITAB_TO_CSV'
EXPORTING
I_FIELD_SEPERATOR = '|'
* I_FLG_LINE_HEADER = FALSE
I_DATA_TAB = <GFS_DYN_TABLE>
* I_FLG_ASCII = FALSE
* I_FLG_BIN = FALSE
I_ENCODING = 'UTF-8'
IMPORTING
* E_ASCII_DATA_TAB =
* E_ASCII_SIZE =
E_BIN_DATA_TAB = <E_GFS_DYN_TABLE>
* E_BIN_SIZE =
E_FLG_ERROR = LD_E_FLG_ERROR
E_ERROR_TAB = LD_E_ERROR_TAB
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |