09-28-2006 4:23 AM
I want to create a billing document using the bapi: BAPI_BILLINGDOC_CREATEMULTIPLE from a delivery number and NOT A SALES ORDER.
Please tell me what details to be passed to table BILLINGDATAIN . Please don't provide me function module documentation because it does n't help me create billing document from delivery. A sample source code or suggestion to what to pass would be really great!
Thanks,
Krishen
P.S. Points assured for helpful answers and thanks for your time.
09-28-2006 5:42 AM
Hi,
Try this..
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.
t_billing-salesorg = likp-vkorg.
t_billing-ref_doc = likp-vbeln.
t_billing-ref_item = lips-posnr.
t_billing-doc_number = p_vbeln.
t_billing-itm_number = lips-posnr.
t_billing-ordbilltyp = 'ZINV'.
t_billing-price_date = sy-datum.
t_billing-ref_doc_ca = likp-vbtyp.
t_billing-material = lips-matnr.
t_billing-plant = lips-werks.
APPEND t_billing.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
TABLES
billingdatain = t_billing
return = t_return
success = t_success
.
commit work.
Thanks,
Naren
09-28-2006 5:42 AM
Hi,
Try this..
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.
t_billing-salesorg = likp-vkorg.
t_billing-ref_doc = likp-vbeln.
t_billing-ref_item = lips-posnr.
t_billing-doc_number = p_vbeln.
t_billing-itm_number = lips-posnr.
t_billing-ordbilltyp = 'ZINV'.
t_billing-price_date = sy-datum.
t_billing-ref_doc_ca = likp-vbtyp.
t_billing-material = lips-matnr.
t_billing-plant = lips-werks.
APPEND t_billing.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
TABLES
billingdatain = t_billing
return = t_return
success = t_success
.
commit work.
Thanks,
Naren
09-28-2006 5:41 PM
Don't I have to call anoter bapi 'BAPI_TRANSACTION_COMMIT' to commit work? I see there is just 'commit work' statement in your code? This is working for this bapi, but will that 'commit work' statement work for other bapis also or do I have to go for calling 'BAPI_TRANSACTION_COMMIT' ?
Please clarify,
Thanks,
Krishen
09-28-2006 8:09 AM
Dear Krishen
The simplest way will be to pass the delivery number to REF_DOC and 'J' to REF_DOC_CA for table: BILLINGDATAIN.
Here 'J' denotes that the reference document number is delivery and rest will be handled through the copy control set-up.
Hope the above info helps you.
Kind Regards
Eswar