Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SMART FORMS

Former Member
0 Likes
655

i have copied a driver programe of outbound delivery and modified in such a way the layout will convert to pdf and then download to pc, but the driver program is not executing online, so do i need to attache the driver program name and form name in nace t.code or how would i execute the program, when i am placing a break point in driver program and execute form its not stopping at break point, i am new to forms, help me out in this.

i have placed the code below plz verify it and say if any thing is wrong in the code, u will be shurely rewareded.

----


  • Print of a delivery note by SAPscript SMART FORMS *

----


REPORT Z_RLE_DELNOTE1.

  • declaration of data

INCLUDE Z_RLE_DELNOTE_DATA_DECLARE1.

*INCLUDE RLE_DELNOTE_DATA_DECLARE.

  • definition of forms

INCLUDE Z_RLE_DELNOTE_FORMS1.

*INCLUDE RLE_DELNOTE_FORMS.

INCLUDE Z_RLE_PRINT_FORMS1.

*INCLUDE RLE_PRINT_FORMS.

----


  • FORM ENTRY

----


FORM ENTRY USING RETURN_CODE US_SCREEN.

DATA: LF_RETCODE TYPE SY-SUBRC.

XSCREEN = US_SCREEN.

PERFORM PROCESSING USING US_SCREEN

CHANGING LF_RETCODE.

IF LF_RETCODE NE 0.

RETURN_CODE = 1.

ELSE.

RETURN_CODE = 0.

ENDIF.

ENDFORM.

----


  • FORM PROCESSING *

----


FORM PROCESSING USING PROC_SCREEN

CHANGING CF_RETCODE.

DATA: LS_PRINT_DATA_TO_READ TYPE LEDLV_PRINT_DATA_TO_READ.

DATA: LS_DLV_DELNOTE TYPE LEDLV_DELNOTE.

DATA: LF_FM_NAME TYPE RS38L_FNAM.

DATA: LS_CONTROL_PARAM TYPE SSFCTRLOP.

DATA: LS_COMPOSER_PARAM TYPE SSFCOMPOP.

DATA: LS_RECIPIENT TYPE SWOTOBJID.

DATA: LS_SENDER TYPE SWOTOBJID.

DATA: LF_FORMNAME TYPE TDSFNAME.

DATA: LS_ADDR_KEY LIKE ADDR_KEY.

*Begin of changes by 67.

DATA: ls_document_output_info TYPE ssfcrespd,

ls_job_output_options TYPE ssfcresop.

*End of changes by 67.

  • SmartForm from customizing table TNAPR

LF_FORMNAME = TNAPR-SFORM.

  • determine print data

PERFORM SET_PRINT_DATA_TO_READ USING LF_FORMNAME

CHANGING LS_PRINT_DATA_TO_READ

CF_RETCODE.

IF CF_RETCODE = 0.

  • select print data

PERFORM GET_DATA USING LS_PRINT_DATA_TO_READ

CHANGING LS_ADDR_KEY

LS_DLV_DELNOTE

CF_RETCODE.

ENDIF.

IF CF_RETCODE = 0.

PERFORM SET_PRINT_PARAM USING LS_ADDR_KEY

CHANGING LS_CONTROL_PARAM

LS_COMPOSER_PARAM

LS_RECIPIENT

LS_SENDER

CF_RETCODE.

ENDIF.

*Begin of changes by 67.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

i_language = v_language

I_APPLICATION = 'SAPDEFAULT'

IMPORTING

E_DEVTYPE = v_e_devtype

st_output_options-tdprinter = v_e_devtype.

*st_output_options-tdprinter = 'locl'.

LS_CONTROL_PARAM-no_dialog = 'X'.

LS_CONTROL_PARAM-getotf = 'X'.

*End of changes by 67.

IF CF_RETCODE = 0.

  • determine smartform function module for delivery note

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = LF_FORMNAME

  • variant = ' '

  • direct_call = ' '

IMPORTING

FM_NAME = LF_FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

  • error handling

CF_RETCODE = SY-SUBRC.

PERFORM PROTOCOL_UPDATE.

ENDIF.

ENDIF.

IF CF_RETCODE = 0.

  • call smartform delivery note

CALL FUNCTION LF_FM_NAME

EXPORTING

ARCHIVE_INDEX = TOA_DARA

ARCHIVE_PARAMETERS = ARC_PARAMS

CONTROL_PARAMETERS = LS_CONTROL_PARAM

  • mail_appl_obj =

MAIL_RECIPIENT = LS_RECIPIENT

MAIL_SENDER = LS_SENDER

OUTPUT_OPTIONS = LS_COMPOSER_PARAM

USER_SETTINGS = ' '

IS_DLV_DELNOTE = LS_DLV_DELNOTE

IS_NAST = NAST

*Begin of changes by 67.

importing

document_output_info = ls_document_output_info "67

job_output_info = tab_otf_data

job_output_options = ls_job_output_options "67

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

*End of changes by 67.

IF SY-SUBRC <> 0.

  • error handling

CF_RETCODE = SY-SUBRC.

PERFORM PROTOCOL_UPDATE.

  • get SmartForm protocoll and store it in the NAST protocoll

PERFORM ADD_SMFRM_PROT. "INS_HP_335958

ENDIF.

ENDIF.

  • get SmartForm protocoll and store it in the NAST protocoll

  • PERFORM ADD_SMFRM_PROT. DEL_HP_335958

--


Function modules conversts from otf to pdf format.--

*Begin of chanes by 67.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

  • EXPORTING

  • USE_OTF_MC_CMD = 'X'

  • ARCHIVE_INDEX =

IMPORTING

BIN_FILESIZE = v_bin_filesize

TABLES

otf = v_tab_otf_final

doctab_archive = v_it_docs

lines = v_it_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.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = v_bin_filesize

filename = 'D:\67.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 = v_file_size

tables

data_tab = v_pdf_tab

  • 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 i001(z00) WITH 'File not downloaded succesfully'.

else.

MESSAGE i002(z00) WITH 'File 67.PDF downloaded succesfully under 😧 drive'.

ENDIF.

*End of changes by 67.

ENDFORM.

3 REPLIES 3
Read only

Former Member
0 Likes
554

Hi,

Make sure that the output type you are using is configured for your custom-copied program name, form routine, and the form you are using. The output types can be found in transaction NACE.

Award points if found helpful.

Thanks,

Leo

Read only

0 Likes
554

i dont find any thing in nace transaction regarding outbound delivery output type, i am working on ides.

Read only

Former Member
0 Likes
554

Hello,

You can create a custom output type for your development. Go to transaction NACE->V2 application. You can create your own output type there. Or if you know the standard output type for the original program, you can refer to that configuration and create a new one.

Regards,

Leo