‎2009 Jan 06 7:23 AM
hi all,
when i save the entry one number is generated through number range object, but if i press again save, next number is generated, this happens every time i save the entry. how to avoid this?
Thanks
‎2009 Jan 06 7:25 AM
you might have used that function module during save ,change accordingly in
your program.
‎2009 Jan 06 7:25 AM
you might have used that function module during save ,change accordingly in
your program.
‎2009 Jan 06 7:25 AM
Hi,
After the record is saved then either exit the program or go to the initial screen.
regards,
Santosh Thorat
‎2009 Jan 06 7:27 AM
Hi Khushi,
we have one option in the module pool
PROCESS AFTER INPUT.
MODULE check_change ON CHAIN-REQUEST.
MODULE check_change INPUT.
gv_flag = c_y. "'Y'.
ENDMODULE. " check_change INPUT
IF the gv_flag = 'Y'.
generate your number logic.
ELSE.
not to generate number logic.
ENDIF.
so when ever you chaged in the screen it will generates the number
hope it will solves your problem.
Thanks
‎2009 Jan 06 8:17 AM
hi,
i have written the foll. code, i have to add more than 1 entry in itab , after adding all the entry i save it , but when i add 1st entry and press enter it goes to screen 1001 ie initial screen,
when 'SAVE'.
move itab-reldt+4(2) to sub.
MOVE ITAB-RELDT+0(4) TO YEAR.
SELECT SINGLE * FROM NRIV INTO ZNRIV WHERE OBJECT = 'ZABC'
AND SUBOBJECT = SUB AND TOYEAR = YEAR.
call function 'NUMBER_RANGE_ENQUEUE'
exporting
object = 'ZABC' "Create with SNUM
exceptions
foreign_lock = 1
object_not_found = 2
system_failure = 3
others = 4.
if sy-subrc ne 0.
message e086 with 'Lock error' sy-subrc.
endif.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = ZNRIV-NRRANGENR
object = 'ZABC'
IGNORE_BUFFER = 'X'
SUBOBJECT = SUB
TOYEAR = YEAR
IMPORTING
NUMBER = NUM.
.
LOOP AT ITAB.
MOVE NUM TO ITAB-CODE.
MODIFY ITAB.
message W012(zdes) with ITAB-CODE.
insert ZDESIGN FROM TABLE ITAB.
CLEAR OK_CODE.
clear itab.
*clear zdesign.
ENDLOOP.
call function 'NUMBER_RANGE_DEQUEUE'
exporting
object = 'ZABC'.
*WHEN 'MODI'.
SET SCREEN 1001.
‎2009 Jan 06 9:35 AM
Hi,
initial screen is displayed but after pressing enter and if we press again save it generated next number
‎2009 Jan 06 10:18 AM
‎2009 Jan 06 10:29 AM
Only call the code to generate a new number and update the number range if the reference number field on your record is empty.......or use a flag as suggested by one of the posts above.
‎2009 Jan 06 10:19 AM
Please explain the scenari exactly. What are you running- is it a report?
Check if the field you mention is auto incrementing through the program's lines of codes.
For infotypes, we have a field called SEQNR which populates sequentially when required.
‎2009 Jan 06 10:20 AM
Please explain the scenari exactly. What are you running- is it a report?
Check if the field you mention is auto incrementing through the program's lines of codes.
For infotypes, we have a field called SEQNR which populates sequentially when required.
‎2009 Jan 06 10:20 AM
Hi,
Avoid the function module call in your change/update data code and leave it to be used only for create option.
Regards,
Ameet
‎2009 Jan 06 10:21 AM
Hi,
you can create one flag say
data: g_saved(1) type c.
and in PAI ,in the user command at 'SAVE' ,just check this.
when sy-ucomm = 'SAVE'.
if g_saved is initial.
<your process of generating number>
set the flag ....
g_saved = 'X'. " so now if again it is prssed it will not generate it again
endif.Regards,
Neha
‎2009 Jan 06 11:17 AM