- Use path visible in transaction AL11
- Create SQ02 Query to read f.e. MSEG table
- Put the script in the following sections of extras->code tab:
DATA:
DATA: C_SEMI(1) TYPE C VALUE ';'.
DATA: L_LINE TYPE STRING.
DATA: T_FILE(999) TYPE C.
DATA: L_TEMP TYPE STRING.
DATA: L_LINE TYPE STRING.
DATA: T_FILE(999) TYPE C.
DATA: L_TEMP TYPE STRING.
START OF SELECTION:
T_FILE = 'C:\101movement.txt'.
OPEN DATASET T_FILE FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT
WITH SMART LINEFEED.
CONCATENATE
'Material'
'Quantity'
'Movement'
INTO L_LINE
SEPARATED BY C_SEMI.
TRANSFER L_LINE TO T_FILE.
ENCODING DEFAULT
WITH SMART LINEFEED.
CONCATENATE
'Material'
'Quantity'
'Movement'
INTO L_LINE
SEPARATED BY C_SEMI.
TRANSFER L_LINE TO T_FILE.
RECORD PROCESSING:
CLEAR L_LINE.
CLEAR L_TEMP.
L_TEMP = MSEG-MENGE.
* Row creation with output to csv
CONCATENATE
MSEG-MATNR
L_TEMP
MSEG-BWART
INTO L_LINE
SEPARATED BY C_SEMI.
TRANSFER L_LINE TO T_FILE.
ENDLOOP.
CLEAR L_TEMP.
L_TEMP = MSEG-MENGE.
* Row creation with output to csv
CONCATENATE
MSEG-MATNR
L_TEMP
MSEG-BWART
INTO L_LINE
SEPARATED BY C_SEMI.
TRANSFER L_LINE TO T_FILE.
ENDLOOP.
END OF SELECTION (after List):
close dataset T_FILE.
No comments:
Post a Comment