2024 Mar 05 5:27 AM - edited 2024 Mar 05 5:29 AM
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
Request clarification before answering.
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Can you try this if this works in your scenario?
Based on the user's requirement, the BAdI 'SD_BIL_FLEX_NUMBERING' can be used to implement a custom number range for the Invoices for rent. This BAdI allows for a flexible allocation of billing documents to number range intervals and prefixes that is controlled by one or more attributes (header fields) of the billing document to be created.
Here is a sample ABAP code snippet that can be used to implement the custom number range:
```ABAP
METHOD if_sd_bil_flex_numbering~det_nr_interval.
DATA: lv_billing_type TYPE vbrk-fkart.
"Get the billing document type
lv_billing_type = bil_doc-billingdocumenttype.
"Check if the billing document type is for Invoices for rent
IF lv_billing_type EQ 'RNT'. "Assuming 'RNT' is the billing document type for Invoices for rent
"Set the custom number range interval and prefix
numberrangeinterval = 'RNT1'. "Assuming 'RNT1' is the custom number range interval for Invoices for rent
numberrangeprefix = 'RNT'. "Assuming 'RNT' is the custom number range prefix for Invoices for rent
ENDIF.
ENDMETHOD.
```
In this code snippet, we first get the billing document type from the import parameter 'bil_doc'. Then we check if the billing document type is for Invoices for rent. If it is, we set the custom number range interval and prefix to 'RNT1' and 'RNT' respectively. These values are assumed for this example and should be replaced with the actual values as per your requirement.
Please note that you need to define the custom number range interval and prefix in the relevant configuration activities before using them in the BAdI implementation. Also, make sure to assign the routine number to the billing document type for which you want to trigger the BAdI implementation.
Best Regards,
Harish Mangtani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.