2008 Jan 31 11:31 AM
Hi Gurus,
I have all sales document data. From 3 rd party system I have to call SAP thro BAPI to create credit memo(Billing Document) . If any BAPI exists, Pl. Indicate.
Full points are assured for helpful answers.
Thanks,
USR
Hi Gurus,
I have all sales document data. From 3 rd party system I have to call SAP thro BAPI to create credit memo(Billing Document) . If any BAPI exists, Pl. Indicate.
Full points are assured for helpful answers.
Thanks,
USR
2008 Jan 31 11:35 AM
Hi,
Please check these below fm:In reference document you can provide vbeln(Sales Document Number).
1) BAPI_BILLINGDOC_CREATEFROMDATA
2) BAPI_BILLINGDOC_CREATEMULTIPLE
TRy this code
-
Form billing_create *
-
To create billing document *
-
--> p1 text *
<-- p2 text *
-
FORM billing_create using p_delnum type VBELN .
-
Constants Declaration *
-
CONSTANTS:
C_F TYPE C VALUE 'F', " Group type
C_J TYPE C VALUE 'J', " Sales type
C_D TYPE C VALUE 'D'. " Billing type
-
Field-string declaration *
-
DATA:
Field-string for SD collective processing header import
LFS_VBSK TYPE VBSK,
Field-string for internal table lt_xfomfk
LFS_XFOMFK TYPE KOMFK,
Field-string for internal table lt_xvbss
LFS_XVBSS TYPE VBSS,
Field-string for internal table lt_xvbfs
LFS_XVBFS TYPE VBFS.
-
Internal table declaration *
-
DATA:
Internal table for Billing Communications Table
LT_XKOMFK TYPE TABLE OF KOMFK,
Internal table for Collective Processing: Sales Documents
LT_XVBSS TYPE TABLE OF VBSS,
Internal table for Error Log for Collective Processing
LT_XVBFS TYPE TABLE OF VBFS,
Internal table for Price Determination Communications-Condition Record
LT_XKOMV TYPE TABLE OF KOMV,
Internal table for SAPscript: text header
LT_XTHEAD TYPE TABLE OF THEADVB,
Internal table for Sales Document: Partner
LT_XVBPA TYPE TABLE OF VBPAVB,
Internal table for Billing: Header Data
LT_XVBRP TYPE TABLE OF VBRPVB,
Internal table for Billing: Item Data
LT_XVBRK TYPE TABLE OF VBRKVB.
Filling the local variables
LFS_VBSK-SMART = C_F.
LFS_XFOMFK-VBELN = P_DELNUM.
LFS_XFOMFK-VBTYP = C_J.
APPEND LFS_XFOMFK TO lt_xkomfk.
Function module to create invoice.
CALL FUNCTION 'RV_INVOICE_CREATE'
EXPORTING
VBSK_I = LFS_VBSK
WITH_POSTING = C_D
TABLES
XKOMFK = LT_XKOMFK
XKOMV = LT_XKOMV
XTHEAD = LT_XTHEAD
XVBFS = LT_XVBFS
XVBPA = LT_XVBPA
XVBRK = LT_XVBRK
XVBRP = LT_XVBRP
XVBSS = LT_XVBSS.
IF lt_xvbfs[] is initial.
LOOP AT lt_xvbfs INTO lfs_xvbfs.
clear fs_disp.
WRITE:/ TEXT-006,
LFS_XVBFS-MSGV1,
LFS_XVBFS-MSGV2,
LFS_XVBFS-MSGV3,
LFS_XVBFS-MSGV4.
ENDLOOP. " Loop at lt_xvbss
ELSE.
loop at lt_xvbss into lfs_xvbss.
FS_DISP-TEXT = TEXT-006.
FS_DISP-NUMBER = lfs_xvbss-vbeln.
APPEND FS_DISP TO IT_DISP.
ENDLOOP. " Loop at lt_xvbss
ENDIF. " If sy-subrc eq 0.
ENDFORM. " Billing_create
Regards,
Satish
2008 Jan 31 11:42 AM
Hi,
For creating Credit Memos you can use BAPI 'BAPI_ACC_DOCUMENT_POST'
or
you can also use BAPI 'BAPI_ACC_INVOICE_RECEIPT_POST for vendor postings'
Regards,
Gaurav
*Reward points
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |