Table Maintenance Programming
Table maintenance Program are used when need to save data from auto generated programs save data like
Age from the field Date of Birth ,
Auto Generate Unique number for IDs ,
Document created User name
Document created date, etc ..
Step 1 : Create Table and Create function group from tcode (se37 function group)
Step 2 : Please specify the function group in function group and in Authorization &NC then click on find screen and Generate object then go to modification ->events .
Step 3 : Specify the Events which you want to use in the table i.e on creation new record (05)
on change (07) and more others events and click editor and give the form name
Step 4 : write the code in the editor , this code for auto generated number . For execute this code you need to specify number range in SNRO (tcode) .
FORM CREATE_NEW .
DATA : P_UID TYPE ZCAND_PROFILE-U_ID.
ZCAND_PROFILE-CREATED_BY = SY-UNAME.
ZCAND_PROFILE-CREATE_DATE = SY-DATUM.
ZCAND_PROFILE-CREATE_TIME = SY-UZEIT.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZUID' 'type of snro object '
* QUANTITY = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BUFFER = ' '
IMPORTING
NUMBER = P_UID
* QUANTITY =
* RETURNCODE =
* 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.
ZCAND_PROFILE-U_ID = P_UID.
ENDFORM .
Table maintenance Program are used when need to save data from auto generated programs save data like
Age from the field Date of Birth ,
Auto Generate Unique number for IDs ,
Document created User name
Document created date, etc ..
Step 1 : Create Table and Create function group from tcode (se37 function group)
Step 2 : Please specify the function group in function group and in Authorization &NC then click on find screen and Generate object then go to modification ->events .
Step 3 : Specify the Events which you want to use in the table i.e on creation new record (05)
on change (07) and more others events and click editor and give the form name
Step 4 : write the code in the editor , this code for auto generated number . For execute this code you need to specify number range in SNRO (tcode) .
FORM CREATE_NEW .
DATA : P_UID TYPE ZCAND_PROFILE-U_ID.
ZCAND_PROFILE-CREATED_BY = SY-UNAME.
ZCAND_PROFILE-CREATE_DATE = SY-DATUM.
ZCAND_PROFILE-CREATE_TIME = SY-UZEIT.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZUID' 'type of snro object '
* QUANTITY = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BUFFER = ' '
IMPORTING
NUMBER = P_UID
* QUANTITY =
* RETURNCODE =
* 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.
ZCAND_PROFILE-U_ID = P_UID.
ENDFORM .
No comments:
Post a Comment