2006 Mar 28 7:26 AM
Hi,
I need a function module to convert the otf data to text data(TXT). now i am using convert_otf fm. But i met the alignment Problem . So i want to change the Function Module which gives the Correct alignment of Conversion otf format to Text Format.
Is there any fm for converting OTF to TXT type?
Thanks in Advance,
Neptune.M
Hi,
I need a function module to convert the otf data to text data(TXT). now i am using convert_otf fm. But i met the alignment Problem . So i want to change the Function Module which gives the Correct alignment of Conversion otf format to Text Format.
Is there any fm for converting OTF to TXT type?
Thanks in Advance,
Neptune.M
2006 Mar 28 7:34 AM
hi selvan,
check tis link...
http://www.sap-basis-abap.com/sapac016.htm
if usefull reward points,
regards,
padma.
2006 Mar 28 7:44 AM
Hi Padma,
I have tried your coding But i got error msg like Memory OTF data is empty. How can i solve my problem?
Rgds,
Neptune.M
2006 Mar 28 8:06 AM
Hi Neptune,
Just try this sample code:
Copy and paste and check for ur output:
TABLES TSP01.
DATA: OTF LIKE ITCOO OCCURS 0 WITH HEADER LINE,
CONTENT_OUT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_COMPRESSED_LIST LIKE SOLI OCCURS 0.
DATA: NUMBYTES LIKE SOOD-OBJLEN,
PDFSPOOLID LIKE TSP01-RQIDENT,
OBJTYPE LIKE RSTSTYPE-TYPE,
TYPE LIKE RSTSTYPE-TYPE,
CANCEL.
PARAMETERS: SPOOLNO LIKE TSP01-RQIDENT,
P_FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\',
P_PDF TYPE C RADIOBUTTON GROUP RAD1,
P_PRT TYPE C RADIOBUTTON GROUP RAD1,
P_RAW TYPE C RADIOBUTTON GROUP RAD1.
SELECT SINGLE * FROM TSP01 WHERE RQIDENT = SPOOLNO.
IF SY-SUBRC <> 0.
WRITE: / 'SPOOL', SPOOLNO, 'DOES NOT EXIST'.
EXIT.
ENDIF.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
AUTHORITY = 'SP01'
CLIENT = TSP01-RQCLIENT
NAME = TSP01-RQO1NAME
PART = 1
IMPORTING
TYPE = TYPE
OBJTYPE = OBJTYPE
EXCEPTIONS
FB_ERROR = 1
FB_RSTS_OTHER = 2
NO_OBJECT = 3
NO_PERMISSION = 4.
IF SY-SUBRC EQ 0.
IF OBJTYPE(3) = 'OTF'.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
RQIDENT = SPOOLNO
TABLES
BUFFER = T_COMPRESSED_LIST.
IF P_PDF EQ 'X'.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
DEVTYPE = 'ASCIIPRI'
LEN_IN = NUMBYTES
IMPORTING
LEN_OUT = NUMBYTES
TABLES
CONTENT_IN = T_COMPRESSED_LIST
CONTENT_OUT = CONTENT_OUT
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
WRITE:/ SPOOLNO, 'NOT CONVERTED TO PDF'.
EXIT.
ENDIF.
ELSEIF P_PRT EQ 'X'.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PRT'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PRT'
DEVTYPE = 'ASCIIPRI'
FUNCPARA = ''
LEN_IN = NUMBYTES
IMPORTING
LEN_OUT = NUMBYTES
TABLES
CONTENT_IN = T_COMPRESSED_LIST
CONTENT_OUT = CONTENT_OUT
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
WRITE:/ SPOOLNO, 'NOT CONVERTED TO PRT'.
EXIT.
ENDIF.
ELSEIF P_RAW EQ 'X'.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_RAW'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'RAW'
DEVTYPE = 'ASCIIPRI'
LEN_IN = NUMBYTES
IMPORTING
LEN_OUT = NUMBYTES
TABLES
CONTENT_IN = T_COMPRESSED_LIST
CONTENT_OUT = CONTENT_OUT
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
WRITE:/ SPOOLNO, 'NOT CONVERTED TO RAW'.
EXIT.
ENDIF.
ENDIF. "CONVERSION TYPE
ELSE.
WRITE:/ SPOOLNO, 'IS NOT AN OTF'.
ENDIF.
OUTPUT:
CALL FUNCTION 'DOWNLOAD'
EXPORTING
BIN_FILESIZE = NUMBYTES
FILENAME = P_FILE
FILETYPE = 'BIN'
IMPORTING
ACT_FILENAME = P_FILE
FILESIZE = NUMBYTES
CANCEL = CANCEL
TABLES
DATA_TAB = CONTENT_OUT.
IF CANCEL = SPACE.
WRITE: / NUMBYTES, 'BYTES DOWNLOADED TO FILE', P_FILE.
ENDIF.
ELSE.
WRITE:/ 'ATTRIBUTES OF SPOOL', SPOOLNO, 'NOT FOUND'.
ENDIF.
Hope this will help you.
Cheers
Sunny
Rewrd points, if found helpful
2006 Mar 28 7:36 AM
HI Neptune,
try this FM..
SX_OBJECT_CONVERT_OTF_PRT
which Converts From OTF to Printer Format (SAPScript conversion) ..
regards
satesh
2006 Mar 28 7:40 AM
hai selvan,
I don't know if there is an FM to convert into text format,but there is to convert to PDF format.
<b>SX_OBJECT_CONVERT_OTF_PDF</b>
from here We can convert from PDF to text format..
Regards,
Srikanth.
2006 Mar 28 2:08 PM
Hi neptune,
As per form etiquette's
If you are satisfied , please close the thread by rewarding appropriate points to the helpful answers.
Cheers
Sunny
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |