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

CL_GUI_HTML_VIEWER Multiple Pages Problem

0 Likes
3,021

Hello,

i did custom container in html viewer(CL_GUI_HTML_VIEWER). I want do multiple pages for output viewer. I could not make it. i wait for help. i add attached a pictures for program. thx everyone.

*&---------------------------------------------------------------------*
*& Form create_form
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM create_form .
IF cc_form IS NOT BOUND.
* IF cc_form IS INITIAL.
CREATE OBJECT cc_form
EXPORTING
container_name = 'CC_FORM'.
* ENDIF.
CREATE OBJECT html_viewer
EXPORTING
parent = cc_form.
ELSE.
ENDIF.
ENDFORM.

*&---------------------------------------------------------------------*
*& Form create_ssf
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM create_ssf .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZCO_HR_DENEM_SURESI'
IMPORTING
fm_name = gv_fm_name.

"Get smartform function module name
"create PDF Viewer object
CLEAR gs_selected.
LOOP AT gt_selected INTO gs_selected.


wa_control_par-no_dialog = 'X'.
wa_control_par-getotf = 'X'.
wa_output_options-tddest = 'ZPFD2'.
wa_output_options-tdgroup = 'X'.
lv_tckn = gs_selected-merni.
lv_ename = gs_selected-ename.
lv_pernr = gs_selected-pernr.



CALL FUNCTION gv_fm_name
EXPORTING
control_parameters = wa_control_par
output_options = wa_output_options
lv_tckn = lv_tckn
lv_pernr = lv_pernr
lv_ename = lv_ename
IMPORTING
job_output_info = wa_job_output_info
TABLES
tab_it0002 = it_it0002
tab_it0008 = it_it0008
itab = gt_selected.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form display_pdf
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM display_pdf .
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
TABLES
otf = it_otf_data
lines = it_pdf.

LOOP AT it_pdf INTO wa_pdf.
ASSIGN wa_pdf TO <fs_pdf> CASTING.
CONCATENATE gv_content <fs_pdf> INTO gv_content IN BYTE MODE.
ENDLOOP.

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

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.
" DISPLAY_PDF OUTPUT
ENDFORM.

8 REPLIES 8
Read only

Sandra_Rossi
Active Contributor
2,656

If you display a PDF via the HTML Viewer, you can view all the pages. I don't get what your issue is.

Read only

0 Likes
2,656

For example: I'm selecting three lines on alv. I expect the number of page output to be three. However, only the first page image is generated.

Read only

0 Likes
2,656

I did a loop before going to ''CALL FUNCTION gv_fm_name" But again not working.

Read only

kasralikarpratik
Explorer
0 Likes
2,656

Check your Adobe PDF version

Read only

0 Likes
2,656

Do you give a code example for container in adobe PDF. Because i just couldn't do it.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,656

In fact your question is not about CL_GUI_HTML_VIEWER, it's about how you assemble multiple smart forms into one PDF. You must OPEN for only the first smart form, and CLOSE only when you generate the last smart form.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,656

(fields NO_OPEN and NO_CLOSE of parameter CONTROL_PARAMETERS)

Read only

0 Likes
2,656

okay. For alternative, How to do adobe form in custom container?

Thank you