types: begin of ty_sales,
vbeln type vbak-vbeln,
vbtyp type vbak-vbtyp,
auart type vbak-auart,
vkorg type vbak-vkorg,
vtweg type vbak-vtweg,
spart type vbak-spart,
kunnr type vbak-kunnr,
posnr type vbap-posnr,
matnr type vbap-matnr,
werks type vbap-werks,
end of ty_sales.
data: it_sale type table of ty_sales with header line.
data: wa_sale type ty_sales.
data: t_success type standard table of bapivbrksuccess with header line.
data: t_billing type standard table of bapivbrk with header line.
data: lv_creatordatain type bapicreatordata.
data: lv_testrun type bapivbrktestrun-testrun.
data: lt_conditiondatain type standard table of bapikomv.
data: lv_posting type posting_type_ct.
data: lt_ccarddatain type standard table of bapiccard_vf with header line..
data: lt_textdatain type standard table of bapikomfktx.
data: lt_errors type standard table of bapivbrkerrors.
data: t_datain type standard table of bapicreatordata with header line.
data: t_return type standard table of bapireturn1 with header line.
refresh it_sale.
refresh it_sale. clear wa_sale.
select vbak~vbeln
vbak~vbtyp
vbak~auart
vbak~vkorg
vbak~vtweg
vbak~spart
vbak~kunnr
vbap~vbeln
vbap~posnr
vbap~matnr
vbap~werks
into corresponding fields of table it_sale
from vbak
inner join vbap as vbap on vbap~vbeln eq vbak~vbeln
where vbak~vbeln = g_cont.
clear t_billing.
loop at it_sale into wa_sale.
t_billing-salesorg = wa_sale-vkorg.
t_billing-distr_chan = wa_sale-vtweg.
t_billing-division = wa_sale-spart.
t_billing-doc_type = wa_sale-auart.
t_billing-ref_doc = wa_sale-vbeln.
t_billing-ref_item = wa_sale-posnr.
t_billing-doc_number = wa_sale-vbeln.
t_billing-itm_number = wa_sale-posnr.
* t_billing-ORDBILLTYP = 'ZIW2'.
* t_billing-ordbilltyp = 'ZIW3'.
t_billing-price_date = sy-datum.
t_billing-ref_doc_ca = wa_sale-vbtyp.
t_billing-sold_to = wa_sale-kunnr.
t_billing-material = wa_sale-matnr.
t_billing-plant = wa_sale-werks.
append t_billing.
endloop.
* Append lt_ccarddatain.
*
call function 'BAPI_BILLINGDOC_CREATEMULTIPLE'
* EXPORTING
* Creatordatain = t_datain
tables
billingdatain = t_billing
* Conditiondatain = lt_conditiondatain
* Ccarddatain = lt_ccarddatain
* Textdatain = lt_textdatain
errors = lt_errors
return = lt_return
success = t_success.
if sy-subrc eq 0.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
loop at t_return where type = 'S' and message_v1(1) = '5'.
g_bill = t_return-message_v1.
endloop.
endif.
Thursday, 25 January 2024
VF01 - Create Billing FM BAPI_BILLINGDOC_CREATEMULTIPLE
Subscribe to:
Post Comments (Atom)
Visitor
Code Syntax Try...Endtry
Code : Report Try. Parameters NUMBER type I . data RESULT type P decimals 2 . data OREF type ref to CX_ROOT . data TEXT typ...
-
refresh it_pr . select ebkn ~ banfn ebkn ~ bnfpo ebkn ~ sakto ebkn ~ aufnr * AFVC~LTXA1 * ...
-
data : it_status type table of jstat , wa_status type jstat . *Teco Complete refresh lt_methods . clear ls_methods ...
-
Sample Code Report ZTEST. tables : mseg . type-pools : slis , icon , vimty , abap , truxs . data : begin of it_mseg occurs...
No comments:
Post a Comment