cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms - delete old variables - looking for a real expert

Former Member
0 Kudos

Hi folks,

Is there any possibility in Smartforms, that I don't know, with which I can analyse my fom. I want to check which variables aren't needed any more. So that I can delete them and I have a nice and clean form.

How I loved my analyse tool in sapscript... I would write an new one, but I didn't found out how the texts are saved in the system.

Is there anybody out there, who can help me?

Regards

Silvio

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

To analyse a smartform the class  cl_ssf_fb_smart_form could be used.

Example coding:

*----------------------------------------------------------------------*

*       FORM GET_ALL_NODES

*----------------------------------------------------------------------*

FORM l_get_all_nodes TABLES p_pages      STRUCTURE g_pages

                          p_windows    STRUCTURE g_windows

                          p_codes      STRUCTURE g_codes

                   USING  p_form       TYPE      REF TO cl_ssf_fb_smart_form.

  DATA: l_varheader LIKE LINE OF p_form->varheader,

        l_node      TYPE REF TO cl_ssf_fb_node.

  CLEAR: p_pages[],

         p_windows[],

         p_codes[].

  LOOP AT p_form->varheader INTO l_varheader.

    LOOP AT l_varheader-pagetree->succ INTO l_node.

      PERFORM l_get_node TABLES p_pages

                                p_windows

                                p_codes

                         USING  l_node.

    ENDLOOP.

  ENDLOOP.

ENDFORM.                               "GET_ALL_NODES

*----------------------------------------------------------------------*

*       FORM GET_NODE

*----------------------------------------------------------------------*

*----------------------------------------------------------------------*

FORM l_get_node TABLES p_pages      STRUCTURE g_pages

                     p_windows    STRUCTURE g_windows

                     p_codes      STRUCTURE g_codes

              USING  p_node       TYPE      REF TO cl_ssf_fb_node.

  DATA: l_window  TYPE REF TO cl_ssf_fb_window,

        l_succ    TYPE REF TO cl_ssf_fb_node.

  PERFORM l_incr_g_tables TABLES p_pages

                               p_windows

                               p_codes

                        USING  p_node.

  IF p_node->nodetype = c_node_window.

    l_window ?= p_node->obj.

    PERFORM l_get_node TABLES p_pages

                            p_windows

                            p_codes

                     USING  l_window->proc_ctrl.

  ENDIF.

  LOOP AT p_node->succ INTO l_succ.

    PERFORM l_get_node TABLES p_pages

                            p_windows

                            p_codes

                     USING  l_succ.

  ENDLOOP.

ENDFORM.                               "GET_NODE

*----------------------------------------------------------------------*

*       FORM INCR_G_TABLES

*----------------------------------------------------------------------*

FORM l_incr_g_tables   TABLES p_pages      STRUCTURE g_pages

                     p_windows    STRUCTURE g_windows

                     p_codes      STRUCTURE g_codes

              USING  p_node       TYPE      REF TO cl_ssf_fb_node.

  DATA: l_page    TYPE REF TO cl_ssf_fb_page.

  CASE p_node->nodetype.

    WHEN c_node_page_root.

    WHEN c_node_page.

      incr_counter p_pages      p_node->obj.

      l_page ?= p_node->obj.

    WHEN c_node_window.       incr_counter p_windows    p_node->obj.

    WHEN c_node_control_root.

    WHEN c_node_text.         "incr_counter p_text_items p_node->obj.

    WHEN c_node_graphic.      "incr_counter p_graphics   p_node->obj.

    WHEN c_node_address.      "incr_counter p_addresses  p_node->obj.

    WHEN c_node_command.      "incr_counter p_commands   p_node->obj.

    WHEN c_node_code.         incr_counter p_codes      p_node->obj.

    WHEN c_node_condition.    "incr_counter p_conditions p_node->obj.

    WHEN c_node_section.      "incr_counter p_sections   p_node->obj.

    WHEN c_node_event.        "incr_counter p_events     p_node->obj.

* WHEN C_NODE_REFERENCE.    INCR_COUNTER P_REFERENCES P_NODE->OBJ.

    WHEN c_node_outattr.      "incr_counter p_outattrs   p_node->obj.

  ENDCASE.

ENDFORM.                               "INCR_G_TABLES

*&---------------------------------------------------------------------*

*&      Form  CODE_PROCESS

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_FCODING  text

*----------------------------------------------------------------------*

FORM l_code_process  USING    code TYPE tfpcoding

                     CHANGING c_found.

  DATA: result_tab TYPE match_result_tab,

        lv_fcoding  LIKE LINE OF fcoding.

  DATA: lv_tabix      LIKE sy-tabix.

  LOOP AT code INTO lv_fcoding FROM sy-tabix.

    lv_tabix      = sy-tabix.

    CLEAR result_tab.

    FIND ALL OCCURRENCES OF REGEX  pregex IN lv_fcoding

       IGNORING CASE                                                        "700

       RESULTS result_tab.

    IF sy-subrc = 0.

      c_found = abap_true.

      exit.

    ENDIF.

  ENDLOOP.

ENDFORM.                    " CODE_PROCESS

Former Member
0 Kudos

Hi!

For an extended check you can do the following:

- check out which FM belongs to your smartforms (smartforms transaction - environment - function module name)

- go to SE37 - View - Check - Extended program check

Regards

Tamá