Application Development and Automation 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: 
Read only

Automatic id generation in MPP screen

2,873

1.png2.pngHi everyone,

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.

1 ACCEPTED SOLUTION
Read only

Former Member
2,713

Hi,

Follow below steps.

  1. Create number range in SNRO T-code.
  2. Once you done with that use NUMBER_GET_NEXT FM in PBO event of that candidate ID screen.

Regards,

Chitme

8 REPLIES 8
Read only

Former Member
2,714

Hi,

Follow below steps.

  1. Create number range in SNRO T-code.
  2. Once you done with that use NUMBER_GET_NEXT FM in PBO event of that candidate ID screen.

Regards,

Chitme

Read only

0 Likes
2,713

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.

Read only

0 Likes
2,713

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

Read only

0 Likes
2,713

Issue resolved?

Regards,

Chitme

Read only

0 Likes
2,713

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:

Read only

0 Likes
2,713

Hi Please explain your requirement clearly...

Regards,

Chitme

Read only

0 Likes
2,713

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.

Read only

0 Likes
2,713

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 .

http://saptechnical.com/Tutorials/ABAP/SNRO/SNRO.htm