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

Refresh smart-forms custom control

Former Member
0 Likes
1,855

Hi Guys !

I did selection criteria and smart form report in one page using custom control and works fine, but the problem is I cant't refresh the old one when I use new selection criteria.

code:-

IF IT_PDF IS INITIAL.
DATA:LV_FNMAE TYPE TDSFNAME.


CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSF_TKT'
IMPORTING
FM_NAME = LV_FNMAE
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.

WA_CPARAM-PREVIEW = 'X'.
WA_CPARAM-LANGU = 'E'.
WA_CPARAM-NO_DIALOG = 'X'. " It supresses the Printer dialog.
WA_CPARAM-GETOTF = 'X'. " Get OTF data
WA_OUTPUT-TDDEST = 'LP01'. " Set printer

CALL FUNCTION LV_FNMAE
EXPORTING
IT_CPNDTL = IT_CPNDTL
IT_TKT = IT_TKT
IT_DOCFOP = IT_DOCFOP
CARNUMCOD = CARNUMCOD
DOCNUM = DOCNUM
CONTROL_PARAMETERS = WA_CPARAM
OUTPUT_OPTIONS = WA_OUTPUT
USER_SETTINGS = SPACE
IMPORTING "" added
JOB_OUTPUT_INFO = GV_JOB_OUTPUT "" added
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.
ELSE.


* IT_OTF_DATA = WA_JOB_OUTPUT_INFO-OTFDATA.
"Convert OTF data to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = GV_BIN_FILESIZE
* BIN_FILE = BIN_FILE
TABLES
OTF = GV_JOB_OUTPUT-OTFDATA
LINES = IT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.

* CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
* TABLES
* OTF_TABLE = GV_JOB_OUTPUT-OTFDATA.

"create the controls and their containers
IF MAIN_CONTAINER IS INITIAL.
CREATE OBJECT MAIN_CONTAINER
EXPORTING
CONTAINER_NAME = 'CUST_CONTROL'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6.

"convert pdf to xstring string
LOOP AT IT_PDF INTO WA_PDF.
ASSIGN WA_PDF TO <FS_X> CASTING.
CONCATENATE GV_CONTENT <FS_X> INTO GV_CONTENT IN BYTE MODE.
ENDLOOP.

"create PDF Viewer object
CREATE OBJECT HTML_VIEWER
EXPORTING
PARENT = MAIN_CONTAINER.
IF SY-SUBRC <> 0.
"NO PDF viewwer
ENDIF.
"Convert xstring to binary table to pass to the LOAD_DATA method
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = GV_CONTENT
TABLES
BINARY_TAB = IT_DATA.
" Load the HTML
CALL METHOD HTML_VIEWER->LOAD_DATA(
EXPORTING
TYPE = 'application'
SUBTYPE = 'pdf'
IMPORTING
ASSIGNED_URL = GV_URL
CHANGING
DATA_TABLE = IT_DATA
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_ERROR = 3
OTHERS = 4 ).
IF SY-SUBRC <> 0.
WRITE:/ 'ERROR: CONTROL->LOAD_DATA'.
EXIT.
ENDIF.
"Show it
CALL METHOD HTML_VIEWER->SHOW_URL( URL = GV_URL IN_PLACE = 'X').
IF SY-SUBRC <> 0.
WRITE:/ 'ERROR: CONTROL->SHOW_DATA'.
EXIT.
ENDIF.
ENDIF.

ENDIF.
ENDIF.

1 ACCEPTED SOLUTION
Read only

venkateswaran_k
Active Contributor
0 Likes
1,392

Hi

Your main container object has to be refreshed. Either you release that object once done or delete and recreate it if any change in the selection criteria.

Regards,

Venkat

3 REPLIES 3
Read only

venkateswaran_k
Active Contributor
0 Likes
1,393

Hi

Your main container object has to be refreshed. Either you release that object once done or delete and recreate it if any change in the selection criteria.

Regards,

Venkat

Read only

0 Likes
1,392

it works fine thanks

Read only

FredericGirod
Active Contributor
0 Likes
1,392
html_viewer->do_refresh( ).

next time use the [CODE] button