abapsapscriptsap-smart-forms

How to find a standard text within a SapScript or SmartForm?


I need to track down where within a large number of custom sapscripts and smartforms a specific standard text (SO10) is being used.

Apart from the equivalent of "check the code for each print script", I've not found a workable solution online. Any suggestions?


Solution

  • After posting, I found a partial solution. The code below will search for a standard text within sapscripts, but not smartforms.

    PARAMETERS: p_sttxt LIKE stxh-tdname.
    
    DATA: BEGIN OF t_stxh OCCURS 0,
            tdname LIKE stxh-tdname,
            tdspras LIKE stxh-tdspras,
          END OF t_stxh.
    
    DATA t_lines LIKE tline OCCURS 0 WITH HEADER LINE.
    
    SELECT tdname tdspras FROM stxh INTO TABLE t_stxh
                             WHERE tdobject = 'FORM'
                             AND tdid = 'TXT'
                             AND tdspras = 'E'.
    
    LOOP AT t_stxh.
      REFRESH t_lines.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
    *       CLIENT                        = SY-MANDT
          id                            = 'TXT'
          language                      = t_stxh-tdspras
          name                          = t_stxh-tdname
          object                        = 'FORM'
        TABLES
          lines                         = t_lines
       EXCEPTIONS
         id                            = 0
         language                      = 0
         name                          = 0
         not_found                     = 0
         object                        = 0
         reference_check               = 0
         wrong_access_to_archive       = 0
         OTHERS                        = 0 .
    
      SEARCH t_lines FOR p_sttxt.
      IF sy-subrc EQ 0.
        WRITE:/ t_stxh-tdname, t_stxh-tdspras.
      ENDIF.
    
    ENDLOOP.
    

    This is a (fixed) version of the code found here: http://scn.sap.com/thread/179142