Application Development 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: 

Unable to close the smartform

Former Member
0 Kudos

Dear Abapers,

Iam unable to close the PDF format called using Smartform which is opened through on click of the Button in webDynpro Application.

Please help me in closing the smartform window

I have used The following methods:

SSF_Function_Module_Name: To call the smart form.

convert_otf : To convert data into PDF format.

create_window  : to open PDF format smartform in new window.

When using create_window calling the open method i.e open( )  as the recieving parameter, the new window is opened. But Iam unable to close the window.

When i clicked on close button of that smartform window the process is going into infinte loop.

Please Help.

Regards,

Swapna.

1 REPLY 1

sanjeeb_sahoo
Participant
0 Kudos

Hi Swapna,

Please follow the below code.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

  formname                 = 'YSD_LONGBLK_LABEL_PRINTING_NEW' "Final Long Block Outer



IMPORTING

  fm_name                   = fm_name .







wa_outopt-tdnoprev  = 'X'.

wa_ctrlop-getotf    = 'X'.

wa_ctrlop-no_dialog = 'X'.

wa_ctrlop-preview = 'X'.

wa_outopt-tdimmed =  '  '.



CALL FUNCTION  fm_name

EXPORTING

 

  control_parameters         = wa_ctrlop

  output_options             = wa_outopt

  user_settings              = ' '



TABLES

  it_lng_outer               = it_lng_outer[].





CALL FUNCTION fm_name

EXPORTING



  control_parameters         = wa_ctrlop

  output_options             = wa_outopt



IMPORTING



  job_output_info            = t_otfdata



TABLES

  it_objk                    = it_objk[]

  it_lng_outer               = it_lng_outer[].





t_otf[] = t_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

  format                = 'PDF' "Tutorial on SMART FORMS

  max_linewidth         = 132

*     ARCHIVE_INDEX         = ' '

IMPORTING

  bin_filesize          = w_bin_filesize

TABLES

  otf                   = t_otf

  lines                 = t_pdf_tab

EXCEPTIONS

  err_max_linewidth     = 1

  err_format            = 2

  err_conv_not_possible = 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.

v_size = w_bin_filesize.

CONDENSE v_size.

DATA : flpath TYPE string,

      filename TYPE rlgrap-filename,

      v_uname TYPE sy-uname.

break kkghodki.

CALL FUNCTION 'GUI_GET_DESKTOP_INFO'

EXPORTING

  type          = 5

changing

  return        = v_uname .



*  v_uname =  sy-uname.

TRANSLATE v_uname TO LOWER CASE.

CONCATENATE 'C:\Users\' v_uname '\Desktop\OUTERLABEL.PDF' INTO filename .

*  filename ca

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  bin_filesize            = v_size  "w_bin_filesize

*     CODEPAGE                = ' '

  filename                = filename   "'C:\Users\vjethani\Desktop\OUTERLABEL.PDF' "

  filetype                = 'BIN'



IMPORTING

  filelength              = v_size "w_filesize

TABLES

  data_tab                = t_pdf_tab

*     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

  OTHERS                  = 10.

IF sy-subrc <> 0.

*    MESSAGE i055. "'File not downloaded succesfully' display like 'I'.

ELSE.



ENDIF.



flpath = filename.

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

  document = flpath. "'C:\Users\vjethani\Desktop\OUTERLABEL.PDF'.