2019 May 29 3:00 PM
Hi
I have googled but cannot find an example of how to get a .csv file from the SAP server (AL11) into an internal table in my program. I want to use Logical File transaction FILE to specify where the file path. Then I assume I would use function FILE_GET_NAME to get the file before using open_dataset etc.
The problem is I cannot get the Logical File to work. 😞
2019 May 29 4:30 PM
Hi,
To read the file path used bellow link.
https://answers.sap.com/questions/10308209/fm-to-read-a-file-path-based-on-al11-profile.html
To read the CSV file, use bellow
OPEN DATASET filename FOR INPUT IN TEXT MODE
ENCODING DEFAULT MESSAGE msg.
IF SY-SUBRC EQ 0.
DO.
READ DATASET filename INTO l_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT l_string AT ',' INTO WA-FIELD1 WA-FIELD2 ..... WA-FIELDn.
APPEND wa to datatab.
ENDIF.
ENDDO.
CLOSE DATASET filename.
ENDIF.
Hi,
To read the file path used bellow link.
https://answers.sap.com/questions/10308209/fm-to-read-a-file-path-based-on-al11-profile.html
To read the CSV file, use bellow
OPEN DATASET filename FOR INPUT IN TEXT MODE
ENCODING DEFAULT MESSAGE msg.
IF SY-SUBRC EQ 0.
DO.
READ DATASET filename INTO l_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT l_string AT ',' INTO WA-FIELD1 WA-FIELD2 ..... WA-FIELDn.
APPEND wa to datatab.
ENDIF.
ENDDO.
CLOSE DATASET filename.
ENDIF.
2019 May 29 4:30 PM
Hi,
To read the file path used bellow link.
https://answers.sap.com/questions/10308209/fm-to-read-a-file-path-based-on-al11-profile.html
To read the CSV file, use bellow
OPEN DATASET filename FOR INPUT IN TEXT MODE
ENCODING DEFAULT MESSAGE msg.
IF SY-SUBRC EQ 0.
DO.
READ DATASET filename INTO l_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT l_string AT ',' INTO WA-FIELD1 WA-FIELD2 ..... WA-FIELDn.
APPEND wa to datatab.
ENDIF.
ENDDO.
CLOSE DATASET filename.
ENDIF.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |