cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if an invoice (VF03) exists for the service order (IW33)

Former Member
0 Kudos

Hello,

we need to check in a custom report if for a service order (IW33) there is already an invoice created. We need to read the document flow of the service order or some over way to check if there is already an invoice created.

Any ideas on this requirement? Is there maybe a function module which is helpful?

In table VBFA there are now entries for service orders.

Thanks a lot.

Kind regards

Manfred

Accepted Solutions (1)

Accepted Solutions (1)

former_member184555
Active Contributor
0 Kudos

Please check the transaction S_ALR_87014387.

Thanks,

Ravi

Former Member
0 Kudos

Thank you,

i know this transaction.

But i need to know how the read with ABAP code if there is already an invoice for my service order number.

Are there usefull database tables or function modules for this requirement?

Thank you.

Kind regards

Manfred

Former Member
0 Kudos

solved. The link between CS and SD is VBAK-AUFNR.

Kind regards

Manfred

Answers (1)

Answers (1)

jpfriends079
Active Contributor
0 Kudos

There is no direct connection of service order with sales invoice.

So, use Table AUFK - Order master data for your service order number.

AUFK-AUFNR

-Order No.

In get value for Field

AUFK-KDAUF

-Sales Order

AUFK-KDPOS

-Sales Ord. Item

Then use Table VBFA.

Provide

VBFA-VBELV (Preceding Doc.)

= AUFK-KDAUF

VBFA- POSNV (Preceding item)

= AUFK-KDPOS

VBFA-VBTYP_N (Subs.doc.categ.)

= M (Invoice)

You will get related invoice information as result in

- VBFA-VBELN (Follow-on doc.)

- VBFA-POSNN (Subsequent item)

Regards

JP

Former Member
0 Kudos

Hello JP,

thank you for your answer.

I have an already invoiced service order and checked according to your description.

This does not work like descriped because for the service order the field AUFK-KDAUF is initial. I think this is only filled if the service order was created from a SD document like contract or order. But in my case the service order is created with IW31.

We do a confirmation for the service order and create the invoice request with transaction DP90.

Do you have any other ideas for our requirement?

Thank you.

Kind regards

Manfred