SAP CONVERT_ITF_TO_ASCII Function Module for Text Conversion ITF (SAPscript Format) to ASCII









CONVERT_ITF_TO_ASCII is a standard convert itf to ascii SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Text Conversion ITF (SAPscript Format) to ASCII processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for convert itf to ascii FM, simply by entering the name CONVERT_ITF_TO_ASCII into the relevant SAP transaction such as SE37 or SE38.

Function Group: STXK
Program Name: SAPLSTXK
Main Program: SAPLSTXK
Appliation area: S
Release date: 21-Feb-2001
Mode(Normal, Remote etc): Normal Function Module
Update:



Function CONVERT_ITF_TO_ASCII pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'CONVERT_ITF_TO_ASCII'"Text Conversion ITF (SAPscript Format) to ASCII
EXPORTING
* CODEPAGE = '0000' "Target Character Set (only for TABLETYPE 'BIN')
* FORMATWIDTH = 72 "Row Width in Result Table (40 to 132, 0)
* LANGUAGE = SY-LANGU "Language of Original Text
* TABLETYPE = 'ASC' "Type of foreign format table: 'BIN' or 'ASC'
* TAB_SUBSTITUTE = ' ' "Replacement for Tab
* LF_SUBSTITUTE = ' ' "Replacement Value for Line Feed (only for TABLETYPE 'BIN')
* REPLACE_SYMBOLS = 'X' "Evaluate Symbols
* REPLACE_SAPCHARS = 'X' "Evaluate SAP Characters

IMPORTING
FORMATWIDTH_E = "Actual Format Width at Export
X_DATATAB = "Foreign Text Table (Binary)
C_DATATAB = "Foreign Text Table 132 Characters
X_SIZE = "Size of X_DATATAB in Bytes

TABLES
ITF_LINES = "SAPscript ITF Table

EXCEPTIONS
INVALID_TABLETYPE = 1
.



IMPORTING Parameters details for CONVERT_ITF_TO_ASCII

CODEPAGE - Target Character Set (only for TABLETYPE 'BIN')

Data type: TCP02-CPCODEPAGE
Default: '0000'
Optional: Yes
Call by Reference: Yes

FORMATWIDTH - Row Width in Result Table (40 to 132, 0)

Data type: ITCTK-TDLINESIZE
Default: 72
Optional: Yes
Call by Reference: Yes

LANGUAGE - Language of Original Text

Data type: SPRAS
Default: SY-LANGU
Optional: Yes
Call by Reference: Yes

TABLETYPE - Type of foreign format table: 'BIN' or 'ASC'

Data type: C
Default: 'ASC'
Optional: Yes
Call by Reference: Yes

TAB_SUBSTITUTE - Replacement for Tab

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: Yes

LF_SUBSTITUTE - Replacement Value for Line Feed (only for TABLETYPE 'BIN')

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: Yes

REPLACE_SYMBOLS - Evaluate Symbols

Data type: TDBOOL
Default: 'X'
Optional: Yes
Call by Reference: Yes

REPLACE_SAPCHARS - Evaluate SAP Characters

Data type: TDBOOL
Default: 'X'
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for CONVERT_ITF_TO_ASCII

FORMATWIDTH_E - Actual Format Width at Export

Data type: ITCTK-TDLINESIZE
Optional: No
Call by Reference: Yes

X_DATATAB - Foreign Text Table (Binary)

Data type: TDTAB_X256
Optional: No
Call by Reference: Yes

C_DATATAB - Foreign Text Table 132 Characters

Data type: TDTAB_C132
Optional: No
Call by Reference: Yes

X_SIZE - Size of X_DATATAB in Bytes

Data type: I
Optional: No
Call by Reference: Yes

TABLES Parameters details for CONVERT_ITF_TO_ASCII

ITF_LINES - SAPscript ITF Table

Data type: TLINE
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

INVALID_TABLETYPE - Parameter 'TABLETYPE' contains an invalid value.

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for CONVERT_ITF_TO_ASCII Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lv_codepage  TYPE TCP02-CPCODEPAGE, "   '0000'
lt_itf_lines  TYPE STANDARD TABLE OF TLINE, "   
lv_formatwidth_e  TYPE ITCTK-TDLINESIZE, "   
lv_invalid_tabletype  TYPE ITCTK, "   
lv_x_datatab  TYPE TDTAB_X256, "   
lv_formatwidth  TYPE ITCTK-TDLINESIZE, "   72
lv_language  TYPE SPRAS, "   SY-LANGU
lv_c_datatab  TYPE TDTAB_C132, "   
lv_x_size  TYPE I, "   
lv_tabletype  TYPE C, "   'ASC'
lv_tab_substitute  TYPE C, "   SPACE
lv_lf_substitute  TYPE C, "   SPACE
lv_replace_symbols  TYPE TDBOOL, "   'X'
lv_replace_sapchars  TYPE TDBOOL. "   'X'

  CALL FUNCTION 'CONVERT_ITF_TO_ASCII'  "Text Conversion ITF (SAPscript Format) to ASCII
    EXPORTING
         CODEPAGE = lv_codepage
         FORMATWIDTH = lv_formatwidth
         LANGUAGE = lv_language
         TABLETYPE = lv_tabletype
         TAB_SUBSTITUTE = lv_tab_substitute
         LF_SUBSTITUTE = lv_lf_substitute
         REPLACE_SYMBOLS = lv_replace_symbols
         REPLACE_SAPCHARS = lv_replace_sapchars
    IMPORTING
         FORMATWIDTH_E = lv_formatwidth_e
         X_DATATAB = lv_x_datatab
         C_DATATAB = lv_c_datatab
         X_SIZE = lv_x_size
    TABLES
         ITF_LINES = lt_itf_lines
    EXCEPTIONS
        INVALID_TABLETYPE = 1
. " CONVERT_ITF_TO_ASCII




ABAP code using 7.40 inline data declarations to call FM CONVERT_ITF_TO_ASCII

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single CPCODEPAGE FROM TCP02 INTO @DATA(ld_codepage).
DATA(ld_codepage) = '0000'.
 
 
"SELECT single TDLINESIZE FROM ITCTK INTO @DATA(ld_formatwidth_e).
 
 
 
"SELECT single TDLINESIZE FROM ITCTK INTO @DATA(ld_formatwidth).
DATA(ld_formatwidth) = 72.
 
DATA(ld_language) = SY-LANGU.
 
 
 
DATA(ld_tabletype) = 'ASC'.
 
DATA(ld_tab_substitute) = ' '.
 
DATA(ld_lf_substitute) = ' '.
 
DATA(ld_replace_symbols) = 'X'.
 
DATA(ld_replace_sapchars) = 'X'.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!