Tip

Searching items in SAPscript forms

With the standard tools it isn't possible to generate a where-used list of tables, strings, standard texts etc.. in SAPscript forms. Therefore I wrote the report ZSEARCH_ITEMS_IN_SAPSCRIPT.


REPORT ZSEARCH_ITEMS_IN_SAPSCRIPT
       NO STANDARD PAGE HEADING LINE-SIZE 208.

*=======================================================================
* Omschrijving : Searching different items (e.g. strings, field, text,
*                program-names etc..) in sapscript forms
* Auteur       : Angelo Hoppenbrouwer
* Datum        : 07-11-2001
*======================================================================*

TABLES: STXL,
        TLINE.

DATA BEGIN OF BDCDATA OCCURS 100.
        INCLUDE STRUCTURE BDCDATA.
DATA END OF BDCDATA.

DATA BEGIN OF LINES OCCURS 100.
        INCLUDE STRUCTURE TLINE.
DATA END OF LINES.

DATA: BEGIN OF STXL_ID,
        TDOBJECT LIKE STXL-TDOBJECT,
        TDNAME   LIKE STXL-TDNAME,
        TDID     LIKE STXL-TDID,
        TDSPRAS  LIKE STXL-TDSPRAS,
      END OF STXL_ID.

DATA: BEGIN OF KOP,
        TXT(208),
      END OF KOP.

DATA: I_STXL LIKE STXL OCCURS 10 WITH HEADER LINE,
      I_TAB(40) OCCURS 10 WITH HEADER LINE,
      CLIENT LIKE SY-MANDT,
      H_FIELD(40),
      H_VALUE(40),
      H_LINE LIKE SY-LINNO,
      H_OFFSET TYPE I,
      H_REGEL(70) TYPE C,
      H_TEL TYPE I,
      H_TOT TYPE I,
      H_POS TYPE I,
      H_POS1 TYPE I,
      H_POS2 TYPE I,
      H_LEN TYPE I,
      VORIGE_TDSPRAS_TDNAME(71)

    Requires Free Membership to View

TYPE C, HUIDIGE_TDSPRAS_TDNAME(71) TYPE C, P_NAAM LIKE RSEUX-CP_VALUE, H_TXT1(40), H_TXT2(40), H_WINDOW(132), H_STRING(40), H_STRING1(40), H_STRING2 LIKE H_STRING1, H_LINE1 LIKE LINES-TDLINE, H_LINE2 LIKE H_LINE1. SELECTION-SCREEN BEGIN OF BLOCK ZOEK_ITEM WITH FRAME TITLE TEXT-001. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS: PA_ITEM1 RADIOBUTTON GROUP ITEM DEFAULT 'X'. SELECTION-SCREEN COMMENT 4(16) TEXT-011. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS: PA_ITEM2 RADIOBUTTON GROUP ITEM. SELECTION-SCREEN COMMENT 4(16) TEXT-012. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS: PA_ITEM3 RADIOBUTTON GROUP ITEM. SELECTION-SCREEN COMMENT 4(16) TEXT-013. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS: PA_ITEM4 RADIOBUTTON GROUP ITEM. SELECTION-SCREEN COMMENT 4(16) TEXT-014. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS: PA_ITEM5 RADIOBUTTON GROUP ITEM. SELECTION-SCREEN COMMENT 4(16) TEXT-015. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK ZOEK_ITEM. SELECTION-SCREEN BEGIN OF BLOCK ITEM_WAARDE WITH FRAME TITLE TEXT-002. PARAMETERS: PA_STR(40) OBLIGATORY, PA_MANDT LIKE SY-MANDT DEFAULT SY-MANDT. SELECTION-SCREEN END OF BLOCK ITEM_WAARDE. SELECTION-SCREEN BEGIN OF BLOCK FORM WITH FRAME TITLE TEXT-003. SELECT-OPTIONS: SO_NAME FOR STXL-TDNAME NO INTERVALS DEFAULT 'Z*' OPTION CP, SO_SPRAS FOR STXL-TDSPRAS NO INTERVALS DEFAULT 'NL'. SELECTION-SCREEN END OF BLOCK FORM. START-OF-SELECTION. CLIENT = SY-MANDT. CLEAR: H_STRING1, H_STRING2. IF NOT PA_ITEM1 IS INITIAL. " Standaardtekst CONCATENATE 'include' PA_STR INTO H_STRING1 SEPARATED BY ' '. H_TXT1 = 'standard text'. ENDIF. IF NOT PA_ITEM2 IS INITIAL. " Tabel (+veld) CONCATENATE '&' PA_STR INTO H_STRING1. H_TXT1 = 'table (+field)'. ENDIF. IF NOT PA_ITEM3 IS INITIAL. " Hulpveld CONCATENATE '&' PA_STR '&' INTO H_STRING1. H_TXT1 = 'variable'. ENDIF. IF NOT PA_ITEM4 IS INITIAL. " Programma CONCATENATE 'in program' PA_STR INTO H_STRING1 SEPARATED BY ' '. H_TXT1 = 'program'. ENDIF. IF NOT PA_ITEM5 IS INITIAL. " String H_STRING1 = PA_STR. H_TXT1 = 'string'. ENDIF. CONCATENATE '"' PA_STR '"' INTO H_TXT2. FORMAT COLOR COL_HEADING INTENSIFIED ON. CONCATENATE 'Use of' H_TXT1 H_TXT2 'in forms' INTO KOP SEPARATED BY ' '. WRITE: / KOP. ULINE. FORMAT COLOR COL_HEADING INTENSIFIED OFF. WRITE: / 'Clt', 005 'Form', 036 'Lang', 041(030) 'Window', 072(002) 'Fm', 077(132) 'Row'. ULINE. FORMAT COLOR COL_NORMAL INTENSIFIED ON. STXL_ID-TDOBJECT = 'FORM'. STXL_ID-TDID = 'TXT'. SELECT * FROM STXL CLIENT SPECIFIED WHERE MANDT = PA_MANDT AND RELID EQ 'TX' AND TDOBJECT EQ 'FORM' AND TDID EQ 'TXT' AND TDNAME IN SO_NAME AND TDSPRAS IN SO_SPRAS. MOVE-CORRESPONDING STXL TO I_STXL. APPEND I_STXL. ENDSELECT. SORT I_STXL. CLEAR HUIDIGE_TDSPRAS_TDNAME. CLEAR VORIGE_TDSPRAS_TDNAME. LOOP AT I_STXL. STXL_ID-TDNAME = I_STXL-TDNAME. STXL_ID-TDSPRAS = I_STXL-TDSPRAS. STXL_ID-TDID = I_STXL-TDID. CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME INTO HUIDIGE_TDSPRAS_TDNAME. IF HUIDIGE_TDSPRAS_TDNAME <> VORIGE_TDSPRAS_TDNAME. CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME INTO VORIGE_TDSPRAS_TDNAME. REFRESH LINES. CLEAR H_TEL. IMPORT TLINE TO LINES FROM DATABASE STXL(TX) CLIENT I_STXL-MANDT ID STXL_ID. LOOP AT LINES. IF LINES-TDFORMAT = '/W'. H_WINDOW = LINES-TDLINE. ENDIF. SEARCH LINES-TDLINE FOR H_STRING1. IF SY-SUBRC <> 0 AND H_STRING2 <> SPACE. SEARCH LINES-TDLINE FOR H_STRING2. ENDIF. IF SY-SUBRC EQ 0 AND LINES-TDFORMAT NE '/*'. H_POS = SY-FDPOS. IF NOT PA_ITEM1 IS INITIAL. ADD 8 TO H_POS. ENDIF. IF NOT PA_ITEM4 IS INITIAL. ADD 11 TO H_POS. ENDIF. H_LEN = STRLEN( PA_STR ). H_STRING = LINES-TDLINE+H_POS(H_LEN). IF H_TEL EQ 0. HIDE I_STXL-MANDT. HIDE STXL-TDNAME. HIDE I_STXL-TDSPRAS. WRITE: /001 I_STXL-MANDT, 005 STXL-TDNAME HOTSPOT ON, 036 I_STXL-TDSPRAS, 041 H_WINDOW(30). CLEAR STXL-TDNAME. ELSE. WRITE: /041 H_WINDOW(30). ENDIF. WRITE: 072 LINES-TDFORMAT. H_POS1 = 77 + H_POS. H_POS2 = H_POS + STRLEN( H_STRING ). IF H_POS EQ 0. CLEAR H_LINE1. ELSE. H_LINE1 = LINES-TDLINE(H_POS). ENDIF. H_LINE2 = LINES-TDLINE+H_POS2. H_POS2 = H_POS2 + 77. WRITE: 077 H_LINE1, AT H_POS1 H_STRING COLOR COL_HEADING, AT H_POS2 H_LINE2. H_TEL = H_TEL + 1. H_TOT = H_TOT + 1. ENDIF. ENDLOOP. IF NOT H_TEL IS INITIAL. ULINE. ENDIF. ENDIF. ENDLOOP. FORMAT COLOR COL_NORMAL INTENSIFIED OFF. SKIP 1. WRITE: / 'Number of hits:', H_TOT. AT LINE-SELECTION. CHECK STXL-TDNAME <> SPACE. GET CURSOR FIELD H_FIELD VALUE H_VALUE LINE H_LINE OFFSET H_OFFSET. CHECK H_FIELD = 'STXL-TDNAME'. CHECK I_STXL-MANDT = SY-MANDT. REFRESH BDCDATA. PERFORM BDC_DYNPRO USING 'SAPMSSCF' '1102'. PERFORM BDC_FIELD USING 'RSSCF-TDFORM' STXL-TDNAME. PERFORM BDC_FIELD USING 'RSSCF-TDSPRAS' I_STXL-TDSPRAS. CALL TRANSACTION 'SE71' USING BDCDATA. CLEAR STXL-TDNAME. *&---------------------------------------------------------------------* *& Form BDC_DYNPRO *&---------------------------------------------------------------------* FORM BDC_DYNPRO USING PROGRAM DYNPRO. CLEAR BDCDATA. BDCDATA-PROGRAM = PROGRAM. BDCDATA-DYNPRO = DYNPRO. BDCDATA-DYNBEGIN = 'X'. APPEND BDCDATA. ENDFORM. " BDC_DYNPRO *&---------------------------------------------------------------------* *& Form BDC_FIELD *&---------------------------------------------------------------------* FORM BDC_FIELD USING FNAM FVAL. CLEAR BDCDATA. BDCDATA-FNAM = FNAM. BDCDATA-FVAL = FVAL. APPEND BDCDATA. ENDFORM. " BDC_FIELD ******************************************************* Comment Angelo: Selection-texts: PA_ITEM1 PA_ITEM2 PA_ITEM3 PA_ITEM4 PA_ITEM5 PA_MANDT Client PA_STR Search-item SO_NAME Form SO_SPRAS Language Text-symbols: 001 Selection search-item 002 Value 003 Selection form(s) 011 Standard text 012 Table (+ field) 013 Variable 014 Program 015 String

This was first published in January 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.