Auto serial Number Generation in Table Maintenance Generator Create Table maintenance As shown Below with 2 step.

Click on the button Fn.Gr.Text.

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 1 of 10

Auto serial Number Generation in Table Maintenance Generator

Click on the Main Program Button displayed below on the Popup window of change function Group. Which leads to the main program

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 2 of 10

Auto serial Number Generation in Table Maintenance Generator

Go to screen 112 as shown below

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 3 of 10

Auto serial Number Generation in Table Maintenance Generator

Include new module : MODULE GENERATE_SERNO.

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 4 of 10

Auto serial Number Generation in Table Maintenance Generator

Add the below code to the new include .
*----------------------------------------------------------------------* ***INCLUDE LZPOMAIL_TMGO01 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module generate_serno OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE generate_serno OUTPUT. DATA: * * * * * * * * number TYPE i.

SELECT SINGLE MAX( zsrno ) INTO lv_zsrno FROM zpo_mail_t. IF lv_zsrno IS INITIAL. lv_zsrno = '000000001'. ELSE. lv_zsrno = lv_zsrno + 1. ENDIF.

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 5 of 10

Auto serial Number Generation in Table Maintenance Generator
CALL FUNCTION 'NUMBER_GET_NEXT' EXPORTING nr_range_nr = '0000000001' object = 'ZSRPO' IMPORTING number = number 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. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. zpo_mail_t-zsrno = number. zpo_mail_t-bsart = ' '. zpo_mail_t-zemail = ' '. ** Making Serial no as unchangeable if value set LOOP AT SCREEN. IF screen-name = 'ZPO_MAIL_T-ZSRNO'. screen-input = '0'. MODIFY SCREEN. ENDIF. ENDLOOP. ENDMODULE. " generate_serno OUTPUT

Now go to transaction SM30 and enter table name ZPO_MAIL_T.

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 6 of 10

Auto serial Number Generation in Table Maintenance Generator

Click on the Maintain button. Then you can see the serial number is generated automatically as shown below

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 7 of 10

Auto serial Number Generation in Table Maintenance Generator

Serial Number Creation
Go to Transaction Code : SNRO Create new object . enter name as ZSNPO a

Enter detail as below

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 8 of 10

Auto serial Number Generation in Table Maintenance Generator

And click on the number ranges button on the appli. Tool bar Click on the intervals

Click on edit intervals

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 9 of 10

Auto serial Number Generation in Table Maintenance Generator

Save and go back. By the above procedure you could create serial number .

Author: Katta Ravi Kiran LPC Group Confidential (Internal Purpose Only) Page 10 of 10

Sign up to vote on this title
UsefulNot useful