Application Development 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: 

Get Next FI document (BKPF-BELNR )in MIR4

Former Member
0 Kudos
841

Hi everyone,

We have a requirement where we need to get the next FI document (BKPF-BELNR) that will be generated when we post a document in MIR4.

Someone can help me we this?

Thanks in advance.

Regards,

Leo.

7 REPLIES 7

ferry_lianto
Active Contributor
0 Kudos
180

Hi,

Please check FM MRM_INVOICE_NUMBER_GENERATE.

This FM is used FM NUMBER_GET_NEXT to get next document number.

Regards,

Ferry Lianto

0 Kudos
180

Hi Ferry,

Thanks for your answer. I tried this FM but it didn't work. Also, this FM doesn't use BKPF table.

Do you know another FM that works with BKPF table?

Thanks again for your help.

Leo.

naimesh_patel
Active Contributor
0 Kudos
180

Try with this:

DATA: L_BELNR LIKE BKPF-BELNR.

SELECT MAX( BELNR )

INTO L_BELNR

FROM BKPF

WHERE GJAHR = SY-DATUM+0(4)

AND AWTYP = 'RMRP'. "<< reference type for Invoices

WRITE: L_BELNR.

L_BELNR = L_BELNR + 1.

WRITE: / 'new', L_BELNR.

Regards,

Naimesh Patel

ferry_lianto
Active Contributor
0 Kudos
180

Hi,

Please try FM NUMBER_GET_NEXT with object RF_BELEG.

Regards,

Ferry Lianto

0 Kudos
180

Hi Ferry,

I tried to run this FM, but I don't know how I have to complete the others parameters:

NR_RANGE_NR =

OBJECT = RF_BELEG

QUANTITY =

SUBOBJECT =

TOYEAR = 2007

IGNORE_BUFFER =

Can you tell me this?

Thanks.

Leo.

Former Member
0 Kudos
180

Sorry, but i have a similar problem, how i get the FI DOC. number after SAVE with trans. MIRO ?

I'm working with MM (trans MIRO) when i SAVE i need to execute a Program, but the parameters contains the FI DOC. how i take it??? because isnt created yet.

thanks in advence. SK

ferry_lianto
Active Contributor
0 Kudos
180

Hi,

It depends on how the FI document number range setup in your system (transaction SNRO). You can try something like this ...

NR_RANGE_NR = '01'

OBJECT = RF_BELEG

QUANTITY = '1'

SUBOBJECT = '0001'

Regards,

Ferry Lianto