‎2007 Feb 02 1:46 AM
I'm trying to download a sap format to non sap format
when I download a particular file from application server, data is in string format. so if I have to change the file structure according to Non sap format, I may require to read this file into some internal table. but as it is a continuous string i'm not able to split it into different fields. how can i proceed?
Can anybody suggest me what to do
‎2007 Feb 02 8:17 AM
ABAp,
To get the file from App.server you have to use data extracts.
EX :
data : s_filename(400),
I_TEMP(400),
DATA : BEGIN OF I_FINALTAB OCCURS 0,
QMART(3),
QMNUM LIKE VIQMEL-QMNUM,
MNCOD(8),
PSTER TYPE DATUM,
STAT(11),
TXT30 LIKE TJ02T-TXT30,
STRMN(9),
LTRMN LIKE VIQMEL-LTRMN,
URCOD(9),
QMTXT LIKE VIQMEL-QMTXT,
POST_CODE1 LIKE ADRC-POST_CODE1,
BZIRK LIKE VBKD-BZIRK,
KDMAT LIKE VBAP-KDMAT,
END OF I_FINALTAB.
OPEN DATASET S_FILENAME FOR input IN TEXT MODE.
DO.
READ DATASET s_filename INTO I_TEMP.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
move I_TEMP to I_FINALTAB.
append I_FINALTAB.
clear I_FINALTAB.
ENDIF.
ENDDO.
CLOSE DATASET s_filename .
clear v_flag.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = T_PATH
FILETYPE = 'ASC'
TABLES
DATA_TAB = I_FINALTAB.
IF SY-SUBRC <> 0.
MESSAGE e013(zmamin) WITH 'Unable to download the File'.
ELSE.
MESSAGE i013(zmamin) WITH 'File downloaded Successfully'.
LEAVE.
ENDIF.
CLOSE DATASET s_filename .
This will solve your problem.
Pls. Mark if useful
‎2007 Feb 02 7:51 AM
Hi,
Check if the following link is useful.
http://www.sapdevelopment.co.uk/reporting/rep_capturerep.htm
regards,
Priya.
‎2007 Feb 02 8:16 AM
Hi,
There must be some separator which separates the columns even in the string(Like a space , or a comma, or a | etc).
Once you have that string in a variable, you can use the split statement.
do.
read dataset dsn into itab-string.
if sy-subrc = 0.
split itab-string at '|' into itab_new-field1 itab_new-fiel2 itab_new-field3.....
append itab_new.
clear itab_new.
else.
exit.
endif.
enddo.
Regards,
ravi
‎2007 Feb 02 8:17 AM
ABAp,
To get the file from App.server you have to use data extracts.
EX :
data : s_filename(400),
I_TEMP(400),
DATA : BEGIN OF I_FINALTAB OCCURS 0,
QMART(3),
QMNUM LIKE VIQMEL-QMNUM,
MNCOD(8),
PSTER TYPE DATUM,
STAT(11),
TXT30 LIKE TJ02T-TXT30,
STRMN(9),
LTRMN LIKE VIQMEL-LTRMN,
URCOD(9),
QMTXT LIKE VIQMEL-QMTXT,
POST_CODE1 LIKE ADRC-POST_CODE1,
BZIRK LIKE VBKD-BZIRK,
KDMAT LIKE VBAP-KDMAT,
END OF I_FINALTAB.
OPEN DATASET S_FILENAME FOR input IN TEXT MODE.
DO.
READ DATASET s_filename INTO I_TEMP.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
move I_TEMP to I_FINALTAB.
append I_FINALTAB.
clear I_FINALTAB.
ENDIF.
ENDDO.
CLOSE DATASET s_filename .
clear v_flag.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = T_PATH
FILETYPE = 'ASC'
TABLES
DATA_TAB = I_FINALTAB.
IF SY-SUBRC <> 0.
MESSAGE e013(zmamin) WITH 'Unable to download the File'.
ELSE.
MESSAGE i013(zmamin) WITH 'File downloaded Successfully'.
LEAVE.
ENDIF.
CLOSE DATASET s_filename .
This will solve your problem.
Pls. Mark if useful
‎2007 Feb 02 8:20 AM
Hi,
as has been cleared by Ravi in case there is a separator that is used then you can use 'SPLIT'.
otherwise if it's a continous string with no separator then you need to know the structure and the lenght of each field to be put for NON-SAP system.
then you'll have to assign values to table using offset
say itab-first = variable+0(10)
itab-second = variable+10(5)
..... so on.
Hope this helps you
Regards
Nishant
‎2007 Feb 03 3:55 AM