Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

problem in FM FB_CONVERT_FORM_TO_XML

Hello every SDNer,

I wanna convert a smartform to a Xml-file with FM FB_CONVERT_FORM_TO_XML. The smartform is 'SF_EXAMPLE_01', but the XML-file has always error. who can help me, to find the problem. the code as following.

regards

Thanks in advance

REPORT ZYLITEST1.

*----


data : x type xstring.

data : begin of itab occurs 0,

f(100) type c,

end of itab.

data : xml type string.

*----


CALL FUNCTION 'FB_CONVERT_FORM_TO_XML'

EXPORTING

I_FORMNAME = 'SF_EXAMPLE_01'

IMPORTING

E_XML = x

EXCEPTIONS

NO_NAME = 1

NO_FORM = 2

NO_ACTIVE_SOURCE = 3

CONVERSION_ERROR = 4

ILLEGAL_FORMTYPE = 5

GENERATION_ERROR = 6

OTHERS = 7

.

*----


CALL FUNCTION 'NLS_STRING_CONVERT_TO_SYS'

EXPORTING

LANG_USED = 'E'

SOURCE = x

  • FROM_FE = 'MS '

IMPORTING

RESULT = xml

  • SUBSTED =

EXCEPTIONS

ILLEGAL_SYST_CODEPAGE = 1

NO_FE_CODEPAGE_FOUND = 2

COULD_NOT_CONVERT = 3

OTHERS = 4.

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

.

*----


CALL FUNCTION 'SOTR_SERV_STRING_TO_TABLE'

EXPORTING

TEXT = xml

FLAG_NO_LINE_BREAKS = ' '

  • LINE_LENGTH =

  • LANGU = SY-LANGU

TABLES

TEXT_TAB = itab

.

*----


CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'c:\aa.xml'

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = itab

  • FIELDNAMES =

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question