Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Comparing Hexadecimal value in program

Hi friends,

I have requirement in this I have to pick a file and have to write some logic by comparing file contents.

File contents some hexadecimal character like '#'.

When I am writing simple if condition like

if var = '#'.



It is not going in that if condition even when the var has value from # from file. so i think as it is hexadecimal value there is some other way to compare it.

Please let me know how can I compare hexadecimal value.

Former Member

Indeed # is a character representation of a separator (tab or space) which is seen as # in character mode.

Use below snippet to compare it

DATA: xsep TYPE xstring,
                sep TYPE string.

              xsep = '09'. "if separator is tab mark
              xsep = '20'. "if it is space

              in_xstring = xsep
              out_string = sep.

         "now SEP contains character representation for separator (which is seen as #)
          "you can i.e. split uploaded file data (in iternal table) based on that separator
          SPLIT it_file_data AT sep INTO TABLE it_file_fields IN CHARACTER MODE.

          "for comparing use
          if var = sep.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question