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: 

Understanding macro logic standard

ronaldo_aparecido
Contributor
0 Kudos

Hi guys i nedd ehancing a standard logic to put specific field like read only.

I want to know how works this specific logic with macro to put a field like read only .

"assign property values from exit class to strucutre which holds field properties

   DEFINE assign_prop_value.

     "if a specific field property has a reference field

     if ls_field_description-&1 is not initial.

       &2 = ls_field_description-&1.

       read table it_field_usage with key name = ls_field_description-name into ls_field_usage.

       "if there is a usage record for the corresponding field

       if sy-subrc = 0.

         read table mt_field_props with key name = ls_field_description-name into ls_field_props.

         "if the property for the corresponding field has a value (changed)

         if sy-subrc = 0 and ls_field_props-&3 is not initial.

           &4 = ls_field_usage-&5.

           assign component &2 of structure cs_data to &6.

           "case field property

           case &7.

               "when mandatory

             when /bofu/if_fbi_runtime_c=>sc_field_prop-mandatory.

               if ( &4 = abap_true ).

                 &6 = /bofu/if_fbi_runtime_c=>sc_ui_state-required.

               else.

                 &6 = /bofu/if_fbi_runtime_c=>sc_ui_state-normal.

               endif.

               "when visibility

             when /bofu/if_fbi_runtime_c=>sc_field_prop-visibility.

               if ( &4 = /bofu/if_fbi_runtime_c=>sc_ui_state-invisible ).

                 &6 = abap_false.

               else.

                 &6 = abap_true.

               endif.

               "when others

             when others.

               &6 = &4.

           endcase.

         endif.

       endif.

     endif.

   END-OF-DEFINITION.

   DATA: lv_read_only_ref TYPE name_komp,

         lv_mandatory_ref TYPE name_komp,

         lv_enabled_ref TYPE name_komp,

         lv_visibility_ref TYPE name_komp,

         lv_read_only_value TYPE boole_d,

         lv_mandatory_value TYPE boole_d,

         lv_enabled_value TYPE boole_d,

         lv_visibility_value TYPE wdui_visibility,

         ls_field_description TYPE fpmgb_s_formfield_descr,

         ls_field_usage TYPE fpmgb_s_fieldusage,

         ls_field_props TYPE /bofu/if_fbi_view_exitintf_run=>ts_field_property.

   FIELD-SYMBOLS: <read_only_value> TYPE any,

                  <mandatory_value> TYPE any,

                  <enabled_value> TYPE any,

                  <visibility_value> TYPE any.

   LOOP AT it_field_description INTO ls_field_description.

     "assign property value read only from exit class

     assign_prop_value read_only_ref  lv_read_only_ref  read_only lv_read_only_value  read_only  <read_only_value>  'READ_ONLY'.

     "assign property value mandatory from exit class

     assign_prop_value mandatory_ref  lv_mandatory_ref  mandatory lv_mandatory_value  mandatory  <mandatory_value>  'MANDATORY'.

     "assign property value enabled from exit class

     assign_prop_value enabled_ref    lv_enabled_ref    enabled   lv_enabled_value    enabled    <enabled_value>    'ENABLED'.

     "assign property value visibility from exit class

     assign_prop_value visibility_ref lv_visibility_ref visible   lv_visibility_value visibility <visibility_value> 'VISIBILITY'.

   ENDLOOP.




Is not possible debug macro , i don´t understand this code .

Could you help me please?


Thanks

1 REPLY 1

Former Member
0 Kudos

Hi, can you let me know where you found this Macro so that I can have a look in standard and help you.