Posted: Sat Nov 10, 2007 6:51 pm Post subject: Create Invoice with reference to salesorder
Code:
DATA: s_vbap TYPE vbap.
*
TABLES: vbak,vbap,likp, lips.
DATA: t_billing TYPE STANDARD TABLE OF bapivbrk WITH HEADER LINE.
DATA: t_conditions TYPE STANDARD TABLE OF bapikomv WITH HEADER LINE.
DATA: t_return TYPE STANDARD TABLE OF bapireturn1 WITH HEADER LINE.
DATA: t_ccard TYPE STANDARD TABLE OF bapiccard_vf WITH HEADER LINE.
DATA: t_errors TYPE STANDARD TABLE OF bapivbrkerrors WITH HEADER LINE.
DATA: t_success TYPE STANDARD TABLE OF bapivbrksuccess WITH HEADER LINE
.
PARAMETERS: p_vbeln TYPE vbeln.
select single * from likp
where vbeln = p_vbeln.
SELECT SINGLE * from lips where
vbeln = likp-vbeln.
*// Заполняем структуру фактуры.
* Структура гибридная, можно использовать как для передачи
* только заголовочных данных и ссылки на сбытовой документ,
* так и для передачи позиций фактуры (в случае создания
* фактуры без документа образца)
* Если поле ref_doc_ca незаполнено - считается что фактура
* создается по-позиционно. В противном случае в это поле
* указывается тип документа-образца.
* Если номер позиции ref_item (в случае заказа) не указан,
* то фактурируется все позиции документа. Иначе - только
* указанная позиция.
*//
REFRESH: t_billingdatain.
CLEAR: t_billingdatain.
t_billingdatain-doc_type = 'YYY'.
t_billingdatain-ordbilltyp = 'Z2'.
t_billingdatain-ref_doc = v_salesdocument.
t_billingdatain-ref_doc_ca = 'C'.
APPEND t_billingdatain.
*//
*// Создание фактуры
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
TABLES
billingdatain = t_billingdatain
return = t_return
success = t_success.
COMMIT WORK AND WAIT.
Code:
REPORT ZTEST_INVOICE .
data : i_BAPIVBRK like BAPIVBRK occurs 0 with header line.
data i_BAPIRET1 like BAPIRET1 occurs 0 with header line.
data : i_BAPIVBRKSUCCESS like BAPIVBRKSUCCESS occurs 0 with header line.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.