SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

SAPscript



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Fri Sep 14, 2007 4:31 pm    Post subject: SAPscript Reply with quote

OPEN_FORM - Open SAPscript form printing
- to only preview the form: options-tdpreview='X' (options-tdnoprint forbids print even from preview)
- to get OTF data instead of printing: options-tdgetotf='X'
- to output OTF data to memory buffer instead of printing: device='OTF_MEM'

Code:

REPORT z_sapscript_form.
data: w_options type itcpo,
w_result type itcpp,
w_otf like itcoo occurs 0 with header line,
w_ascii like tline occurs 0 with header line,
w_device(40) type c,
w_num like sy-tabix.

parameters: printer like tsp03-padest lower case default 'locl',
layoutst like rsscf-tdform default 'MEDRUCK'.
selection-screen: begin of line.
parameters p_prn radiobutton group rad0.
selection-screen: comment 4(60) cmt_prn for field p_prn,
end of line.
selection-screen: begin of line.
parameters p_pre radiobutton group rad0.
selection-screen: comment 4(60) cmt_pre for field p_pre,
end of line.
selection-screen: begin of line.
parameters p_mem radiobutton group rad0.
selection-screen: comment 4(60) cmt_mem for field p_mem,
end of line.
selection-screen: begin of line.
parameters p_otf radiobutton group rad0.
selection-screen: comment 4(60) cmt_otf for field p_otf,
end of line.

initialization.
cmt_prn = 'Print to spool'.
cmt_pre = 'Only create form and preview, no print'.
cmt_mem = 'Output OTF to memory buffer and convert to ASCII'.
cmt_otf = 'Only get OTF data'.

start-of-selection.
perform: form_open,
print_item,
form_close.
case 'X'.
when p_prn. write: / 'See Spool#', w_result-tdspoolid,
'(', w_result-tdpages, ' pages )'.
when p_pre.
when p_otf. loop at w_otf.
write / w_otf.
endloop.
when p_mem. perform get_ascii.
endcase.
*---------------------------------------------------------------------*
* FORM FORM_OPEN *
*---------------------------------------------------------------------*
* Start of printing the form *
*---------------------------------------------------------------------*
form form_open.
w_options-tddest = printer.
w_device = 'PRINTER'. "default
case 'X'.
when p_pre. w_options-tdpreview = 'X'.
w_options-tdnoprint = 'X'.
when p_prn.
when p_mem. w_device = 'OTF_MEM'.
when others. w_options-tdgetotf = 'X'.
endcase.
call function 'OPEN_FORM'
exporting
device = w_device
dialog = ' '
form = layoutst
options = w_options
exceptions
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error = 10
others = 11.
write: / 'Form open. Return code =', sy-subrc.
if sy-subrc <> 0.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform.
*&---------------------------------------------------------------------*
*& Form PRINT_ITEM
*&---------------------------------------------------------------------*
* Print form item *
*----------------------------------------------------------------------*
form print_item.
call function 'WRITE_FORM'
exceptions
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
others = 9.
write: / 'Form print. Return code =', sy-subrc.
if sy-subrc <> 0.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " PRINT_ITEM
*---------------------------------------------------------------------*
* FORM FORM_CLOSE *
*---------------------------------------------------------------------*
* End of printing the form *
*---------------------------------------------------------------------*
form form_close.
call function 'CLOSE_FORM'
importing
result = w_result
tables
otfdata = w_otf
exceptions
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
others = 5.
write: / 'Form close. Return code =', sy-subrc,
'Spool#', w_result-tdspoolid.
if sy-subrc <> 0.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
describe table w_otf lines w_num.
write: / 'OTF has', w_num, 'lines.'.
endif.
endform.
*&---------------------------------------------------------------------*
*& Form get_ascii
*&---------------------------------------------------------------------*
* convert OTF from memory to ASCII text
*----------------------------------------------------------------------*
form get_ascii.
call function 'CONVERT_OTF_MEMORY'
tables
lines = w_ascii
exceptions
memory_empty = 1
err_max_linewidth = 2
err_format = 3
err_conv_not_possible = 4
others = 5.
write: / 'Convert OTF memory. Return code =', sy-subrc.
if sy-subrc <> 0.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
describe table w_ascii lines w_num.
write: / 'OTF has', w_num, 'lines.'.
loop at w_ascii.
write: / w_ascii.
endloop.
endif.
endform. " get_ascii


CLOSE_FORM - End SAPscript layout set printing
- spool #: result-tdspoolid
- OTF data: otfdata (when options-tdgetotf='X' in OPEN_FORM)

WRITE_FORM - Output SAPscript text element in form window

CONTROL_FORM - Control SAPscript form output
- issue command to the form, e.g. exporting command = 'NEW-PAGE'

CONVERT_OTF_MEMORY - Convert SAPscript OTF from memory into text format
output: table of structure TLINE (OTF saved to memory buffer by OPEN_FORM)

SAVE_OTF_TO_MEMORY - Write OTF format to memory
export|import OTF internal table to|from memory id ...

READ_OTF_FROM_MEMORY - Read OTF from memory

PRINT_OTF - print OTF from internal table

DISPLAY_OTF - Display an OTF table on the screen

DISPLAY_POSTSCRIPT - Display a postscript table on the screen tables postscript structure itcps

CONVERT_OTF - Convert OTF format to various formats (TLINE table) ASCII or PDF
Code:
CALL FUNCTION "CONVERT_OTF"
       EXPORTING    FORMAT                = "PDF"
       IMPORTING    BIN_FILESIZE          = FILE_LEN
       TABLES       OTF                   = OTFDATA
                    LINES                 = PDFDATA
       EXCEPTIONS   ERR_MAX_LINEWIDTH     = 1                   
                    ERR_FORMAT            = 2
                    ERR_CONV_NOT_POSSIBLE = 3
                    OTHERS                = 4.


CONVERT_OTF_2_PDF - Convert OTF to PDF (TLINE table).
OTF can be filled used archivelink. Calls CONVERT_OTF.

CONVERT_OTF_2_PDF_ARCHIVELINK - Convert OTF to PDF (TLINE table).
Calls CONVERT_OTF. Looks like the function names for these two functions are mixed up J

CONVERT_OTF_AND_FAX

CONVERT_OTF_AND_MAIL

CONVERT_OTFSPOOLJOB_2_PDF
Input: spool # (SAPscript: tsp01-rqdoctype='OTF'); Output: PDF as internal table (TLINE)

CONVERT_ABAPSPOOLJOB_2_PDF
Input: spool # (ABAP listing: tsp01-rqdoctype='LIST'); Output: PDF as internal table (TLINE)

OTF_CONVERT - wraps several other function modules. Will convert OTF to ASCII or PDF

SX_OBJECT_CONVERT_OTF_PDF - Conversion From OTF to PDF (SAPScript conversion)

SX_OBJECT_CONVERT_OTF_PRT - Conversion From OTF to Printer Format (SAPScript conversion)

SX_OBJECT_CONVERT_OTF_RAW - Conversion From OTF to ASCII (SAPScript conversion)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.