SAP ABAP MATERIALS

SAP PRESS EBOOKS,INSTITUTE MATERIALS,SUPPORT ISSUES,TICKETTING TOOLS

1463988 10202039058114141 1070888609 n

SAP ABAP MATERIALS DOWNLOADS

REPORTS,INTERFACES,BATCH DATA COMMUNICATION PROGRAMMING,ENHANCEMENTS,SCRITS,SMART-FORMS,MODULE POOL PROGRAMING.

SAP ABAP MATERIALS

CLASS ROOM TEACHING MATERIALS

sap web gui login

http://molgaard.consolut.eu/sap/bc/gui/sap/its/webgui
Showing posts with label SMARTFORMS. Show all posts
Showing posts with label SMARTFORMS. Show all posts

Sunday, August 3, 2014

CONVERT_OTFSPOOLJOB_2_PDF

 CONVERT_OTFSPOOLJOB_2_PDF

REPORT ZEXAMPLE.
TABLES TSP01.
DATA: OTF LIKE ITCOO OCCURS 100 WITH HEADER LINE,
PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
DATA: NUMBYTES TYPE I,
PDFSPOOLID LIKE TSP01-RQIDENT,
OBJTYPE LIKE RSTSTYPE-TYPE,
TYPE LIKE RSTSTYPE-TYPE,
CANCEL.
PARAMETERS: SPOOLNO LIKE TSP01-RQIDENT,
P_FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\TEMP\DATA.PDF'.
SELECT SINGLE * FROM TSP01 WHERE RQIDENT = SPOOLNO.
IF SY-SUBRC <> 0.
WRITE: / 'SPOOL', SPOOLNO, 'DOES NOT EXIST'.
EXIT.
ENDIF.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
AUTHORITY = 'SP01'
CLIENT = TSP01-RQCLIENT
NAME = TSP01-RQO1NAME
PART = 1
IMPORTING
TYPE = TYPE
OBJTYPE = OBJTYPE

EXCEPTIONS
FB_ERROR = 1
FB_RSTS_OTHER = 2
NO_OBJECT = 3
NO_PERMISSION = 4.
IF SY-SUBRC EQ 0.
IF OBJTYPE(3) = 'OTF'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = SPOOLNO
NO_DIALOG = ' '
IMPORTING
PDF_BYTECOUNT = NUMBYTES
PDF_SPOOLID = PDFSPOOLID
TABLES
PDF = PDF
EXCEPTIONS
ERR_NO_OTF_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DSTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11.
IF SY-SUBRC NE 0.
WRITE:/ SPOOLNO, 'NOT CONVERTED TO PDF'.
EXIT.
ENDIF.
ELSE.
WRITE:/ SPOOLNO, 'IS NOT AN OTF'.
ENDIF.

CALL FUNCTION 'DOWNLOAD'
EXPORTING
BIN_FILESIZE = NUMBYTES
FILENAME = P_FILE
FILETYPE = 'BIN'
IMPORTING
ACT_FILENAME = P_FILE
FILESIZE = NUMBYTES
CANCEL = CANCEL
TABLES
DATA_TAB = PDF.
IF CANCEL = SPACE.
WRITE: / NUMBYTES, 'BYTES DOWNLOADED TO FILE', P_FILE.
ENDIF.
ELSE.

WRITE:/ 'ATTRIBUTES OF SPOOL', SPOOLNO, 'NOT FOUND'.
ENDIF.

Monday, July 28, 2014

Using folder options for page protection in smartforms

Using folder options for page protection
In this recipe, we will see how we can create a folder comprising a number of lines (block of text) so that they are all printed on the same page. If the space within a page is not enough for printing all the lines, the entire text block is printed on the subsequent page, that is, page protected.
How to do it...
For defining a folder with page protection, follow these steps:
1.     Right-click on the MAIN window. Then, from the context menu that appears, choose the option Create and then select Folder, as shown in the following screenshot:




2.     Next, enter a suitable folder name. In the right-hand pane, on the Output Options tab of the created folder, check the Page Protection indicator.



3.     Then add a text under the given folder.


4.     Add three lines to the text.


5.     Save and activate your Smart Form.
How it works...
When the form output is generated, irrespective of the number of lines printed above our three-line text, a page protection is applied. If the space on the page is not enough so that all three lines may be printed, a page break is automatically triggered and the lines are printed on a fresh new page. Otherwise, the same page is utilized. In no case will the three lines be broken into two pages.


Sunday, July 27, 2014

Page protection in Smart Forms

Introduction

This article covers the usage of Page Protection which is very much useful in Smart forms. 
Here I have created 2 texts to describe the usage of Page Protection. I have also described that what will be the output of the displayed scenario if we don't check in the Page Protection Check box(i.e. if we don't use Page Protection Option).


Steps

Step 1: Go to T-code SMARTFORMS, give the smart form name you want to create and then click on create button. For reference do it as given below.












Step 2: Once you create your smart form, you can see the details of it in this screen.














Step 3: Open Node Pages and Windows Node, %PAGE1 New Page, MAIN Main Window and create 2 texts by right clicking on the MAIN Window as shown below.





































Step 4: Go to Text Element of First Text (TEXT_PAGE1) and give below information or the information you want to print on the first page of smart form.























Step 5: Go to Text Element of Second Text (TEXT_PAGE2) and give below information or the information you want to print on the second page of smart form.






















Step 6: Double click on the second text (TEXT_PAGE2) and go to tab Output Options. Here the Page Protection check box is not marked 







Step 7: Save, Check and Activate the smart form. Click on the Print Preview to see the output as shown below [ Note : Here First few  Second Page (TEXT_PAGE2)  text elements are coming in the First page as the Page Protection is not marked  and rest are coming the second page]




















Second text contents appearing in the first page  














Step 8: Double click on the second text (TEXT_PAGE2) and go to tab Output Options. Here we have to make sure that the Page Protection check box is marked








Step 9: Save, Check and Activate the smart form. Click on the Print Preview to see the output as shown below [ Note : Here First Page (TEXT_PAGE1)  text elements are coming in the First page  and Second Page (TEXT_PAGE2)  text elements are coming in the Second page  as the Page Protection is marked.






































 Summary

Page Protection is used to avoid displaying the broken contents of the page and allow it to display in the new page from the beginning after the previous page. E.g. I have two texts available and i want to display them in two different pages without any break in any of the page contents.  But here if we don't use Page Protection then first text will be displayed in first page and if some space is available in the first page then second text also will get started after the first text contents (few lines) in the first page itself, it will break the second text contents and the rest of the lines of the second text it will display in the second page. If we use Page Protection then First text contents will be displayed in the first page and without any break of the second text contents, it will be displayed in a new page i.e. in the second page.

Wednesday, July 23, 2014

Download Smartform Output as PDF File

Download Smartform Output as PDF File

Follow the below steps to download Smartform output as PDF file.
1. Suppress the print dialog box by setting the NO_DIALOG flag of CONTROL_PARAMETERS
2. Get the OTF data by setting the GETOTF flag of CONTROL_PARAMETERS
3. Use function module CONVERT_OTF to convert OTF to PDF
4. Use function module GUI_DOWNLOAD to download the PDF file to presentation server

Below program converts the smartform output to PDF and downloads it to presentation server.

*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: gv_formname TYPE tdsfname VALUE 'ZZDEMO',
gv_fm_name TYPE rs38l_fnam.
DATA: gwa_ssfcompop TYPE ssfcompop,
gwa_control TYPE ssfctrlop.
DATA: gv_devtype TYPE rspoptype.
DATA: gv_job_output TYPE ssfcrescl.
DATA: gt_lines TYPE TABLE OF tline.
DATA: gv_size TYPE i.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.

*Get the function module name using form name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = gv_formname
IMPORTING
fm_name = gv_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 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.

*Get Device Type
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = sy-langu
IMPORTING
e_devtype = gv_devtype
EXCEPTIONS
no_language = 1
language_not_installed = 2
no_devtype_found = 3
system_error = 4
OTHERS = 5.
gwa_ssfcompop-tdprinter = gv_devtype.

*Suppress print dialog
gwa_control-no_dialog = 'X'.
gwa_control-getotf = 'X'.

*Trigger the smartform
CALL FUNCTION gv_fm_name
EXPORTING
control_parameters = gwa_control
output_options = gwa_ssfcompop
IMPORTING
job_output_info = gv_job_output
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 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 OTF to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = gv_size
TABLES
otf = gv_job_output-otfdata
lines = gt_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 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.

*Download PDF file to presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = gv_size
filename = 'C:\demo.pdf'
filetype = 'BIN'
TABLES
data_tab = gt_lines
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.