SAP CONVERT_OTF Function Module for









CONVERT_OTF is a standard convert otf SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 otf FM, simply by entering the name CONVERT_OTF into the relevant SAP transaction such as SE37 or SE38.

Function Group: STXW
Program Name: SAPLSTXW
Main Program: SAPLSTXW
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function CONVERT_OTF 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_OTF'"
EXPORTING
* FORMAT = 'ASCII' "Target format for LINES table
* MAX_LINEWIDTH = 132 "For ASCII format: Number of lines in LINES-TDLINE
* ARCHIVE_INDEX = ' ' "
* COPYNUMBER = 0 "
* ASCII_BIDI_VIS2LOG = ' ' "
* PDF_DELETE_OTFTAB = ' ' "
* PDF_USERNAME = ' ' "
* PDF_PREVIEW = ' ' "
* USE_CASCADING = ' ' "

IMPORTING
BIN_FILESIZE = "For binary format: Number of bytes in LINES
BIN_FILE = "

TABLES
OTF = "Input table with OTF format
LINES = "Output table with target format

EXCEPTIONS
ERR_MAX_LINEWIDTH = 1 ERR_FORMAT = 2 ERR_CONV_NOT_POSSIBLE = 3 ERR_BAD_OTF = 4
.



IMPORTING Parameters details for CONVERT_OTF

FORMAT - Target format for LINES table

Data type:
Default: 'ASCII'
Optional: Yes
Call by Reference: No ( called with pass by value option)

MAX_LINEWIDTH - For ASCII format: Number of lines in LINES-TDLINE

Data type:
Default: 132
Optional: Yes
Call by Reference: No ( called with pass by value option)

ARCHIVE_INDEX -

Data type: TOA_DARA
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

COPYNUMBER -

Data type: ITCPO-TDCOPIES
Optional: Yes
Call by Reference: Yes

ASCII_BIDI_VIS2LOG -

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

PDF_DELETE_OTFTAB -

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

PDF_USERNAME -

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

PDF_PREVIEW -

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

USE_CASCADING -

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

EXPORTING Parameters details for CONVERT_OTF

BIN_FILESIZE - For binary format: Number of bytes in LINES

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

BIN_FILE -

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

TABLES Parameters details for CONVERT_OTF

OTF - Input table with OTF format

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

LINES - Output table with target format

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

EXCEPTIONS details

ERR_MAX_LINEWIDTH - Line width must be between 2 and 132

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

ERR_FORMAT - Format not supported

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

ERR_CONV_NOT_POSSIBLE - Conversion not possible/supported

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

ERR_BAD_OTF -

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for CONVERT_OTF 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:
lt_otf  TYPE STANDARD TABLE OF ITCOO, "   
lv_format  TYPE ITCOO, "   'ASCII'
lv_bin_filesize  TYPE ITCOO, "   
lv_err_max_linewidth  TYPE ITCOO, "   
lt_lines  TYPE STANDARD TABLE OF TLINE, "   
lv_bin_file  TYPE XSTRING, "   
lv_err_format  TYPE XSTRING, "   
lv_max_linewidth  TYPE XSTRING, "   132
lv_archive_index  TYPE TOA_DARA, "   SPACE
lv_err_conv_not_possible  TYPE TOA_DARA, "   
lv_copynumber  TYPE ITCPO-TDCOPIES, "   0
lv_err_bad_otf  TYPE ITCPO, "   
lv_ascii_bidi_vis2log  TYPE C, "   SPACE
lv_pdf_delete_otftab  TYPE C, "   SPACE
lv_pdf_username  TYPE C, "   SPACE
lv_pdf_preview  TYPE C, "   SPACE
lv_use_cascading  TYPE C. "   SPACE

  CALL FUNCTION 'CONVERT_OTF'  "
    EXPORTING
         FORMAT = lv_format
         MAX_LINEWIDTH = lv_max_linewidth
         ARCHIVE_INDEX = lv_archive_index
         COPYNUMBER = lv_copynumber
         ASCII_BIDI_VIS2LOG = lv_ascii_bidi_vis2log
         PDF_DELETE_OTFTAB = lv_pdf_delete_otftab
         PDF_USERNAME = lv_pdf_username
         PDF_PREVIEW = lv_pdf_preview
         USE_CASCADING = lv_use_cascading
    IMPORTING
         BIN_FILESIZE = lv_bin_filesize
         BIN_FILE = lv_bin_file
    TABLES
         OTF = lt_otf
         LINES = lt_lines
    EXCEPTIONS
        ERR_MAX_LINEWIDTH = 1
        ERR_FORMAT = 2
        ERR_CONV_NOT_POSSIBLE = 3
        ERR_BAD_OTF = 4
. " CONVERT_OTF




ABAP code using 7.40 inline data declarations to call FM CONVERT_OTF

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.

 
DATA(ld_format) = 'ASCII'.
 
 
 
 
 
 
DATA(ld_max_linewidth) = 132.
 
DATA(ld_archive_index) = ' '.
 
 
"SELECT single TDCOPIES FROM ITCPO INTO @DATA(ld_copynumber).
 
 
DATA(ld_ascii_bidi_vis2log) = ' '.
 
DATA(ld_pdf_delete_otftab) = ' '.
 
DATA(ld_pdf_username) = ' '.
 
DATA(ld_pdf_preview) = ' '.
 
DATA(ld_use_cascading) = ' '.
 


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!