SAP BAPI_CTRACPSINVDOC_CREATE Function Module for Create Invoicing Docs
BAPI_CTRACPSINVDOC_CREATE is a standard bapi ctracpsinvdoc create 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 Invoicing Docs 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 bapi ctracpsinvdoc create FM, simply by entering the name BAPI_CTRACPSINVDOC_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: FMCA_INV_BOR
Program Name: SAPLFMCA_INV_BOR
Main Program: SAPLFMCA_INV_BOR
Appliation area:
Release date: 10-Oct-2007
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_CTRACPSINVDOC_CREATE 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 'BAPI_CTRACPSINVDOC_CREATE'"Create Invoicing Docs.
EXPORTING
APPL_AREA = "Application Area
* X_GETPDF = "Generate PDF File for Invoicing Document
* X_SIMULATE = "Invoicing Document is Simulated
INV_PROCESS = "Invoicing Process
* CONT_ACCT = "Contract Account Number
BUSINESS_PARTNER = "Business Partner Number
RECONCILIATION_KEY = "Reconciliation Key for General Ledger
* POST_DATE = "Posting Date in the Document
* DOC_DATE = "Document Date in Document
* X_PRINT_SIMULATE = "Simulate Printing of Invoicing Document
* X_PRINT = "Print Invoicing Document
IMPORTING
PDF_SAP_OBJECT = "SAP ArchiveLink: Object type of business object
PDF_OBJECT_ID = "SAP ArchiveLink: Object ID (Object Identifier)
TABLES
* SOURCEDOCUMENT = "BAPI: Input Structure for Details on Source Document
* INVDOCHEADER = "BAPI: Input Structure for Invoicing Document (Header)
* CADOCUMENT = "BAPI: Input Structure for FI-CA Document
* INVDOCPDF = "BAPI: Invoice in PDF Format (128 Bytes per Line)
* INVDOCPDF2 = "BAPI: Invoice in PDF Format (1024 Bytes per Line)
RETURN = "Return Parameter(s)
IMPORTING Parameters details for BAPI_CTRACPSINVDOC_CREATE
APPL_AREA - Application Area
Data type: BAPI_CTRACPSINVDOC_H-APPL_AREAOptional: No
Call by Reference: No ( called with pass by value option)
X_GETPDF - Generate PDF File for Invoicing Document
Data type: BAPI_CTRACPSINVDOC_PRNT-X_GETPDFOptional: Yes
Call by Reference: No ( called with pass by value option)
X_SIMULATE - Invoicing Document is Simulated
Data type: BAPI_CTRACPSINVDOC_H-X_SIMULATEDOptional: Yes
Call by Reference: No ( called with pass by value option)
INV_PROCESS - Invoicing Process
Data type: BAPI_CTRACPSINVDOC_H-INV_PROCESSOptional: No
Call by Reference: No ( called with pass by value option)
CONT_ACCT - Contract Account Number
Data type: BAPI_CTRACPSINVDOC_H-CONT_ACCTOptional: Yes
Call by Reference: No ( called with pass by value option)
BUSINESS_PARTNER - Business Partner Number
Data type: BAPI_CTRACPSINVDOC_H-BUSINESS_PARTNEROptional: No
Call by Reference: No ( called with pass by value option)
RECONCILIATION_KEY - Reconciliation Key for General Ledger
Data type: BAPI_CTRACPSINVDOC_H-RECONCILIATION_KEYOptional: No
Call by Reference: No ( called with pass by value option)
POST_DATE - Posting Date in the Document
Data type: BAPI_CTRACPSINVDOC_H-POST_DATEOptional: Yes
Call by Reference: No ( called with pass by value option)
DOC_DATE - Document Date in Document
Data type: BAPI_CTRACPSINVDOC_H-DOC_DATEOptional: Yes
Call by Reference: No ( called with pass by value option)
X_PRINT_SIMULATE - Simulate Printing of Invoicing Document
Data type: BAPI_CTRACPSINVDOC_PRNT-X_SIMULATEOptional: Yes
Call by Reference: No ( called with pass by value option)
X_PRINT - Print Invoicing Document
Data type: BAPI_CTRACPSINVDOC_PRNT-X_PRINTOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_CTRACPSINVDOC_CREATE
PDF_SAP_OBJECT - SAP ArchiveLink: Object type of business object
Data type: BAPI_CTRACPSINVDOC_PDF_LINK-PDF_SAP_OBJECTOptional: No
Call by Reference: No ( called with pass by value option)
PDF_OBJECT_ID - SAP ArchiveLink: Object ID (Object Identifier)
Data type: BAPI_CTRACPSINVDOC_PDF_LINK-PDF_OBJECT_IDOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_CTRACPSINVDOC_CREATE
SOURCEDOCUMENT - BAPI: Input Structure for Details on Source Document
Data type: BAPI_CTRACPSINVDOC_SRCDOCOptional: Yes
Call by Reference: Yes
INVDOCHEADER - BAPI: Input Structure for Invoicing Document (Header)
Data type: BAPI_CTRACPSINVDOC_HOptional: Yes
Call by Reference: Yes
CADOCUMENT - BAPI: Input Structure for FI-CA Document
Data type: BAPI_CTRACPSINVDOC_CADOCOptional: Yes
Call by Reference: Yes
INVDOCPDF - BAPI: Invoice in PDF Format (128 Bytes per Line)
Data type: BAPI_CTRACPSINVDOC_PDFOptional: Yes
Call by Reference: Yes
INVDOCPDF2 - BAPI: Invoice in PDF Format (1024 Bytes per Line)
Data type: BAPI_CTRACPSINVDOC_PDF2Optional: Yes
Call by Reference: Yes
RETURN - Return Parameter(s)
Data type: BAPIRET2Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_CTRACPSINVDOC_CREATE 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_appl_area | TYPE BAPI_CTRACPSINVDOC_H-APPL_AREA, " | |||
| lv_pdf_sap_object | TYPE BAPI_CTRACPSINVDOC_PDF_LINK-PDF_SAP_OBJECT, " | |||
| lt_sourcedocument | TYPE STANDARD TABLE OF BAPI_CTRACPSINVDOC_SRCDOC, " | |||
| lv_x_getpdf | TYPE BAPI_CTRACPSINVDOC_PRNT-X_GETPDF, " | |||
| lv_x_simulate | TYPE BAPI_CTRACPSINVDOC_H-X_SIMULATED, " | |||
| lv_inv_process | TYPE BAPI_CTRACPSINVDOC_H-INV_PROCESS, " | |||
| lt_invdocheader | TYPE STANDARD TABLE OF BAPI_CTRACPSINVDOC_H, " | |||
| lv_pdf_object_id | TYPE BAPI_CTRACPSINVDOC_PDF_LINK-PDF_OBJECT_ID, " | |||
| lv_cont_acct | TYPE BAPI_CTRACPSINVDOC_H-CONT_ACCT, " | |||
| lt_cadocument | TYPE STANDARD TABLE OF BAPI_CTRACPSINVDOC_CADOC, " | |||
| lt_invdocpdf | TYPE STANDARD TABLE OF BAPI_CTRACPSINVDOC_PDF, " | |||
| lv_business_partner | TYPE BAPI_CTRACPSINVDOC_H-BUSINESS_PARTNER, " | |||
| lt_invdocpdf2 | TYPE STANDARD TABLE OF BAPI_CTRACPSINVDOC_PDF2, " | |||
| lv_reconciliation_key | TYPE BAPI_CTRACPSINVDOC_H-RECONCILIATION_KEY, " | |||
| lt_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_post_date | TYPE BAPI_CTRACPSINVDOC_H-POST_DATE, " | |||
| lv_doc_date | TYPE BAPI_CTRACPSINVDOC_H-DOC_DATE, " | |||
| lv_x_print_simulate | TYPE BAPI_CTRACPSINVDOC_PRNT-X_SIMULATE, " | |||
| lv_x_print | TYPE BAPI_CTRACPSINVDOC_PRNT-X_PRINT. " |
|   CALL FUNCTION 'BAPI_CTRACPSINVDOC_CREATE' "Create Invoicing Docs |
| EXPORTING | ||
| APPL_AREA | = lv_appl_area | |
| X_GETPDF | = lv_x_getpdf | |
| X_SIMULATE | = lv_x_simulate | |
| INV_PROCESS | = lv_inv_process | |
| CONT_ACCT | = lv_cont_acct | |
| BUSINESS_PARTNER | = lv_business_partner | |
| RECONCILIATION_KEY | = lv_reconciliation_key | |
| POST_DATE | = lv_post_date | |
| DOC_DATE | = lv_doc_date | |
| X_PRINT_SIMULATE | = lv_x_print_simulate | |
| X_PRINT | = lv_x_print | |
| IMPORTING | ||
| PDF_SAP_OBJECT | = lv_pdf_sap_object | |
| PDF_OBJECT_ID | = lv_pdf_object_id | |
| TABLES | ||
| SOURCEDOCUMENT | = lt_sourcedocument | |
| INVDOCHEADER | = lt_invdocheader | |
| CADOCUMENT | = lt_cadocument | |
| INVDOCPDF | = lt_invdocpdf | |
| INVDOCPDF2 | = lt_invdocpdf2 | |
| RETURN | = lt_return | |
| . " BAPI_CTRACPSINVDOC_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_CTRACPSINVDOC_CREATE
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.| "SELECT single APPL_AREA FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_appl_area). | ||||
| "SELECT single PDF_SAP_OBJECT FROM BAPI_CTRACPSINVDOC_PDF_LINK INTO @DATA(ld_pdf_sap_object). | ||||
| "SELECT single X_GETPDF FROM BAPI_CTRACPSINVDOC_PRNT INTO @DATA(ld_x_getpdf). | ||||
| "SELECT single X_SIMULATED FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_x_simulate). | ||||
| "SELECT single INV_PROCESS FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_inv_process). | ||||
| "SELECT single PDF_OBJECT_ID FROM BAPI_CTRACPSINVDOC_PDF_LINK INTO @DATA(ld_pdf_object_id). | ||||
| "SELECT single CONT_ACCT FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_cont_acct). | ||||
| "SELECT single BUSINESS_PARTNER FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_business_partner). | ||||
| "SELECT single RECONCILIATION_KEY FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_reconciliation_key). | ||||
| "SELECT single POST_DATE FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_post_date). | ||||
| "SELECT single DOC_DATE FROM BAPI_CTRACPSINVDOC_H INTO @DATA(ld_doc_date). | ||||
| "SELECT single X_SIMULATE FROM BAPI_CTRACPSINVDOC_PRNT INTO @DATA(ld_x_print_simulate). | ||||
| "SELECT single X_PRINT FROM BAPI_CTRACPSINVDOC_PRNT INTO @DATA(ld_x_print). | ||||
Search for further information about these or an SAP related objects