cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement custom number range for Invoices for rent?

villapandoa
Newcomer
0 Kudos
368

We have a requirement where we need to implement a custom number range for the Invoices for rent. The standard number range object RERAINV is set to reset the number range every new fiscal year which does not comply with our statutory requirements. This standard number range object is not released so we can't update this nor we can do anything on the config. 

Do we have any extensibility options for this? I found BAdi BADI_RERA_INVOICE where it might be possible via method GET_NUMBER. Unfortunately, this BAdi is not released as well so it is not available in the Custom Logic app.

System: SAP S/4HANA CLOUD 2402

View Entire Topic
Harish_Mangtani
Product and Topic Expert
Product and Topic Expert
0 Kudos

One other option could be:

You can implement the BADI_SD_INVOICE_EXAMP to define a custom number range for the invoices for rent. Below is an example code to implement the BADI for custom number range:

``` ABAP
DATA: lv_number_range TYPE snro_range_name,
ls_record TYPE snro_record,
lt_number_range TYPE TABLE OF snro_record.

" Define custom number range for invoices for rent
lv_number_range = 'CUSTOM_RANGE_FOR_RENT'.

" Check if the custom number range already exists
SELECT * FROM snro_record INTO TABLE lt_number_range
WHERE snro_name = lv_number_range.

IF sy-subrc NE 0.
" If custom number range does not exist, create new number range record
ls_record-snro_name = lv_number_range.
ls_record-year_exp = '9999'.
ls_record-number_high = '999999'.
ls_record-number_low = '1'.
APPEND ls_record TO lt_number_range.

" Insert new number range record
INSERT TABLE lt_number_range.
ENDIF.
```

You can adjust the code according to your specific requirements and then implement the BADI_SD_INVOICE_EXAMP for custom number range for invoices for rent in SAP S/4HANA Public Cloud.

Best Regards,