Search This Blog

Saturday, July 30, 2011

Download Smartform Output in PDF Format

SAP Smart Forms are used to create and maintain forms for mass printing in SAP Systems. As an output
medium SAP Smart Forms support a printer, a fax, e-mail. Many a times there is requirement to download
output of SAP Smart Forms in a PDF file.
Adobe® Portable Document Format (PDF) is a universal file format that contains all fonts, formats, and graphics. PDF files are widely used in the Internet, not least because the content of a PDF file cannot be changed, in contrast to Word.
Smart Forms does not support direct output in PDF format. Instead, the OTF output has to be converted to PDF. Fonts and code pages used have to be correct in the OTF output and are dependent on the language in which the form is printed. Depending on the language, a different device type that supports the corresponding fonts has to be used for printing.
A device type for printing PDF or for creating a PDF file is therefore not adequate for a Smart Form that is used as a template for printing forms in a number of languages. The device type has to be set dynamically before the Smart Forms function module is called.

Converting the smartform to PDF is process of 3 simple steps.
  • Calling the Smart form, then it returns the OTF data in Return.
  • Converting the OTF data into required format using the Function Module CONVERT_OTF_2_PDF.
  • Download the File

1. Call function module SSF_FUNCTION_MODULE_NAME. It returns the name of the generated function module. Call the generated function module.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    FORMNAME                 = 'SMARTFORM-NAME'
  IMPORTING
   
FM_NAME                  = FMNAME .

2. To get a device type suitable for the current language, call the function module SSF_GET_DEVICE_TYPE.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
  EXPORTING
    I_LANGUAGE                   = 'E'
  IMPORTING
   E_DEVTYPE                    = v_e_devtype  .




3. Call Smartform

CALL
 FUNCTION FMNAME
 EXPORTING
   CONTROL_PARAMETERS         = st_control_parameters
   OUTPUT_OPTIONS             = st_output_options
  IMPORTING
   DOCUMENT_OUTPUT_INFO       = st_document_output_info
   JOB_OUTPUT_INFO            = st_job_output_info
   JOB_OUTPUT_OPTIONS         = st_job_output_options
  TABLES
    ITAB                       = ITAB
    ITAB1                      = ITAB1     .


4. Call the function module 'CONVERT_OTF_2_PDF' to convert the smart form to PDF format. The function module returns the size of downloaded file.

CALL FUNCTION 'CONVERT_OTF_2_PDF'
  IMPORTING
   BIN_FILESIZE                 = v_bin_filesize
  TABLES
    OTF                          = st_job_output_info-otfdata
    DOCTAB_ARCHIVE               = it_docs
    LINES                        = it_lines    .


5. You can then store the PDF output using the function module GUI_DOWNLOAD, for example, as a local file on your PC.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
   BIN_FILESIZE                    = v_bin_filesize
   FILENAME                       = 'SMART'
   FILETYPE                        = 'BIN'
  TABLES
    DATA_TAB                        = it_lines
          .





Tuesday, July 26, 2011

SAP Client Copy By Using SCC8 and SCC7

Client Copy can be done either using the remote client copy method or export/import method.

To do Remote client copy you need to use tcode  scc9
For Client export & Import  we use scc8 and scc7
For Export / Import:
   
Client Export:
1.  Run SCC8
2.  Select Profile for desired copy type (Usually All [SAP_ALL] or user master only [SAP_USER].  You will need direction from the requester as to the correct selection here.  Use Profile -> Display Profile to display profile details.)
3.  Select target System (or group)
4.  De- Select "Test Run" (If selected)
5.  Run Export
-  Up to 3 requests are created, depending on the data selected and available:
   1. "SIDKO00353" for transporting client-independent data, if you have selected this 
   2. "SIDKT00353" for transporting client-specific data 
   3. "SIDKX00353" for transporting client-specific texts, provided texts are available in this client            
6.Monitor TP logs for errors and export files for growth                            
   
Client Import:
1. Create client (scc4)
2. Login to client (sap* - pass)
3. Manually add "O" transport then "X" then "T" to TMS buffer
4. Highlight #1 and use "Request -> Import" to launch import tool
5. Monitor "I" file in OS "/usr/sap/trans/tmp" dir for progress info
6. After Import is complete perform "post processing steps" from client tool (SCC7)
   
For Local or Remote Copy:
   
Client Import:
1. Create client (scc4)
2. Login to new client (sap* - pass)
3. Run SCCL (Local copy ) or SCC9 (remote copy) and complete the form as required
    -  Select Profile for desired copy type (Usually All [SAP_ALL] or user master only [SAP_USER].  You will need direction from the requester as to the correct selection here.  Use Profile -> Display Profile to display profile details.)
    -  Select RFC Destination to copy from for Remote copy, or Source client to copy from for Local copies
    -  Execute in background
4.       Monitor SCC3 for copy status
5.       After Import is complete perform "post processing steps" from menu in client tool (SCC7)
  
Post Client Create Checks:
-  Adjust client settings as Dev / Config / or Closed as directed by requester.
-  Update Logon Screen for new / updated client info

Friday, July 22, 2011

Difference between ABAP and HR ABAP

The followings points distinguishes HR ABAP from ABAP :

1)  Use of Infotypes
2)  The use of Logical Database
3)  Use of Macros and Provide statement
4)  Storage and Access of data
5)  Authorization checks
 
There is not much difference between abap and hr abap. The way the data is retrieved from the database is different.
In general ABAP data is stored in Tables, but coming to HR ABAP employee data is sorted through Infotypes. The way we retrieve the data from infotypes is different in hr abap.
In general ABAP we use Logical data base very rare, as in HR ABAP most of the programs use Logical Database to select data from Infotypes by using Get event.
In ABAP we use read statement to read particular record, still in HR ABAP we do use read statement apart from that we have Macros and provide statement.
Macro is pre defined code (like function module) which reads data from internal table (internal infotype) based on dates.
Provide statement is like Select statement but selects data from internal table
Storage and access of data in hr abap is completely different in hr abap compared to ABAP. We use transaction code PA20 and PA30 to maintain data in infotypes.
PA20 is display mode and PA30 is change mode. We can create, change, display, copy, and delete in infotypes with PA30 transaction.
For Infotypes authorizations can be maintained infotype and subtype (field) level as HR data is more sensitive and secrete.

Friday, July 8, 2011

'Reference Field Unknown in the Form' Smartform Error

For currency and quantity fields in smartform, their Reference fields needs to be specified in the Global Definitions ==> Currency/Quantity Fields Tab..

Here, give the internal table and field which is a currency/quantity and next to it give the standard table and field name.

Friday, July 1, 2011

Difference between User-Exit & Customer-Exit

1. USER EXITS are FORMS (subroutines) and are called 
by SAP standard programs using PERFORM. 

CUSTOMER EXITS are FUNCTIONS so they are called using CALL
FUNCTION (or more exactly CALL CUSTOMER FUNCTION).

2. Inside the form (user exit) you can read and change almost
any global data from host program. 
Inside a function (customer exit) you can only access your
import/export/changing/tables parameters.

3. User exits are more flexible because you have more
information to use in your code but on the other hand , it
is very easy to manipulate erroneously global data and lead
the standard program to a dump or even to make database
inconsistent.
Customer exits are more restrictive but you are sure any
change you can make to any parameters will never lead to
inconsistency

4. User-exit does not have any classification. 
In customer-exit we have function-module exit , screen exit
, menu exit.

5. While changing User-exit, Access Key is required (There 
are other enhancement options available now which does not 
necessarily require the object to be registered for access 
key), whereas in Customer-exit no access key is needed.