SAP SRF_GENERATE_DOCUMENT Function Module for Create Document









SRF_GENERATE_DOCUMENT is a standard srf generate document SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create Document processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for srf generate document FM, simply by entering the name SRF_GENERATE_DOCUMENT into the relevant SAP transaction such as SE37 or SE38.

Function Group: SRF_GENERATOR
Program Name: SAPLSRF_GENERATOR
Main Program: SAPLSRF_GENERATOR
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function SRF_GENERATE_DOCUMENT pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'SRF_GENERATE_DOCUMENT'"Create Document
EXPORTING
IV_REPORT_RUN_KEY = "Report run key
IV_DOCUMENT_ID = "Document ID
IV_DOCUMENT_SEQUENCE_NUMBER = "Sequence Number
IV_IS_CORRESPONDENCE = "Correspondence document
IV_PERSISTENCE_FACTORY_CLASS = "Persistence factory class name
IV_DOC_GENERATION_MODE = "Set up mode for generation documet. Event 04
* IV_DOCUMENT_NAME = "
* IS_PARAMETERS = "Generation Parameters

IMPORTING
EV_DOCUMENT_GENERATION_STATUS = "Document Status

EXCEPTIONS
FATAL_ERROR = 1 NO_AUTHORIZATION = 2
.



IMPORTING Parameters details for SRF_GENERATE_DOCUMENT

IV_REPORT_RUN_KEY - Report run key

Data type: SRF_REPORT_RUN_KEY
Optional: No
Call by Reference: No ( called with pass by value option)

IV_DOCUMENT_ID - Document ID

Data type: SRF_DOCUMENT_ID
Optional: No
Call by Reference: No ( called with pass by value option)

IV_DOCUMENT_SEQUENCE_NUMBER - Sequence Number

Data type: SRF_SEQUENCE_NUM
Optional: No
Call by Reference: No ( called with pass by value option)

IV_IS_CORRESPONDENCE - Correspondence document

Data type: FLAG
Optional: No
Call by Reference: No ( called with pass by value option)

IV_PERSISTENCE_FACTORY_CLASS - Persistence factory class name

Data type: SEOCLSNAME
Optional: No
Call by Reference: No ( called with pass by value option)

IV_DOC_GENERATION_MODE - Set up mode for generation documet. Event 04

Data type: SRF_REP_RUN_DOCS_GEN_MODE
Optional: No
Call by Reference: No ( called with pass by value option)

IV_DOCUMENT_NAME -

Data type: SRF_DOCUMENT_NAME
Optional: Yes
Call by Reference: No ( called with pass by value option)

IS_PARAMETERS - Generation Parameters

Data type: SRFS_PARAMETERS
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for SRF_GENERATE_DOCUMENT

EV_DOCUMENT_GENERATION_STATUS - Document Status

Data type: SRF_DOCUMENT_STATUS
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

FATAL_ERROR -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NO_AUTHORIZATION -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for SRF_GENERATE_DOCUMENT Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lv_fatal_error  TYPE STRING, "   
lv_iv_report_run_key  TYPE SRF_REPORT_RUN_KEY, "   
lv_ev_document_generation_status  TYPE SRF_DOCUMENT_STATUS, "   
lv_iv_document_id  TYPE SRF_DOCUMENT_ID, "   
lv_no_authorization  TYPE SRF_DOCUMENT_ID, "   
lv_iv_document_sequence_number  TYPE SRF_SEQUENCE_NUM, "   
lv_iv_is_correspondence  TYPE FLAG, "   
lv_iv_persistence_factory_class  TYPE SEOCLSNAME, "   
lv_iv_doc_generation_mode  TYPE SRF_REP_RUN_DOCS_GEN_MODE, "   
lv_iv_document_name  TYPE SRF_DOCUMENT_NAME, "   
lv_is_parameters  TYPE SRFS_PARAMETERS. "   

  CALL FUNCTION 'SRF_GENERATE_DOCUMENT'  "Create Document
    EXPORTING
         IV_REPORT_RUN_KEY = lv_iv_report_run_key
         IV_DOCUMENT_ID = lv_iv_document_id
         IV_DOCUMENT_SEQUENCE_NUMBER = lv_iv_document_sequence_number
         IV_IS_CORRESPONDENCE = lv_iv_is_correspondence
         IV_PERSISTENCE_FACTORY_CLASS = lv_iv_persistence_factory_class
         IV_DOC_GENERATION_MODE = lv_iv_doc_generation_mode
         IV_DOCUMENT_NAME = lv_iv_document_name
         IS_PARAMETERS = lv_is_parameters
    IMPORTING
         EV_DOCUMENT_GENERATION_STATUS = lv_ev_document_generation_status
    EXCEPTIONS
        FATAL_ERROR = 1
        NO_AUTHORIZATION = 2
. " SRF_GENERATE_DOCUMENT




ABAP code using 7.40 inline data declarations to call FM SRF_GENERATE_DOCUMENT

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
 
 
 
 
 
 
 
 
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!