Skip to Content
author's profile photo Former Member
Former Member

Smartforms o/p 2 PDF conversion problem , plz see my code

Hi Smartform Guys

1)I m getting error <b>"CONVT_NO_NUMBER "</b> in converting my Smartform output to PDF.

*----


*

*Printing of Export Invoice, Packing List,Enclosure to Packing List & *

*Case Marking in one SMART FORMS Layout *

----


REPORT ZSD_REP_MULTI_PRINT.

TABLES :

vbak,

vbap,

vbpa,

vbfa,

VBRK,

VBRP,

LIKP,

LIPS,

KONV,

objk,

tvko,

ser01,

sadr,

equi,

makt,

mast,

t005t,

kna1,

t001w,

T001,

ADRC,

sscrfields,

zpp_plcmi, "Packing list history For Conf: Item data

zplh, "PACKING LIST HISTORY : HEADER DATA

zpli. "PACKING LIST HISTORY : ITEM DATA

DATA: FM_NAME TYPE RS38L_FNAM,

P_E_DEVTYPE TYPE RSPOPTYPE,

P_JOB_OUTPUT_INFO TYPE SSFCRESCL OCCURS 2000 WITH HEADER LINE,

P_OUTPUT_OPTIONS TYPE SSFCOMPOP OCCURS 0 WITH HEADER LINE,

P_CONTROL_PARAMETERS TYPE SSFCTRLOP OCCURS 0 WITH HEADER LINE ,

P_DOC LIKE DOCS OCCURS 2000 WITH HEADER LINE,

P_LINES LIKE TLINE OCCURS 200,

P_BIN_FILESIZE TYPE I,

P_LANGUAGE TYPE SFLANGU,

P_BIN_FILE TYPE XSTRING.

DATA: T_ITEM TYPE ZSD_TABL_LITEM,

WA_ITEM TYPE ZSD_STRUCT_LITEM,

T_ADRS LIKE ZSD_STRUCT_ADRS OCCURS 0 WITH HEADER LINE,

MSLINES LIKE TLINE OCCURS 1 WITH HEADER LINE,

TIDNO LIKE STXL-TDID,

TNAME LIKE STXL-TDNAME,

TOBJT LIKE STXL-TDOBJECT,

SSORD LIKE VBAK-VBELN,

TOT LIKE VBAK-NETWR,

WORD LIKE SPELL.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

PARAMETERS: P_DELNO LIKE LIKP-VBELN OBLIGATORY,

P_INVNO LIKE VBRK-VBELN OBLIGATORY,

P_DATE LIKE SY-DATUM.

SELECTION-SCREEN END OF BLOCK blk1.

AT SELECTION-SCREEN.

CLEAR T_ADRS.

REFRESH T_ITEM.

T_ADRS-INVNO = P_INVNO.

T_ADRS-INVDAT = P_DATE.

SELECT SINGLE VBELV INTO VBFA-VBELV

FROM VBFA

WHERE VBELN = P_DELNO

AND VBTYP_N = 'J' .

SSORD = VBFA-VBELV.

*Exporter's Address

SELECT SINGLE BUKRS_VF INTO VBAK-BUKRS_VF

FROM VBAK

WHERE VBELN = VBFA-VBELV.

SELECT SINGLE ADRNR

INTO T001-ADRNR

FROM T001

WHERE BUKRS = VBAK-BUKRS_VF.

SELECT SINGLE NAME1 STREET CITY1 POST_CODE1 COUNTRY

INTO (T_ADRS-NAME1,T_ADRS-STREET,T_ADRS-CITY1,

T_ADRS-POST_CODE1, ADRC-COUNTRY)

FROM ADRC

WHERE ADDRNUMBER EQ T001-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-COUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

**BUYERS NO & DATE

*

  • SELECT SINGLE BSTNK BSTDK INTO (T_ADRS-BSTNK,T_ADRS-BSTDK)

  • FROM VBAK

  • WHERE VBELN = VBFA-VBELV.

*Consignee Address & Buyer Other Than Consignee

SELECT SINGLE KUNNR KUNAG INTO (LIKP-KUNNR, LIKP-KUNAG)

FROM LIKP WHERE VBELN = P_DELNO.

IF LIKP-KUNNR = LIKP-KUNAG.

SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR

INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,

T_ADRS-CCITY, T_ADRS-CPCODE, T_ADRS-CREGIO,

T_ADRS-CTELF1, KNA1-ADRNR)

FROM KNA1

WHERE KUNNR = LIKP-KUNNR.

SELECT SINGLE COUNTRY INTO ADRC-COUNTRY

FROM ADRC

WHERE ADDRNUMBER EQ KNA1-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-CCOUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

T_ADRS-ONAME1 = T_ADRS-CNAME1 .

T_ADRS-ONAME2 = T_ADRS-CNAME2 .

T_ADRS-OSTREET = T_ADRS-CSTREET .

T_ADRS-OCITY = T_ADRS-CCITY.

T_ADRS-OPCODE = T_ADRS-CPCODE .

T_ADRS-OREGIO = T_ADRS-CREGIO.

T_ADRS-OTELF1 = T_ADRS-CTELF1 .

T_ADRS-OCOUNTRY = T_ADRS-CCOUNTRY.

ELSE.

SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR

INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,

T_ADRS-CCITY, T_ADRS-CPCODE, T_ADRS-CREGIO,

T_ADRS-CTELF1, KNA1-ADRNR)

FROM KNA1

WHERE KUNNR = LIKP-KUNNR.

SELECT SINGLE COUNTRY INTO ADRC-COUNTRY

FROM ADRC

WHERE ADDRNUMBER EQ KNA1-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-CCOUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

*Buyer Other than Consignee

SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR

INTO (T_ADRS-ONAME1, T_ADRS-ONAME2, T_ADRS-OSTREET,

T_ADRS-OCITY, T_ADRS-OPCODE, T_ADRS-OREGIO,

T_ADRS-OTELF1, KNA1-ADRNR)

FROM KNA1

WHERE KUNNR = LIKP-KUNAG.

SELECT SINGLE COUNTRY INTO ADRC-COUNTRY

FROM ADRC

WHERE ADDRNUMBER EQ KNA1-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-OCOUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

ENDIF.

*Other's Ref

TIDNO = 'Z071'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-OREF = mslines-tdline(25).

EXIT.

ENDLOOP.

*Buyer's Order No Ref

TIDNO = 'Z023'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-BUYER = mslines-tdline(25).

EXIT.

ENDLOOP.

*Exporter Ref

TIDNO = 'Z072'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-XPREF = mslines-tdline(25).

EXIT.

ENDLOOP.

*Pre-Carraige By

TIDNO = 'Z074'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PCRG = mslines-tdline(25).

EXIT.

ENDLOOP.

*Place Of reciept by Pre-Carraige

TIDNO = 'Z073'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PLPCRG = mslines-tdline(25).

EXIT.

ENDLOOP.

*Vessel/Flight No

TIDNO = 'Z075'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-VFNO = mslines-tdline(25).

EXIT.

ENDLOOP.

*Port Of Loading

TIDNO = 'Z077'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PLOAD = mslines-tdline(25).

EXIT.

ENDLOOP.

*Port Of Discharge

TIDNO = 'Z076'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PDISG = mslines-tdline(25).

EXIT.

ENDLOOP.

*Final Destination

TIDNO = 'Z070'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-FDEST = mslines-tdline(25).

EXIT.

ENDLOOP.

*Terms Of Delivery & Payment

TIDNO = 'Z080'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-TERMS = mslines-tdline(50).

EXIT.

ENDLOOP.

  • APPEND T_ADRS.

*BODY SECTION FOR LINE ITEMS

SELECT POSNR KWMENG VRKME WAERK

INTO (VBAP-POSNR, VBAP-KWMENG, VBAP-VRKME, VBAP-WAERK)

FROM VBAP

WHERE VBELN = SSORD.

*Mark/Case No

TIDNO = '0002'.

CONCATENATE SSORD

VBAP-POSNR

INTO TNAME.

TOBJT = 'VBBP'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

WA_ITEM-MARKNO = mslines-tdline(40).

EXIT.

ENDLOOP.

*Packing Type

TIDNO = '0003'.

CONCATENATE SSORD

VBAP-POSNR

INTO TNAME.

TOBJT = 'VBBP'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

WA_ITEM-PACKTYP = mslines-tdline(40).

EXIT.

ENDLOOP.

*Goods Description

TIDNO = '0001'.

CONCATENATE SSORD

VBAP-POSNR

INTO TNAME.

TOBJT = 'VBBP'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

WA_ITEM-PACKTYP = mslines-tdline(40).

EXIT.

ENDLOOP.

*Goods Quantity

WA_ITEM-QTY = VBAP-KWMENG.

WA_ITEM-VRKME = VBAP-VRKME.

*Goods Rate

SELECT SINGLE KNUMV INTO VBAK-KNUMV FROM VBAK WHERE VBELN = SSORD.

SELECT SINGLE KBETR WAERS

INTO (WA_ITEM-RATE, WA_ITEM-WAERS)

FROM KONV

WHERE KNUMV = VBAK-KNUMV

AND KPOSN = VBAP-POSNR

AND KSCHL = 'PR00'.

*Goods Amount

WA_ITEM-AMOUNT = WA_ITEM-QTY * WA_ITEM-RATE.

WA_ITEM-WAERK = VBAP-WAERK.

TOT = TOT + WA_ITEM-AMOUNT.

APPEND WA_ITEM TO T_ITEM.

ENDSELECT.

T_ADRS-TOT = TOT.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = TOT

CURRENCY = VBAP-WAERK

  • FILLER = ' '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = WORD

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

  • TEXT = WORD-WORD.

*

  • CONCATENATE TEXT

  • 'DECIMAL'

  • WORD-WORD

  • INTO TEXT

  • SEPARATED BY ' '.

T_ADRS-TOT_WORDS = WORD-WORD.

APPEND T_ADRS.

START-OF-SELECTION.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'Z_SD_REP_MULTI_PRINT'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

P_LANGUAGE = 'EN'.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

I_LANGUAGE = P_LANGUAGE

I_APPLICATION = 'SAPDEFAULT'

IMPORTING

E_DEVTYPE = P_E_DEVTYPE.

P_OUTPUT_OPTIONS-XSFCMODE = 'X'.

P_OUTPUT_OPTIONS-XSF = SPACE.

P_OUTPUT_OPTIONS-XDFCMODE = 'X'.

P_OUTPUT_OPTIONS-XDF = SPACE.

P_OUTPUT_OPTIONS-TDPRINTER = P_E_DEVTYPE.

P_OUTPUT_OPTIONS-TDDEST = 'LOCL'.

APPEND P_OUTPUT_OPTIONS.

P_CONTROL_PARAMETERS-NO_DIALOG = 'X'.

P_CONTROL_PARAMETERS-GETOTF = 'X'.

P_CONTROL_PARAMETERS-NO_CLOSE = SPACE.

APPEND P_CONTROL_PARAMETERS.

CALL FUNCTION FM_NAME

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = P_CONTROL_PARAMETERS

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = P_OUTPUT_OPTIONS

USER_SETTINGS = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = P_JOB_OUTPUT_INFO

  • JOB_OUTPUT_OPTIONS =

TABLES

T_ADRS = T_ADRS

T_ITEM = T_ITEM

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

  • P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

EXPORTING

USE_OTF_MC_CMD = 'X'

  • ARCHIVE_INDEX =

IMPORTING

BIN_FILESIZE = P_BIN_FILESIZE

TABLES

OTF = P_JOB_OUTPUT_INFO-OTFDATA

DOCTAB_ARCHIVE = P_DOC

LINES = P_LINES

EXCEPTIONS

ERR_CONV_NOT_POSSIBLE = 1

ERR_OTF_MC_NOENDMARKER = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

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

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

ENDIF.

  • BREAK-POINT.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

BIN_FILESIZE = P_BIN_FILESIZE

  • CODEPAGE = ' '

FILENAME = 'C:\TEMP.PDF'

FILETYPE = 'BIN'

MODE = ''

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

IMPORTING

FILELENGTH = P_BIN_FILESIZE

TABLES

DATA_TAB = P_LINES

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_WRITE_ERROR = 2

  • INVALID_FILESIZE = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • NO_AUTHORITY = 10

  • OTHERS = 11

.

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 'GUI_DOWNLOAD'

  • EXPORTING

  • BIN_FILESIZE = P_BIN_FILESIZE

  • FILENAME = 'C:\Documents and Settings\pvipin\Desktop\sd.pdf'

  • FILETYPE = 'BIN'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • 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'

  • IMPORTING

  • FILELENGTH =

*TABLES

  • DATA_TAB = P_LINES.

  • 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.

  • ENDIF.

&----


*& Form FINDTEXT

&----


  • text

----


FORM FINDTEXT.

REFRESH mslines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = tidno

language = sy-langu

name = tname

object = tobjt

TABLES

lines = mslines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

DELETE mslines WHERE tdline IS INITIAL.

ENDFORM. "FINDTEXTThnx in Advnce

Moni

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Feb 14, 2005 at 05:34 AM

    Hello,

    Plz uncomment 'IMPORTING' in the FM

    <b>* IMPORTING</b>

    • DOCUMENT_OUTPUT_INFO =

    • JOB_OUTPUT_INFO =

    JOB_OUTPUT_OPTIONS = P_JOB_OUTPUT_INFO

    I hope this helps you.

    Regards, Murugesh AS

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 14, 2005 at 06:02 AM

    Hello,

    Do you still have problem??

    Regds, Murugesh AS

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 14, 2005 at 06:12 AM

    Check out transaction SMARTSTYLE(S), create a smartstyle element such as paragraph, character etc... While creating the SMARTFORM, you need to specify the name of the SMARTSTYLE you intend to use. All the elements for that particular SMARTSTYLE are then visible while creating a text element.

    Request you to check help.sap.com for more information on Smartforms.

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.