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: 

Report text element as selection option

Former Member
0 Kudos
79

Hi,

I encounter a performance problem in a report program that include a self define fields in the selection option. I use the FM READ_TEXT to read those fields and compare with the user input.Then, eliminates those unmatched records with if else statement.

Here is my code:


SELECT-OPTIONS: S_WADAT FOR LIKP-WADAT_IST.
  PARAMETERS: P_MAWB LIKE WA_REPORT-KZABE.
  PARAMETERS: P_HAWB LIKE LIKP-BOLNR.
  PARAMETERS: P_MATNR LIKE LIPS-MATNR.
  PARAMETERS: P_LOT(20) TYPE C.
 
  CLEAR: I_REPORT,I_DELIVERY,I_DELIVERY_INFO.
  REFRESH: I_REPORT,I_DELIVERY,I_DELIVERY_INFO.
 
  DATA WHERE_TAB(80) OCCURS 10 WITH HEADER LINE.
 
  DATA: BEGIN OF LTEXT OCCURS 50.
          INCLUDE STRUCTURE TLINE.
  DATA: END OF LTEXT.
 
  IF NOT P_HAWB IS INITIAL.
    CONCATENATE ' BOLNR = ' WHERE_TAB INTO WHERE_TAB.
    CONCATENATE WHERE_TAB '''' INTO WHERE_TAB.
    CONCATENATE WHERE_TAB P_HAWB INTO WHERE_TAB.
    CONCATENATE  WHERE_TAB '''' INTO WHERE_TAB.
    APPEND WHERE_TAB.
  ENDIF.
 
  IF NOT P_MATNR IS INITIAL.
    IF NOT WHERE_TAB IS INITIAL.
      CONCATENATE ' AND MATNR = ' WHERE_TAB INTO WHERE_TAB.
    ELSE.
      CONCATENATE ' MATNR = ' WHERE_TAB INTO WHERE_TAB.
    ENDIF.
    CONCATENATE WHERE_TAB '''' INTO WHERE_TAB.
    CONCATENATE WHERE_TAB P_MATNR INTO WHERE_TAB.
    CONCATENATE  WHERE_TAB '''' INTO WHERE_TAB.
    APPEND WHERE_TAB.
  ENDIF.
 
  SELECT A1~VBELN
         WADAT_IST
         BOLNR
         C1~LIFNR
         B1~MATNR
         LFIMG
         BTGEW
         B1~CHARG
    INTO CORRESPONDING FIELDS OF TABLE TMP_REPORT
    FROM LIKP AS A1 JOIN LIPS AS B1 ON A1~VBELN = B1~VBELN
        JOIN MCHA AS C1 ON B1~MATNR = C1~MATNR
                           AND
                           B1~WERKS = C1~WERKS
                           AND
                           B1~CHARG = C1~CHARG
     WHERE LFART = 'EL'
           AND
           WADAT_IST IN S_WADAT
           AND
           B1~CHARG NE ''
           AND
           B1~WERKS = 'ABC'
           AND
           (WHERE_TAB)
           .
 
 
  SORT TMP_REPORT BY VBELN.
 
  DATA: V_FLAG TYPE I,
        V_EXCLUDE TYPE I,
        V_LOT_EXCLUDE TYPE I.
 
  V_FLAG = 0.
  V_EXCLUDE = 0.
  V_LOT_EXCLUDE = 0.
 
  IF SY-SUBRC = 0.
 
* trim the parameter space
    SHIFT P_MAWB RIGHT DELETING TRAILING SPACE.
    SHIFT P_MAWB LEFT DELETING LEADING SPACE.
 
    SHIFT P_LOT RIGHT DELETING TRAILING SPACE.
    SHIFT P_LOT LEFT DELETING LEADING SPACE.
 
    LOOP AT TMP_REPORT.
 
      AT NEW VBELN.
        V_FLAG = 1.
        V_EXCLUDE = 0.
      ENDAT.
 
      IF V_FLAG = 1.
        PERFORM GET_HEADER_TEXT
              TABLES
                   LTEXT
              USING
                   'Z3IH'
                    TMP_REPORT-VBELN
                              .
 
        READ TABLE LTEXT INDEX 1.
        SPLIT LTEXT-TDLINE AT ':' INTO
        TMP_REPORT-VERUR TMP_REPORT-VERUR.
        READ TABLE LTEXT INDEX 2.
        SPLIT LTEXT-TDLINE AT ':' INTO
        TMP_REPORT-KZGBE TMP_REPORT-KZGBE.
        READ TABLE LTEXT INDEX 3.
        SPLIT LTEXT-TDLINE AT ':' INTO
        TMP_REPORT-KZABE TMP_REPORT-KZABE.
        READ TABLE LTEXT INDEX 4.
        SPLIT LTEXT-TDLINE AT ':' INTO
        TMP_REPORT-STABE TMP_REPORT-STABE.
        READ TABLE LTEXT INDEX 5.
        SPLIT LTEXT-TDLINE AT ':' INTO
        TMP_REPORT-PRONU TMP_REPORT-PRONU.
        READ TABLE LTEXT INDEX 6.
        SPLIT LTEXT-TDLINE AT ':' INTO
        TMP_REPORT-LADEL TMP_REPORT-LADEL.
 
        SHIFT TMP_REPORT-KZABE RIGHT DELETING TRAILING SPACE.
        SHIFT TMP_REPORT-KZABE LEFT DELETING LEADING SPACE.
 
        MOVE-CORRESPONDING TMP_REPORT TO WA_REPORT.
        MOVE-CORRESPONDING TMP_REPORT TO WA_TMPREPORT.
 
        V_FLAG = 0.
      ELSE.
        MOVE TMP_REPORT-VBELN TO WA_REPORT-VBELN.
        MOVE TMP_REPORT-LIFNR TO WA_REPORT-LIFNR.
        MOVE TMP_REPORT-MATNR TO WA_REPORT-MATNR.
        MOVE TMP_REPORT-LFIMG TO WA_REPORT-LFIMG.
      ENDIF.
 
      PERFORM GET_LOT_CODE USING
                                 WA_REPORT-MATNR
                                 '3LTU'
                                 WA_TMPREPORT-CHARG
                                 WA_REPORT-LOT.
 
      IF V_EXCLUDE  1 AND P_MAWB NE ''
        AND WA_TMPREPORT-KZABE NE P_MAWB .
        V_EXCLUDE = 1.
      ENDIF.
 
      SHIFT WA_REPORT-LOT RIGHT DELETING TRAILING SPACE.
      SHIFT WA_REPORT-LOT LEFT DELETING LEADING SPACE.
 
      IF P_LOT NE '' AND P_LOT NE WA_REPORT-LOT.
        V_LOT_EXCLUDE = 1.
      ELSE.
        V_LOT_EXCLUDE = 0.
      ENDIF.
 
 
      IF V_EXCLUDE  1 AND V_LOT_EXCLUDE  1.
        APPEND WA_REPORT TO I_REPORT.
        CLEAR WA_REPORT.
        CLEAR TMP_REPORT.
      ENDIF.
 
    ENDLOOP.

1 REPLY 1

Former Member
0 Kudos
53

Hi,

i found one perfromance issue, try to remove the "INTO CORRESPONDING FIELDS OF TABLE " in your select statement, the order of the fields that you are fetching and the oreder for the fields in your internal table structure should be same, then you can remove "INTO CORRESPONDING FIELDS OF TABLE " and while fetching the fields reffer the table and fields you need to fetch here also you need to main the same order...like you have to do the same in where condition.

Reward if needful.

Thanks,

Sreeram.