‎2010 May 05 7:17 AM
Dear Experts,
I have created one number range, initially it should appear in the screen but if the user clicks no in popup then the number range it should get reduced since it is not used, kindly find the below codes,
DATA: RC LIKE INRI-RETURNCODE,
NUMBER(10) TYPE C,
YEAR LIKE INRI-TOYEAR,
QUAN LIKE INRI-QUANTITY.
data : Category type CRMC_ACT_CATEGOR-CATEGORY.
QUAN = 1.
Category = 'Z22'.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
OBJECT = 'ZTEST'
NR_RANGE_NR = '01'
SUBOBJECT = Category
IMPORTING
RETURNCODE = RC
QUANTITY = QUAN
NUMBER = NUMBER.
data : lv_ans type c.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Are you sure'
text_question = 'Are you sure'
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = ' '
IMPORTING
ANSWER = lv_ans.
if lv_ans = '1'.
Write 😕 'Next available number is: ', Number, RC.
else.
*here we have to reduce the number range - 1.
*here can we use f.s's like,
NUMBER_RANGE_ENQUEUE
NUMBER_RANGE_INTERVAL_UPDATE
NUMBER_RANGE_DEQUEUE
NUMBER_RANGE_UPDATE_CLOSE
Kindly guide me how to proceed here
write : /'not allowed'.
endif.
‎2010 May 05 7:41 AM
Hi,
Write the FM 'POPUP_TO_CONFIRM' first and then call FM 'NUMBER_GET_NEXT'
Regards,
Srini.
‎2010 May 05 7:39 AM
if 'cancelled'
data : lv_nrlevel type nriv-nrlevel.
clear : lv_nrlevel.
select single nrlevel from NRIV into lv_nrlevel where OBJECT = 'ZTEST' and SUBOBJECT = 'Z22'.
lv_nrlevel = lv_nrlevel - 1.
update nriv set nrlevel = lv_nrlevel where OBJECT = 'ZTEST' and SUBOBJECT = 'Z22'.
write : /'not allowed' , lv_nrlevel.
endif.
its working fine can i proceed with this needs inputs,
regards,
thirukumaran. R
‎2010 May 05 7:46 AM
Hi,
The standard functionality for function module "'NUMBER_GET_NEXT'" is if you call this FM, the next value field in NRIV will be incremented by one. The method of direct update in NRIV is not correct and may lead to inconsistant data.
Regards
Vinod
‎2010 May 05 7:41 AM
Hi,
Write the FM 'POPUP_TO_CONFIRM' first and then call FM 'NUMBER_GET_NEXT'
Regards,
Srini.
‎2010 May 05 7:48 AM
Hi srinivas,
I have created one screen, where this number range should appear initially, then based on action performed if he saves then that number range should be considered and it has to be stored in ztable, if cancelled we should not consider that number range, so what i did is if cancelled i am using this logic to reset the number range,
clear : lv_nrlevel.
select single nrlevel from NRIV into lv_nrlevel where OBJECT = 'ZTEST' and SUBOBJECT = 'Z22'.
lv_nrlevel = lv_nrlevel - 1.
update nriv set nrlevel = lv_nrlevel where OBJECT = 'ZTEST' and SUBOBJECT = 'Z22'.
Waiting for your responses,
Thanks and Regards,
thirukumaran. R
‎2010 May 05 7:58 AM
Hi,
One alternate solution is to follow below steps,
1) Enqueue NRIV Table,
2) Fetch the Required Number range using select statement.
3) Display the Number range selected the in Popup.
4) If the user selects Yes, the call the function module NUMBER_RANGE_NEXT & Dequeue the table
5) If the user seelct No, then dequeue the table.
Regards
Vinod