Skip to Content
0
Former Member
Sep 23, 2005 at 12:53 PM

Combining 2 Programs into 1

16 Views

Hi,

I have 2 report programs that I want to combine into 1.

Basically , I have created my own version of transaction SP01 ( business requirement ) , which displays spool information, but does not display the spool on the screen. I also have another program, which displays information in pdf on the screen, I know there are functions avilable to convert spools into .pdf format.

My second program has a screen representation, and what I tried initally, create the screen, paste the code from the report into a form , and then call the form.

But I keep getting the error message:

Incorrect nesting: Before the statement "MODULE", the structure

introduced by "FORM" must be concluded by "ENDFORM"

the code for my report , which displays the pdf file is shown below;

REPORT viewing_demo MESSAGE-ID demoofficeintegratio.

TYPES: BEGIN OF document_descr,

document_name(40), document_id(64),

END OF document_descr.

TYPES: document_list TYPE document_descr OCCURS 0.

TYPES: t_url LIKE bapiuri-uri.

DATA: bds_instance TYPE REF TO cl_bds_document_set,

url_lifetime TYPE sbdst_url_lifetime.

DATA: type(128) TYPE c, subtype(128) TYPE c.

DATA: delimiter(1) TYPE c VALUE'/'.

DATA: size TYPE i.

DATA: content_table TYPE sbdst_content.

DATA: mycontent_table TYPE sbdst_content. "Sanjay Internal Table

DATA: viewer TYPE REF TO i_oi_document_viewer,

my_container TYPE REF TO cl_gui_custom_container.

DATA: fcode LIKE sy-ucomm,

edurl(2048).

DATA: inplace(1) VALUE space, via_url(1) VALUE space.

************************************************************

************************************************************

DATA: p_fname LIKE rlgrap-filename VALUE

'c:\a.pdf', v_ans.

*************************************************************

*************************************************************

SET SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'TESTVIEWER'.

SET TITLEBAR '001' WITH delimiter.

  • set titlebar 'Purchase Order Archive Documen'.

IF my_container IS INITIAL.

CREATE OBJECT my_container

EXPORTING

container_name = 'VIEW'

EXCEPTIONS

OTHERS = 1.

CASE sy-subrc.

WHEN 0.

WHEN OTHERS.

RAISE cntl_error.

ENDCASE.

ENDIF.

IF viewer IS INITIAL.

CALL METHOD c_oi_container_control_creator=>get_document_viewer

IMPORTING

viewer = viewer

EXCEPTIONS

unsupported_platform = 1.

IF sy-subrc NE 0.

MESSAGE i009.

ENDIF.

CALL METHOD viewer->init_viewer

EXPORTING

parent = my_container

EXCEPTIONS

cntl_error = 1

cntl_install_error = 2

dp_install_error = 3

dp_error = 4.

IF sy-subrc NE 0.

MESSAGE i009.

ENDIF.

ENDIF.

CLEAR edurl.

******************************************************************

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\A.PDF'

filetype = 'BIN'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = mycontent_table

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

************************************************************************

***********************

************************************************************************

***********************

type = 'application'.

subtype = 'PDF'.

inplace = 'X'.

CALL METHOD viewer->view_document_from_table

EXPORTING

type = type

subtype = subtype

size = 72704

show_inplace = inplace

CHANGING

document_table = mycontent_table

EXCEPTIONS

cntl_error = 1

not_initialized = 2

dp_error_general = 3

invalid_parameter = 4

dp_invalid_parameter = 5.

IF sy-subrc NE 0.

MESSAGE i009.

ENDIF.

ENDMODULE. "STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


MODULE user_command_0100 INPUT.

CASE fcode.

WHEN 'BACK'.

IF NOT viewer IS INITIAL.

CALL METHOD viewer->destroy_viewer

EXCEPTIONS

not_initialized = 1

free_failed = 2.

IF sy-subrc NE 0.

MESSAGE i009.

ENDIF.

FREE viewer.

ENDIF.

IF NOT my_container IS INITIAL.

CALL METHOD my_container->free

EXCEPTIONS

OTHERS = 1.

IF sy-subrc <> 0.

MESSAGE i009.

ENDIF.

FREE my_container.

ENDIF.

LEAVE PROGRAM.

WHEN 'CLOSE'.

CALL METHOD viewer->close_document

EXCEPTIONS

cntl_error = 1

not_initialized = 2.

IF sy-subrc NE 0.

MESSAGE i009.

ENDIF.

IF NOT viewer IS INITIAL.

CALL METHOD viewer->destroy_viewer

EXCEPTIONS

not_initialized = 1

free_failed = 2.

IF sy-subrc NE 0.

MESSAGE i009.

ENDIF.

FREE viewer.

ENDIF.

IF NOT my_container IS INITIAL.

CALL METHOD my_container->free

EXCEPTIONS

OTHERS = 1.

IF sy-subrc <> 0.

MESSAGE i009.

ENDIF.

FREE my_container.

ENDIF.

LEAVE PROGRAM.

ENDCASE.

CLEAR fcode.

ENDMODULE. "USER_COMMAND_0100 INPUT