on 09-23-2005 1:53 PM
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
You can't have a module inside of a FORM. You must put the modules outside of the FORM, maybe in an include program. Are you added this into a module pool? or just another report program>
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
its just another report program, which has a selection screen, display spool information, and then I want to display the contents of the spool, when the user clicks a particular spool , from a list, or they check a number of them.
I think I'm getting confused how I should try and integrate this code, or if there is a way to call it from the main program, with parameters.
Thanks
Hi,
"I think I'm getting confused how I should try and integrate this code, or if there is a way to call it from the main program, with parameters"
Use SUBMIT <Program Name> Technique and call your second report from the main program. Then to pass parameters, you have to convert some your data variables in the second report into parameters with defaults so that they can also be filled from the main program while callling it using SUBMIT.
Check keyword documentation for SUBMIT if you have further doubts.
Sri
Hi,
call screen brings up the screen, but none of the data that should be there is, perhaps the classes which initilise it have not done so at this stage. If I use set screen , the new screen is not displayed until I press the back button on the current screen.
Not really sure how to get round this one, I could post it as a separate question if that helps.
Thanks
That is because you can not nest a form in a module. Make sure that you paste the forms outside of your module declaration (you can call the forms though. Make alse sure that you do not post the list events top-of-page, start-of-selection.....
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.