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

problem in dialog programming

Former Member
0 Likes
1,352

hello experts,

i have a requirement that in modulepool program,

i have a field (say serialno) which is automatically generated one based on previous no,

now my problem is if user enters the no randomly and if he pressed save that no is storing in the itab.

here my req is i have to restrict the functionality to only automatic generation and if user enters any random value

my field has to reject that value and has to show the message(say "the entered value is not matching with the series, do u want to continue?).

how can i resolve this issue.

can anybody please suggest me with some sample code.

regards

maheshlap.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,325

Hi Mahesh,

If you want to restrict to only automatic generation, make the field as input-disabled in your screen.

Or, in the PAI of the screen, write code when user clicks SAVE. Check if the entered value matches your next series no. If it does not match, then show a popup with "Do you want to continue?".

Hope this solves your problem.

Regards,

Sindhu.

14 REPLIES 14
Read only

Former Member
0 Likes
1,325

Hi,

In the PAI you can check the no. in ITAB with the previous no. and after comaprison and remove it and then flash a message on the same screen.

Hope this helps.

Read only

0 Likes
1,325

hi,

how can i check the no with previously generated no say <,>,= or decimal places wise,

could u pls give me a clear idea.

Read only

Former Member
0 Likes
1,326

Hi Mahesh,

If you want to restrict to only automatic generation, make the field as input-disabled in your screen.

Or, in the PAI of the screen, write code when user clicks SAVE. Check if the entered value matches your next series no. If it does not match, then show a popup with "Do you want to continue?".

Hope this solves your problem.

Regards,

Sindhu.

Read only

0 Likes
1,325

hi ,

could u pls send me the sample code to check wether the no exists in the no series or not.

Read only

0 Likes
1,325

Hi Mahesh,

Do you want to compare the user entered value with previous series no. or the next series no.? Can you tell me how you are generating this series no.s?

Regards,

Sindhu.

Read only

0 Likes
1,325

hi,

i am just selecting the max value in the itab when user pressed (NEW) and incrementing that no by one,

this way i am following,

Is there any another efficient way pls suggest me.

Read only

0 Likes
1,325

Hi Mahesh,

Say your increamented number is stored in a variable NUM. When user enters a value and clicks SAVE, compare the input with this variable NUM. If they do not match, just show a popup with your message.

I think this is what you wanted.

Regards,

Sindhu.

Read only

0 Likes
1,325

hi,

i have understood the problem but my problem is i dont know how to compare,

the user's input maybe less than max no in itab or may be grater or may be matches or he can enter randomly any value,

here if the enterd no is less than max value or equal to max value ,

the no is not stored in itab bcz they r alrdy exists in itab

but when the user entered anyval > maxval the value is storing in itab and the auto generation starts from that no.

here i want that wen usr entered value is immediate next to my max val then only that val has to be saved in itab

otherwise it has to generate message

hope my problem is clear for u now.

could u pls send me some sample code.

Read only

0 Likes
1,325

Okay. I got it now. The code should be as:

if user entered value> maxval + 1.

show error message.

endif.

You have this maxval in your code. So, you can use it.

Is this fine now?

Regards,

Sindhu.

Read only

0 Likes
1,325

hi,

ok i got that now,

for suppose i want to completely restricts the user input to that field wat shld i do.

dont say disable that field,bcz that fld is reqired to me to check for any entered serailno there r any records exists in the item

table r not. i want to disable only user enterd values.

shld it be possible?

can u plz let me know.

Read only

0 Likes
1,325

Hi Mahesh,

I don't think you can restrict in such a way. We cannot check only user entered values.

Regards,

Sindhu.

Read only

0 Likes
1,325

Hi Mahesh,

Could you please explain this in detail.. "i want to disable only user enterd values.".

See, if you want to have the serial number field enabled and want user to enter the number. After the user enters you can cross check it with database table if the number already exists.

If it doesn't exist then you can assign that number, but if that number already exists you want to assign a new serial number.

If this is your requirement then,

there could be a problem.

If your database table has 1-10 serial number and some user entered his own serial number as 15 and you saved it.

this will be fine.

But the next time if the user again enters a serial of 15 then you will find 15 already in your database and hence you will find the max value from table i.e 15 and increase it by 1 and then assign 16 to it.

by doing this there wont be proper serial maintained in your records.

Just in above example you can observe 11-14 number vanish until and unless your gives them on his own..

Regards,

-Sandeep

Read only

0 Likes
1,325

hi Sandeep,

here user was not allowed to enter any value,

the val has to increment automatically by comparing with max val exist in db table when user presses NEW pushbutton.

in any case or by mistake if user enters any value and presses SAVE pushbutton, then the entered val gettin saved in

dbtab and when he presses NEW the series satrtin from that no,

i want to restrict that case .

if u have any better one pls suggest me.

regards

Maheshlap

Read only

0 Likes
1,325

Hi Mahesh,

You could possibly do this.....

1. as suggested by sindhu above disable input to that field but display the serial when new button is pressed.

OR

2. do not disable the field but display the serial and store it in a separate variable. Now if the user changes the serial by any chance on the screen then do not consider the changed value and just update database with the serial in your variable all the time. and display the serial saved in DB on the screen so that user is aware of that.

But my suggestion is .... if you dont want user to disturb the serial counting then just INPUT DISABLE the serial field on the screen. This will help user to see the serial but do not modify it..

Hope this helps.

Regards,

-Sandeep