Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using BAPI_BILLINGDOC_CREATEFROMDATA

ajay_mukundan2
Explorer
5,555

Hi I have a requirement that after the Delivery Document is created from VL01N, I need to process billing doc.

For this, I found an exit - DELIVERY_PUBLISH in VL01N which can be useful,

I've put below code under method: PUBLISH_AFTER_SAVE

method if_ex_delivery_publish~publish_after_save.

break devel2.

&----


&

*& DATA DECLARATION

&----


&

data: scr_xmclikp(17) type c value '(SAPLV53C)xmclikp',

header_return type table of bapireturn1,

it_header_data type table of bapivbrk,

wa_header_data type bapivbrk,

it_cc_data type table of bapiccard_vf,

wa_cc_data type bapiccard_vf,

it_bapikomv type table of bapikomv,

wa_bapikomv type bapikomv.

if sy-tcode = 'VL01N' and sy-uname = 'DEVEL2'.

call function 'BAPI_BILLINGDOC_CREATE'

tables

return = header_return

.

Now what happens is that after I select 'Post Goods Issue' from VL01N, Delivery doc is automatically populated in VF01 under 'Document' column.

How can I get the document number to be passed into billing_data_in for BAPI_BILLINGDOC_CREATEFROMDATA?

Also, I don't know what to pass for below tables.

  • condition_data_in =

  • ccard_data_in =

Please help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,904

Hello,

Previously I had the same requirement, and based on some investigation i was able to find out the BADI which gets triggered to get the functionality achieved.

The BADI I have used is MB_DOCUMENT_BADI and the method MB_DOCUMENT_UPDATE, make sure you use the function module CALL FUNCTION 'RV_INVOICE_CREATE_BACKGROUND' IN UPDATE TASK to get the Invoice created.

Requirements are that, for every delivery the Picking needs to be completed, so when the user click on the PGI automatically the Invoice gets created.

Cheers

Edited by: Sudhakar Pedhadodi on Oct 12, 2009 11:25 AM

4 REPLIES 4
Read only

Former Member
0 Likes
2,904

Hi,

lt_request-document_type = 'A'.

lt_request-document_numb = WA_DATA-vbeln.

lt_request-document_item = WA_DATA-posnr.

lt_request-material = wa_data-matnr.

lt_request-plant = WA_DATA-werks.

lt_request-stge_loc = lv_lgort.

lt_request-quantity_base__uom = wa_data-qty.

lt_request-delivery_date = sy-datum.

append lt_request.

call function 'BAPI_DELIVERYPROCESSING_EXEC'

tables

request = lt_request

createditems = lt_createditems

return = lt_return.

Use this BAPI for delivery Processing .

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

VBKOK_WA = L_VBKOK

SYNCHRON = 'X'

  • NO_MESSAGES_UPDATE = ' '

COMMIT = 'X'

DELIVERY = lt_createditems-DOCUMENT_NUMB

UPDATE_PICKING = 'X'

NICHT_SPERREN = 'X'

Use this Function module for Posting Goods Issue.

Note:Use the delivery no from the above bapi then use it in the function below.

With regards,

Manesh.R

Read only

Former Member
0 Likes
2,905

Hello,

Previously I had the same requirement, and based on some investigation i was able to find out the BADI which gets triggered to get the functionality achieved.

The BADI I have used is MB_DOCUMENT_BADI and the method MB_DOCUMENT_UPDATE, make sure you use the function module CALL FUNCTION 'RV_INVOICE_CREATE_BACKGROUND' IN UPDATE TASK to get the Invoice created.

Requirements are that, for every delivery the Picking needs to be completed, so when the user click on the PGI automatically the Invoice gets created.

Cheers

Edited by: Sudhakar Pedhadodi on Oct 12, 2009 11:25 AM

Read only

ajay_mukundan2
Explorer
0 Likes
2,904

Hi Manesh,

I tried your method, but didnt work.

Sudhakar,

I tried using MB_DOCUMENT_BADI. As soon as I tried to activate the implementation, I got a pop up saying that my Implementation Migrated (see long text for instructions).

Upon saving, I get the error message: A customer implementation cannot be migrated into a SAP implementation

what should I do?

Read only

0 Likes
2,904

Hello

Can you please let me know the steps that you are following to create the implementation.

I guess there is some thing wrong that you might be doing unintentionally.

BR

Sudhakar