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

Field Symbol assignment

Former Member
0 Likes
644

Hello All,

I want to check whether a fiedsymbol has been assigned or not.

How to do that ?

Here is my code .


LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
    WHILE sy-subrc = 0.
      ASSIGN COMPONENT 'MBLNR' OF STRUCTURE <dyn_wa> TO <fs_mblnr>.
      ASSIGN COMPONENT 'MJAHR' OF STRUCTURE <dyn_wa> TO <fs_mjahr>.
      ASSIGN COMPONENT 'ZEILE' OF STRUCTURE <dyn_wa> TO <fs_zeile>.
      ASSIGN COMPONENT 'WERKS' OF STRUCTURE <dyn_wa> TO <fs_werks>.
      ASSIGN COMPONENT 'LIFNR' OF STRUCTURE <dyn_wa> TO <fs_lifnr>.

      SELECT SINGLE * FROM mseg WHERE mblnr = <fs_mblnr>
                                AND   mjahr = <fs_mjahr>
                                AND   zeile = <fs_zeile>.
      IF sy-subrc ne 0.

        MESSAGE s046 DISPLAY LIKE 'E' WITH text-034 text-035.

      ELSE.

        CLEAR gs_edidc.

      ENDIF.

    ENDWHILE.




  ENDLOOP.

In the above code if the fieldsymbol is not assigned then in the Select Statement the Program goes for a short dump saying "FIELD SYMBOL NOT ASSIGNED ".

SO before making a SELECT Query I want to check whetehr the FS is assigned or not .

How to check it ?

Regards,

Deepu.K

1 ACCEPTED SOLUTION
Read only

christine_evans
Active Contributor
0 Likes
609
IF <fs3> IS ASSIGNED .....

Hello All,

I want to check whether a fiedsymbol has been assigned or not.

How to do that ?

Here is my code .


LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
    WHILE sy-subrc = 0.
      ASSIGN COMPONENT 'MBLNR' OF STRUCTURE <dyn_wa> TO <fs_mblnr>.
      ASSIGN COMPONENT 'MJAHR' OF STRUCTURE <dyn_wa> TO <fs_mjahr>.
      ASSIGN COMPONENT 'ZEILE' OF STRUCTURE <dyn_wa> TO <fs_zeile>.
      ASSIGN COMPONENT 'WERKS' OF STRUCTURE <dyn_wa> TO <fs_werks>.
      ASSIGN COMPONENT 'LIFNR' OF STRUCTURE <dyn_wa> TO <fs_lifnr>.

      SELECT SINGLE * FROM mseg WHERE mblnr = <fs_mblnr>
                                AND   mjahr = <fs_mjahr>
                                AND   zeile = <fs_zeile>.
      IF sy-subrc ne 0.

        MESSAGE s046 DISPLAY LIKE 'E' WITH text-034 text-035.

      ELSE.

        CLEAR gs_edidc.

      ENDIF.

    ENDWHILE.




  ENDLOOP.

In the above code if the fieldsymbol is not assigned then in the Select Statement the Program goes for a short dump saying "FIELD SYMBOL NOT ASSIGNED ".

SO before making a SELECT Query I want to check whetehr the FS is assigned or not .

How to check it ?

Regards,

Deepu.K

4 REPLIES 4
Read only

Former Member
0 Likes
609

Hi Deepu,

Simple thing is to do an EPC.( Extended Program Check). If your field symbol is not used anywhere then it would show up as a field attribute error.

Regards,

Sai

Read only

christine_evans
Active Contributor
0 Likes
610
IF <fs3> IS ASSIGNED .....
Read only

sivasatyaprasad_yerra
Product and Topic Expert
Product and Topic Expert
0 Likes
609

Hi,

Check like this.

If <field_symbol> assigned. "field symbol variable.

endif.

Read only

0 Likes
609

Thanks for ur help guys !

Regards,

Deepu.K