Application Development 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: 

Tag range details

Former Member
0 Kudos

In one tag range updation report

there are 2 fields..........

Tag from1 and Tag to1.

IT_data is the internal table.

Logic is like given below.

IF IT_DATA-TAGFROM1 <> SPACE AND IT_DATA-TAGTO1 <> SPACE.

IF IT_DATA-TAGFROM1 GT IT_DATA-TAGTO1.

MESSAGE E001 WITH 'Tag From1 should not exceed Tag To1'.

ENDIF.

ENDIF.

i have given values as IT_DATA-TAGFROM1 - 998937

and IT_DATA-TAGTO1 - 1001130

but i am getting error as Tag From1 should not exceed Tag To1.

And both the fields are declared as CHAR in the table with length 10.

what are the changes to be done???..Table should not be modified.............as data will get deleted.

With out touching table,how to do changes in the report and get this error corrected.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Not exactly sure why your code is not working. Anyways you can try something like this,


IF NOT IT_DATA-TAGFROM1 is INITIAL and NOT  IT_DATA-TAGTO1 is INITIAL.
IF IT_DATA-TAGFROM1 > IT_DATA-TAGTO1.
MESSAGE E001 WITH 'Tag From1 should not exceed Tag To1'.
EXIT. 
ENDIF.
ENDIF.

Vikranth

7 REPLIES 7

Former Member
0 Kudos

Not exactly sure why your code is not working. Anyways you can try something like this,


IF NOT IT_DATA-TAGFROM1 is INITIAL and NOT  IT_DATA-TAGTO1 is INITIAL.
IF IT_DATA-TAGFROM1 > IT_DATA-TAGTO1.
MESSAGE E001 WITH 'Tag From1 should not exceed Tag To1'.
EXIT. 
ENDIF.
ENDIF.

Vikranth

0 Kudos

I have tried with ur logic again i am getting same error

The main problem is its considering 9 as gretaer than 1 with out considering how many char exists

IT_DATA-TAGFROM1 - 998937

and IT_DATA-TAGTO1 - 1001130

0 Kudos

Hello Deepthi,

You were right. It was considering 998937 as a greater number than 1001130. You have two options. Eithre you have to change the type of the variable, or use conversion_exit_alpha_input to pad the extra zeros to make the char variable realise the exact value. Check this sample


data: var1(10) type c,
      var2(10) type c.

var1 = '998937'.
var2 = '1001130'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = var1
 IMPORTING
   OUTPUT        = var1
          .


 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = var2
 IMPORTING
   OUTPUT        = var2
          .


IF NOT var1 is INITIAL and NOT var2 is INITIAL.
IF var1 > var2.
MESSAGE E001 WITH 'Tag From1 should not exceed Tag To1'.
EXIT.
ENDIF.
ENDIF.

Vikranth

0 Kudos

Deepthi,

Don't Pass the values in Quotes ('), Just pass like this:

TAGFROM1 = 998937.
TAGTO1 = 1001130.

0 Kudos

Hi Vikranth,

Thanks a lot its working absolutely fine, but in var1 and var2 i have not bardcoded the values becoz value will be changing

so i passed data from internal table.

var1 = IT_DATA-TAGFROM1.

var2 = IT_DATA-TAGTO1.

Now its working fine.

Can i pass values like that or it should be hardcoded only??

0 Kudos

Hello Deepthi,

Infact you should not harcode any values as per the ABAP standards in the coding. Assigning it through a variable is the correct method and what you did is fine enough.

Vikranth

former_member222860
Active Contributor
0 Kudos

Try with this code:

IF NOT ( IT_DATA-TAGFROM1 = SPACE AND IT_DATA-TAGTO1 = SPACE ).
  IF IT_DATA-TAGFROM1 > IT_DATA-TAGTO1.
    MESSAGE E001 WITH 'Tag From1 should not exceed Tag To1'.
    EXIT.
  ENDIF.
ENDIF.