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

Comparing field values before saving in custom table

Former Member
0 Likes
1,110

I have to create an event in the Table Maintenance Generator to compare the "From" and "To" fields of a table.

The "From" value should be lesser than the "To" value. (This part is easy)

But, the values can have '*'(star) also. eg. 2* or 4* or 22*. [which means values starting with 2 or 4 or 22]
How can I compare these values before saving an entry in the custom table?

Also in the Function Module I have an import parameter whose value should lie between this range to populate the exporting parameter.

How can I check that, if the table entries contain '*'(star) values?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
951

I solved it.
You just have to create an event with type "create a new event" and in it you can check if the 'TO' value is LESS THAN 'FROM' value then we can show an ERROR message.
and in the function module we can simply check, if the input paramter value lies between the 'FROM' and 'TO' value.

Anyways! Everyone, Thank you so much.

6 REPLIES 6
Read only

Former Member
0 Likes
951

Hi Prabhat,

try converting the table field values to CHAR type into another variable.

and then we can try using string operands like CS in the CHAR type value.

Can you please clarify the functionality you are expecting, please give us an example so that we can get better understnading on this issue ?

Thanks,

bhaskar

Read only

0 Likes
951

Table has following fields:

* Profit Center From

* Profit Center To

These 2 fields define the range of profit centers
Some possible values for profit centers :  123145, 000001, 2*, 5*.

Now there are 2 tasks.

-- Task 1.

     When I am saving the values in the table, i need to check that the 'Profit Center To'  values is GE to the 'Profit Center From' value.

-- Task2.

     Suppose one row contains values as

               Profit Center From                 Profit Center To         ABC_Field

                        23*                                        2*                              xyz

In the function module I have to check if my importing parameter lies in the 'Profit Center Range'.
If it does, then I have to populate my exporting parameter with 'ABC_Field' Value.

I need to know the code, how can I do this check.

Read only

Former Member
0 Likes
951

Hi,

Please try below technique.

Check if the value contains *, if yes, then shift the value one digcharacter left which will remove *.

Thank You,
Gajendra.

Read only

former_member191569
Active Participant
0 Likes
951

Hello Prabhat,

as I can see, the problem is the criteria to be used to make comparation.

A value 2* is lower or higher than 4*? A value 2* is lower or higher than 22*? These are not values, are ranges of values. Of course, you can establish some rules to allow comparation based in some criteria; for example, taking the highest value possible when an asterisk is found. If the data type is, for example, NUMC(10), you can consider 23* as 2399999999 for comparation.

In fact, I think you have to define a criteria for comparation first and then compare single values.

Read only

0 Likes
951

23* means 2300000...

Read only

Former Member
0 Likes
952

I solved it.
You just have to create an event with type "create a new event" and in it you can check if the 'TO' value is LESS THAN 'FROM' value then we can show an ERROR message.
and in the function module we can simply check, if the input paramter value lies between the 'FROM' and 'TO' value.

Anyways! Everyone, Thank you so much.