‎2014 Apr 02 4:57 PM
Hello Experts,
I am working on program to display the invoices data in PDF through ABAP program. For this i have used cl_gui_html_viewer and ALV grid. everything works fine but one. When I click on the PDF preview button on screen then for first PDF its working fine, but when i click on the another PDF preview button then it displays blank screen. In case of rerunning the program it again works fine only for first PDF preview. if anybody have idea regarding this issue please share it with me. FYI i am attaching necessary code with this.
Thanks,
Avadhut
‎2014 Apr 11 11:17 AM
‎2014 Apr 02 6:40 PM
When you click for Second record PDF file is not working , is it correct .
‎2014 Apr 03 6:28 PM
Hi Alok,
When i run the program then it displays list of several invoices. When user click on preview button then it correctly displays PDF for first, but when user want to see another PDF and clicks on the button then displays blank screen, I have tried with several methods but not working.
‎2014 Apr 04 5:24 AM
Hi ,
Loop internal table into work area where check = 'x'.
endloop.
like that .
send me your that loop code .
‎2014 Apr 04 10:10 AM
Hi alok,
You are correct its not working for second and afterwards records. I have attached the essential code with this discussion.
Thanks
Avadhut
‎2014 Apr 04 10:15 AM
Hi Alok,
Here is something wrong in the code i have used it to display PDF.
METHOD on_link_click.
DATA : l_str_content TYPE zebd_send_content.
READ TABLE m_tab_content INDEX row INTO l_str_content.
DATA: l_xml TYPE REF TO cl_xml_document.
CREATE OBJECT l_xml.
CASE column.
WHEN 'PRVW'.
g_attachment_string = l_str_content-attachment.
CALL FUNCTION 'Z_EBD_PDF_SHOW'
EXPORTING
i_id = l_str_content-id
i_pdf_string = g_attachment_string.
CREATE OBJECT g_rcl_html_control
EXPORTING
* shellstyle =
parent = g_rcl_html_container
* lifetime = lifetime_default
* saphtmlp =
* uiflag =
* name =
* saphttp =
* query_table_disabled = ''
* EXCEPTIONS
* cntl_error = 1
* cntl_install_error = 2
* dp_install_error = 3
* dp_error = 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.
FUNCTION Z_EBD_PDF_SHOW .
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_PDF_STRING) TYPE STRING
*" REFERENCE(I_ID) TYPE STRING
*"----------------------------------------------------------------------
g_attachment_string = i_pdf_string.
g_id = I_ID.
call screen 0101 STARTING AT 5 5.
ENDFUNCTION.
*----------------------------------------------------------------------*
***INCLUDE LZ_EBDO01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module STATUS_0100 output.
set pf-status '100'.
* SET TITLEBAR 'xxx'.
clear: g_url, g_tab_pdf_data,g_attachment_binary.
free: g_rcl_html_container, g_rcl_html_control.
create object g_rcl_html_container
exporting
container_name = 'PDF'.
create object g_rcl_html_control
exporting
parent = g_rcl_html_container.
* lifetime = cl_gui_html_viewer=>lifetime_dynpro.
* CREATE OBJECT g_rcl_pdf_control
* EXPORTING
* parent = g_rcl_html_container
** lifetime =
** shellstyle =
** autoalign =
* EXCEPTIONS
* cntl_error = 1
* cntl_system_error = 2
* create_error = 3
* lifetime_error = 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.
* Convert xstring to binary table to pass to the LOAD_DATA method
clear g_attachment_binary.
call function 'SSFC_BASE64_DECODE'
exporting
b64data = g_attachment_string
importing
bindata = g_attachment_binary
exceptions
others = 8.
clear g_tab_pdf_data.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = g_attachment_binary
tables
binary_tab = g_tab_pdf_data.
* Load the HTML
clear g_url.
CONCATENATE g_id '.pdf' into g_id.
g_rcl_html_control->load_data(
exporting
url = g_id
type = 'application'
subtype = 'pdf'
importing
assigned_url = g_url
changing
data_table = g_tab_pdf_data
exceptions
dp_invalid_parameter = 1
dp_error_general = 2
cntl_error = 3
others = 4 ).
* CALL METHOD g_rcl_pdf_control->open_document
* EXPORTING
* url = g_url
* EXCEPTIONS
* cntl_error = 1
* cntl_system_error = 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.
** Show it
g_rcl_html_control->show_url( url = g_url
in_place = 'X' ).
endmodule. " STATUS_0100 OUTPUT
Thanks,
Avadhut
‎2014 Apr 07 11:57 AM
‎2014 Apr 10 11:33 AM
I have tried by clearing the object memory but nothing happens. I have used couple of other methods but not able to get solution for it. 😞 Have you looked for the code
‎2014 Apr 03 8:29 PM
Hi Avadhut ,
Loop the screen.
Inside the loop screen statement write your code.
Regards,
Bhaskar V
‎2014 Apr 11 11:17 AM
‎2014 Apr 11 1:25 PM
‎2014 Apr 11 10:02 PM
Hi Rajesh,
I have used CL_GUI_PDFVIEWER and cl_gui_frontend_services=>execute this had done a trick.
Thanks,
Avadhut