‎2019 Jul 11 7:57 AM
I have designed a screen in MPP with push button, when i click the push button the candidate form is opening which consists of candidate details like candidate_id,candidate_name and so on. Here my requirement is when i open the
candidate form the candidate_id should generate automatically.Can anyone please help me out to achieve this.
‎2019 Jul 11 10:05 AM
Hi,
Follow below steps.
Regards,
Chitme
‎2019 Jul 11 10:05 AM
Hi,
Follow below steps.
Regards,
Chitme
‎2019 Jul 11 12:06 PM
1.I have created number range in SNRO T-code as below

2.I have used NUMBER_GET_NEXT FM in PBO of the candidate_id screen
MODULE STATUS_4000 OUTPUT.
* SET PF-STATUS 'STATUS'.
* SET TITLEBAR 'TITLE'.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'ZCANID'
IMPORTING
NUMBER = LV_NUMBER_RANGE
RETURNCODE = LV_RC
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
3.Still cant able to generate the id automatically.

‎2019 Jul 11 12:15 PM
Your getting next interval value in LV_NUMBER_RANGE this field which will be passed to the candidate id field.
Example:In screen level your candidate id field is wa-stu_id then what ever value u will get in LV_NUMBER_RANGE pass to wa_sti_id
wa-stu_id = LV_NUMBER_RANGE.
Regards,
Chitme
‎2019 Jul 12 8:03 AM
‎2019 Jul 15 11:13 AM
Hi,
I have tried it,but iam getting only one number like "1" the value is not changing that means its not getting loop.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'ZCANID'
IMPORTING
NUMBER = LV_NUMBER_RANGE
RETURNCODE = LV_RC
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
WA_ZCAN_DET-CANDIDATE_ID = LV_NUMBER_RANGE.
ENDIF.
LOOP AT IT_ZCAN_DET INTO WA_ZCAN_DET.
WA_ZCAN_DET-CANDIDATE_ID = LV_NUMBER_RANGE.
ENDLOOP.
Output:

‎2019 Jul 15 12:07 PM
‎2019 Jul 16 10:25 AM
Hi ,
Thank you for your help,I have solved my issue with the help of the below code
LV_NUMBER_RANGE = 1.
LOOP AT IT_ZCAN_DET INTO WA_ZCAN_DET.
WA_ZCAN_DET-CANDIDATE_ID = LV_NUMBER_RANGE.
LV_NUMBER_RANGE = LV_NUMBER_RANGE + 1.
By using this now i can able to generate id automatically on the screen one after the other.
‎2021 Aug 11 1:31 PM
Hi,
for generating the customer_id automatically we have to use SNRO and give the ranges
once it is done use NUMBER_GET_NEXT Function module in your MPP .
go through this below link ,you will get idea to work .