4 Replies Latest reply: Apr 16, 2009 7:53 PM by Ashwini Kalyankar RSS

How to check data type of the field symbol at run time

Ashwini Kalyankar
Currently Being Moderated

Hi,

 

My code is as following:

 

      LOOP AT <fs> ASSIGNING <wa_covp_ext>.

        ASSIGN COMPONENT 86 OF STRUCTURE <wa_covp_ext> TO <f_zzname>.

        IF sy-subrc = 0.

          ASSIGN COMPONENT 158 OF STRUCTURE <wa_covp_ext> TO <f_pernr>.

          IF sy-subrc = 0.

              SELECT SINGLE sname INTO <f_zzname> FROM pa0001

                            WHERE pernr = <f_pernr>

                            AND endda GE sy-datum

                            AND begda LE sy-datum.

 

         ENDIF.

      ENDIF.

    ENDLOOP.

 

This query is giving dump when <f_zzname> is type P length 8 and decimals 2, because it tries to put PA0001-sname into it which is type C length 30. So I want to check the type of <f_zzname> before the select statement. If it is character 30, then I will write the select statement else not.

 

How to check data type of the field symbol at run time? If it's not possible, then can somebody suggest a workaround? Thanks.

Actions