Help in MSEG select performance.

Hi all, please, help me with this performance.
The coment lines was the original code.
The previous code got time out and the new code is taking long long time. The range r_mblnr has about 1500 records.
MSEG table has more than 1.500.000 records.
Thanks in advance, regards
RP
**      SELECT  mblnr mjahr zeile bwart matnr werks lgort charg
**              insmk lifnr shkzg waers dmbtr bnbtr bualt menge
**              meins erfmg erfme bpmng bprme ebeln ebelp lfbnr
**              bukrs lsmng lsmeh lfbja lfpos xwsbr sjahr smbln
**              smblp
**              FROM mseg
**              INTO TABLE t_mseg_cancel
**            FOR ALL ENTRIES IN t_mseg
**            WHERE ( smbln EQ t_mseg-mblnr
**              AND   sjahr EQ t_mseg-mjahr
**              AND   smblp EQ t_mseg-zeile )
**               OR ( lfbnr = t_mseg-mblnr
**              AND   lfbja = t_mseg-mjahr
**              AND   lfpos = t_mseg-zeile ).
**      SELECT  mblnr mjahr zeile bwart matnr werks lgort charg
**              insmk lifnr shkzg waers dmbtr bnbtr bualt menge
**              meins erfmg erfme bpmng bprme ebeln ebelp lfbnr
**              bukrs lsmng lsmeh lfbja lfpos xwsbr sjahr smbln
**              smblp
**              FROM mseg APPENDING TABLE t_mseg_cancel
**              FOR ALL ENTRIES IN t_mseg
**              WHERE   mblnr EQ t_mseg-mblnr
**                AND ( lfbnr NE space
**                 OR   smbln NE space ).
    LOOP AT t_mseg.
      add_range r_mblnr t_mseg-mblnr.
      add_range h_mjahr t_mseg-mjahr.
      add_range r_zeile t_mseg-zeile.
    ENDLOOP.
    SORT: r_mblnr BY low,
          h_mjahr BY low,
          r_zeile BY low.
    DELETE ADJACENT DUPLICATES FROM r_mblnr COMPARING low.
    DELETE ADJACENT DUPLICATES FROM h_mjahr COMPARING low.
    DELETE ADJACENT DUPLICATES FROM r_zeile COMPARING low.
    SELECT  mblnr mjahr zeile bwart matnr werks lgort charg
            insmk lifnr shkzg waers dmbtr bnbtr bualt menge
            meins erfmg erfme bpmng bprme ebeln ebelp lfbnr
            bukrs lsmng lsmeh lfbja lfpos xwsbr sjahr smbln
            smblp
            FROM mseg
            INTO TABLE t_mseg_cancel
            FOR ALL ENTRIES IN r_mblnr
          WHERE ( smbln = r_mblnr-low
            AND   sjahr IN r_mjahr
            AND   smblp IN r_zeile ).
    SELECT  mblnr mjahr zeile bwart matnr werks lgort charg
            insmk lifnr shkzg waers dmbtr bnbtr bualt menge
            meins erfmg erfme bpmng bprme ebeln ebelp lfbnr
            bukrs lsmng lsmeh lfbja lfpos xwsbr sjahr smbln
            smblp
            FROM mseg
            APPENDING TABLE t_mseg_cancel
            FOR ALL ENTRIES IN r_mblnr
          WHERE ( lfbnr = r_mblnr-low
            AND   lfbja IN r_mjahr
            AND   lfpos IN r_zeile ).
    SELECT  mblnr mjahr zeile bwart matnr werks lgort charg
            insmk lifnr shkzg waers dmbtr bnbtr bualt menge
            meins erfmg erfme bpmng bprme ebeln ebelp lfbnr
            bukrs lsmng lsmeh lfbja lfpos xwsbr sjahr smbln
            smblp
            FROM mseg APPENDING TABLE t_mseg_cancel
            FOR ALL ENTRIES IN r_mblnr
            WHERE   mblnr = r_mblnr-low
              AND ( lfbnr NE space
               OR   smbln NE space ).

Hi Rodrigo,
if this statement is really important, I would go back to a single Statement, I would create an additional index and I would change the last statement (may be):
SELECT mblnr mjahr zeile bwart matnr werks lgort charg
       insmk lifnr shkzg waers dmbtr bnbtr bualt menge
       meins erfmg erfme bpmng bprme ebeln ebelp lfbnr
       bukrs lsmng lsmeh lfbja lfpos xwsbr sjahr smbln
       smblp
  FROM mseg
  INTO TABLE t_mseg_cancel
   FOR ALL ENTRIES IN t_mseg
WHERE ( smbln EQ t_mseg-mblnr
     AND sjahr EQ t_mseg-mjahr
     AND smblp EQ t_mseg-zeile )
    OR ( lfbnr = t_mseg-mblnr
     AND lfbja = t_mseg-mjahr
     AND lfpos = t_mseg-zeile )
    OR ( mblnr EQ t_mseg-mblnr
     AND mjahr EQ t_mseg-mjahr          " if correct
     AND zeile EQ t_mseg-zeile          " if correct
     AND ( lfbnr NE space OR smbln NE space ) ).
The new secondary Index should contain the fields: LFBNR, LFBJA and LFPOS.
Don't forget to create new statistics after creating the index.
Many people probably disagree with a new secondary index, but to improve your report, it is probably the only solution.
You should not add a new index without good reasons, but a single index does not cost you too much (insert and update performance). You should not tend to create additional indexes for any statement, but on big tables it is sometimes unavoidable.
Best regards
Ralph Ganszky

Similar Messages

  • MSEG select performance problem - Please help me (URGERNT)

    I have the following SELECT stmt which is taking more time to execute......Kindly help me how to improve performance ...
    YOUR HELP IS HIGHLY APPRECIATED....
      SELECT  a~mblnr
                    a~matnr
                    a~werks
                    a~charg
                    a~lifnr
                    a~bualt
                    a~erfmg
                    a~ebeln
                    a~ebelp
                    b~budat
                   INTO CORRESPONDING FIELDS OF TABLE it_mseg_mkpf
                    FROM mseg AS a INNER JOIN mkpf AS b
                      ON amblnr EQ bmblnr
                   WHERE a~matnr IN s_matnr
                     AND a~werks IN s_werks
                     AND a~lifnr IN s_lifnr
                     AND a~bwart EQ p_bwart
                     AND ( aebeln NE ' ' AND aebeln IN s_ebeln )
                     AND b~budat IN s_budat.
      IF NOT it_mseg_mkpf IS INITIAL.
        SELECT matnr bismt zzshelf_life FROM mara INTO  TABLE it_mara
        *          FOR ALL ENTRIES IN it_mseg_mkpf*
        *          WHERE matnr = it_mseg_mkpf-matnr.*
      ENDIF.
      IF NOT it_mara IS INITIAL.
        SELECT matnr maktx FROM makt INTO TABLE it_makt
        *                         FOR ALL ENTRIES IN it_mara*
        *               WHERE matnr = it_mara-matnr.*  ENDIF.
    Thanks in advance,
    Regards,

    Hi Sam,
    Try this.
    SELECT a~mblnr
    a~matnr
    a~werks
    a~charg
    a~lifnr
    a~bualt
    a~erfmg
    a~ebeln
    a~ebelp
    b~budat
    INTO CORRESPONDING FIELDS OF TABLE it_mseg_mkpf
    FROM mkpf AS b INNER JOIN mseg AS a  (although result will be same by reversing this join it's better to keep header on left of the join)
    ON amblnr EQ bmblnr and amjahr EQ bmjahr
    WHERE a~matnr IN s_matnr
    AND a~werks IN s_werks
    AND a~lifnr IN s_lifnr
    AND a~bwart EQ p_bwart
    AND ( aebeln NE ' ' AND aebeln IN s_ebeln )
    AND b~budat IN s_budat.
    (if possible, give mjahr in you selection screen and specify in where condition)
    IF NOT it_mseg_mkpf [ ]  IS INITIAL. (previous condition will check header line only)
    SELECT matnr bismt zzshelf_life FROM mara INTO TABLE it_mara
    FOR ALL ENTRIES IN it_mseg_mkpf
    WHERE matnr = it_mseg_mkpf-matnr
    ENDIF.
    IF NOT it_mara[ ]
      IS INITIAL.
    SELECT matnr maktx FROM makt INTO TABLE it_makt
    FOR ALL ENTRIES IN it_mara
    WHERE matnr = it_mara-matnr.
    ENDIF.
    Regards,
    Mohaiyuddin

  • Hi ,i want provide a input help for a Selection input field

    Hi Experts,
    I want to provide  a input help for field in selection-screen ,
    this field is non primary key Custom Table(Z) selection input field .
    how we can get ,f4 help for this field.
    how to get f4 help Suppose field Link s_mtart-low,s_mtart-high,
    What are the function moduled available for this >
    Thanks in Advance.
    Regards,
    Hitu.

    Hi,
    refer to below code.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_usnam-low.
    **//To provide F4 help to S_USNAM-LOW
    PERFORM f_f4help_usnam USING 'S_USNAM-LOW'.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_usnam-high.
    **//To provide F4 help to S_USNAM-HIGH
    PERFORM f_f4help_usnam USING 'S_USNAM-HIGH'.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_wbs-low.
    **//To provide F4 help to S_WBS-LOW
    PERFORM f_f4help_wbs USING 'S_WBS-LOW'.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_wbs-high.
    **//To provide F4 help to S_WBS-HIGH
    PERFORM f_f4help_wbs USING 'S_WBS-HIGH'.
    *&      Form  f_f4help_usnam
        To provide F4 help to username
         -->P_0019   text
    *FORM f_f4help_usnam  USING    value(p_0019) TYPE any.
    **// To retrieve username from mkpf.
    SELECT bname
            FROM usr01
            INTO TABLE it_usnam.
    SORT:  it_usnam  BY usnam.
    DELETE ADJACENT DUPLICATES FROM it_usnam COMPARING usnam.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
      DDIC_STRUCTURE         = ' '
          retfield            = c_retusnam
      PVALKEY                = ' '
        dynpprog              = c_dynpprog
        dynpnr                = c_dynpnr
         dynprofield          = p_0019
      STEPL                  = 0
      WINDOW_TITLE           =
      VALUE                  = ' '
         value_org            = c_s
      MULTIPLE_CHOICE        = ' '
      DISPLAY                = ' '
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
      MARK_TAB               =
      IMPORTING
      USER_RESET             =
        TABLES
          value_tab           = it_usnam
        field_tab            = it_usnam.
      return_tab             = l_it_ret
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
    *ENDFORM.                    " f_f4help_usnam
    *&      Form  f_f4help_wbs
        To create F4 help for wbs element
         -->P_0039   text
    *FORM f_f4help_wbs  USING    value(p_0039) TYPE any.
    **// To retrive wbs element from mseg
    SELECT pspel
            FROM pspl
            INTO TABLE it_wbs.
    SORT:it_wbs   BY  wbs.
    DELETE ADJACENT DUPLICATES FROM it_wbs COMPARING wbs.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
      DDIC_STRUCTURE         = ' '
         retfield               = c_retwbs
      PVALKEY                = ' '
       dynpprog               = c_dynpprog
       dynpnr                 = c_dynpnr
        dynprofield            = p_0039
      STEPL                  = 0
      WINDOW_TITLE           =
      VALUE                  = ' '
        value_org              = c_s
      MULTIPLE_CHOICE        = ' '
      DISPLAY                = ' '
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
      MARK_TAB               =
    IMPORTING
      USER_RESET             =
       TABLES
         value_tab              = it_wbs
      FIELD_TAB              =
      return_tab             = l_it_ret1
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
    *ENDFORM.                    " f_f4help_wbs

  • Standard input help in zreport selection screen

    Hi All,
       I am having a selection sceen like S_PERNR FOR PA0001-PERNR.
       when I put f4 help then it is comming right and showing the value
      of personnel number which is correct.
       But when you execute the transaction PA30 and select f4 help in
    personnel number then it iscomming with window and all information
    is cooming. I want to put that help on my selection screnn S_PERNR FOR PA0001-PERNR.
    is it possible? Please give me the solution.
    Thanks,
    Rakesh

    Yes, i am getting input help for position in that program also in ECC 6.0 version.
    SELECT-OPTIONS:pchobjid FOR pchdy-objid_seq.           
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pchobjid-low.    
      rhx-f4-objid-low pchplvar pchotype pchobjid '' ''.     
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pchobjid-high.   
      rhx-f4-objid-high pchplvar pchotype pchobjid '' ''.     
    AT SELECTION-SCREEN ON pchobjid.
      PERFORM check_objid_sign(rhxchk00) USING pchobjid-sign.
    Which version are you working ?
    Note: Plz post only one question per thread.

  • Need help in optimising the performance of a query

    Need help in optimising the performance of a query. Below is the query that is executed on TABLE_A, TABLE_B and TABLE_C with record counts as 10M, 10m and 42 (only) respectively and it takes around 5-7 minutes to get 40 records:
    SELECT DISTINCT a.T_ID_, a.FIRSTNAME, b.T_CODE, b.PRODUCT,
    CASE WHEN TRUNC(b.DATE) +90 = TRUNC(SYSDATE) THEN -90 WHEN TRUNC(b.DATE) +30 = TRUNC(SYSDATE) THEN -30 ELSE 0 END AS T_DATE FROM TABLE_B b
    INNER JOIN TABLE_A a ON (a.T_ID_ = b.T_ID_) LEFT JOIN TABLE_C c ON b.PRODUCT = c.PRODUCT
    WHERE b.STATUS = 'T' AND (b.TYPE = 'ACTION'
    AND ( TRUNC(b.DATE) + 1 = TRUNC(SYSDATE) ) ) AND b.PRODUCT = 2;
    Note: Indices on the join columns are available in the respective tables
    Please let me know if there is any better way to write it.
    Edited by: 862944 on Aug 18, 2011 9:52 AM

    862944 wrote:
    Need help in optimising the performance of a query. Below is the query that is executed on TABLE_A, TABLE_B and TABLE_C with record counts as 10M, 10m and 42 (only) respectively and it takes around 5-7 minutes to get 40 records:
    SELECT DISTINCT a.T_ID_, a.FIRSTNAME, b.T_CODE, b.PRODUCT,
    CASE WHEN TRUNC(b.DATE) +90 = TRUNC(SYSDATE) THEN -90 WHEN TRUNC(b.DATE) +30 = TRUNC(SYSDATE) THEN -30 ELSE 0 END AS T_DATE FROM TABLE_B b
    INNER JOIN TABLE_A a ON (a.T_ID_ = b.T_ID_) LEFT JOIN TABLE_C c ON b.PRODUCT = c.PRODUCT
    WHERE b.STATUS = 'T' AND (b.TYPE = 'ACTION'
    AND ( TRUNC(b.DATE) + 1 = TRUNC(SYSDATE) ) ) AND b.PRODUCT = 2;
    Note: Indices on the join columns are available in the respective tables
    Please let me know if there is any better way to write it.
    Edited by: 862944 on Aug 18, 2011 9:52 AM[When Your Query Takes Too Long|https://forums.oracle.com/forums/thread.jspa?messageID=1812597]

  • How to provide F4 help in a selection screen

    Hi..
       How to provide F4 help in a selection screen for a particular field  using  
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'.
    Thanks in Advance.
    Regards
    Raj Kumar

      AT SELECTION SCREEN
    at selection-screen on value-request for s_contr-low.
    Get contract (low value)
      perform get_contract changing s_contr-low.
    form get_contract  changing p_contr .
      types: begin of ty_ycontract,
               ycontract type xchcontract-ycontract,
               lifnr     type xchcontract-lifnr,
               ycontdate type xchcontract-ycontdate,
               ycont_end_dt type xchcontract-ycont_end_dt ,
             end of ty_ycontract.
      data: ds_returntab   type ddshretval,
            dt_returntab   type table of ddshretval,
            dl_fieldname     type dfies-fieldname.
      data: dt_ycontract type table of ty_ycontract.
      select ycontract lifnr ycontdate ycont_end_dt
        from xchcontract
        into table dt_ycontract.
      if sy-subrc = 0.
        clear dl_fieldname.
        dl_fieldname = 'YCONTRACT'.
        call function 'F4IF_INT_TABLE_VALUE_REQUEST'
          exporting
            retfield        = dl_fieldname
            value_org       = 'S'
          tables
            value_tab       = dt_ycontract
            return_tab      = dt_returntab
          exceptions
            parameter_error = 1
            no_values_found = 2
            others          = 3.
        if sy-subrc = 0.
          clear ds_returntab.
          read table dt_returntab into ds_returntab index 1.
          if sy-subrc = 0.
            p_contr = ds_returntab-fieldval.
          endif.
        endif.
      endif.
    endform.

  • F4 help in the selection screen from a int table

    I collected the datas from the function module. and the internal table is populated.
    the internal table contains manny fields.
    among these fields i need to take only one field and this field value to be used for F4 help in the selection screen ( not a dynpro)
    for example : in the selection screen
    I have to select the PO.
    based on the user i have filtered the PO. (determined dynamically by using the user name this i have done it)
    then i have to assign the PO the selection screen.
    which FM will be better to use  for this type of scenario and help me out with some example codes particularly for my req
    Thanks

    Hi ,
    use the FM 'F4IF_INT_TABLE_VALUE_REQUEST'
    This example is for search help for material type .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_mtart-low .
    select all material types you want to display in search help into table i_mtart.
    PERFORM select_material_type.
    PERFORM help_material_type.
    *& Form help_material_type
    text
    --> p1 text
    <-- p2 text
    FORM help_material_type .
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    DDIC_STRUCTURE = ' '
    retfield = 'MTART'
    PVALKEY = ' '
    dynpprog = sy-cprog
    dynpnr = sy-dynnr
    dynprofield = 'S_MTART-LOW'
    STEPL = 0
    WINDOW_TITLE =
    VALUE = ' '
    value_org = 'S'
    MULTIPLE_CHOICE = ' '
    DISPLAY = ' '
    CALLBACK_PROGRAM = ' '
    CALLBACK_FORM = ' '
    MARK_TAB =
    IMPORTING
    USER_RESET =
    TABLES
    value_tab = i_mtart
    FIELD_TAB =
    RETURN_TAB =
    DYNPFLD_MAPPING =
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    OTHERS = 3
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " help_material_type
    Regards,
    Balaji.

  • Can we create serach help for a selection screen field

    Can we create serach help for a selection screen field with out creating searchhelp object.
    I mean is it possible to create serchelp in the program itself with some specific values i want to give.
    E.g say we can define any internal table and fill it with values and using that into selection screen fields
    Regards
    Mave

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR paymeth.
      PERFORM PAYMENT_HELP.
    FORM PAYMENT_HELP.
      DATA: begin of DESCR_TAB occurs 0,
            DESCR LIKE BKPF-BKTXT,
            END OF DESCR_TAB.
      DATA: gd_repid like sy-repid.
      gd_repid = sy-repid.
      DESCR_TAB-DESCR = 'aaaaa'.
      append DESCR_TAB.
      DESCR_TAB-DESCR = 'bbbbb'.
      append DESCR_TAB.
      DESCR_TAB-DESCR = 'ccccc'.
      append DESCR_TAB.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield    = 'DESCR'
                DYNPPROG    = gd_repid
                DYNPNR      = '1000'
                DYNPROFIELD = 'paymeth'
                VALUE_ORG   = 'S'
                DISPLAY     = ' '
           TABLES
                value_tab   = DESCR_TAB.
    endform.
    Svetlin

  • Need some help with the Select query.

    Need some help with the Select query.
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    select single vkorg abgru from ZADS into it_rej.
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
            VKORG TYPE VBAK-VKORG,
            ABGRU TYPE VBAP-ABGRU,
           END OF IT_REJ.
    This is causing performance issue. They are asking me to include the where condition for this select query.
    What should be my select query here?
    Please suggest....
    Any suggestion will be apprecaiated!
    Regards,
    Developer

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Search help icon for select option

    hello all...
    can some one let me know , how to attach F4 help icon to select option..??
    in select option im referrin to a data element, this data element has a domain which has value range.
    if i press F4 on the select option, im gettin the values in the search help but the icon is not appearing..
    any suggestions...
    regards..
    vishal

    Hi,
    Select TABLE-FIELD GOTO>Search help>For field.
    If you have Search help you can assign here or else you need to create search help through SE11.
    Or programatically you can code like below.
    See below code........
    selection-screen: begin of block B1 with frame title text-001.
    select-options: s_pernr for zfdmr_records-pernr,
    selection-screen end of block B1.
    data: begin of t_itab occurs 0,
          pernr like zfdmr_records-pernr,
          end of t_itab.
    DATA: t_return like ddshretval occurs 0 with header line.
    *at selection-screen on value-request for s_pernr-low.
    perform get_values changing s_pernr-low.
    *at selection-screen on value-request for s_pernr-high.
    perform get_values changing s_pernr-high.
    *&      Form  get_values
          text
         -->P_S_PERNR_LOW  text
    FORM get_values CHANGING    P_S_PERNR.
      refresh t_itab.
      clear t_return.
      select pernr  from zfdmr_records into table t_itab.
      delete adjacent duplicates from t_itab.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
      DDIC_STRUCTURE         = ' '
          RETFIELD               = 'PERNR'
      PVALKEY                = ' '
         DYNPPROG               = sy-cprog
         DYNPNR                 = sy-dynnr
         DYNPROFIELD            = 'ZFDMR_RECORDS-PERNR'
      STEPL                  = 0
      WINDOW_TITLE           =
      VALUE                  = ' '
         VALUE_ORG              = 'S'
         MULTIPLE_CHOICE        = ' '
         DISPLAY                = 'F'
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
        TABLES
          VALUE_TAB              = t_itab
      FIELD_TAB              =
         RETURN_TAB             = t_return
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE t_return INDEX 1.
      p_s_pernr = t_return-fieldval.
    ENDFORM.                    " get_values
    Thanks.
    If this helps you award points and close the thread.
    Message was edited by: Deepak333 k
    Message was edited by: Deepak333 k

  • Help required for improving performance of the Query

    Hello SAP Techies,
    I have MRP Query which shows Inventory projection by Calendar Year/Month wise.
    There are 2 variables Plant and Material in free charateristics where it has been restricted by replacement of Query result .
    Another query is Control M Query which is based on multiprovider. Multiprovider is created on 5 cubes.
    The Query is taking 20 -15 Mins to get the result.
    Due to replacement path by query result for the 2 variables first the control M Query is excuted. Business wanted to see all those materials in MRP query which are allocated to base plant hence they designed the query to use replacement Path by Query result. So it will get all the materials and plants from the control M query and will find the Invetory projection for the same selection in MRP query.
    Is there any way I can improve the performance of the Query.
    Query performance has been discussed innumerable times in the forums and there is a lot of information on the blogs and the WIKI - please search the forums before posting and if the existing posts do no answer your question satisfactorily then please raise a new post - else almost all the answers you get will be rehashed versions of previous posts ( and in most cases without attribution to the original author )
    Edited by: Arun Varadarajan on Apr 19, 2011 9:23 PM

    Hi ,
    Please see if you can make these changes currently to the report . It will help in improving the performance of the query
    1. Select the right read mode.
        Reading data during navigation minimizes the impact on
         the application server resources because only data that
        the user requires will be retrieved.
    2. Leverage filters as much as possible. Using filters contributes to
       reducing the number of database reads and the size of the result set,
        hereby significantly improving query runtimes.
       Filters are especially valuable when associated with u201Cbig
        dimensionsu201D where there is a large number of characteristics such as
        customers and document numbers.
    3. Reduce RKFs in the query to as few as possible. Also, define
    calculated & RKFs on the Infoprovider level instead of locally within the query.
    Regards
    Garima

  • Hard coding f4 help values in select options

    hi ,
    i have requirement to hardcode certain values in the select-options in the selection-screen as F4 help . how to do it please help me out.

    Hello,
    Plz try this code below:
    DATA:
          v_fname        TYPE fieldname,
          v_dynfield     TYPE dynfnam,
          v_fname01      TYPE fieldname,
          v_dynfield01   TYPE dynfnam.
    CONSTANTS:
    c_fname01    TYPE fieldname VALUE 'S_LOKKT-LOW',
    c_fname02    TYPE fieldname VALUE 'S_LOKKT-HIGH',
    c_dynfield01 TYPE dynfnam   VALUE  'S_LOKKT-LOW',
    c_dynfield02 TYPE dynfnam   VALUE  'S_LOKKT-HIGH'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_lokkt-low.
      v_fname    = c_fname01.
      v_dynfield = c_dynfield01.
      PERFORM f_get_help
      USING v_fname
                 v_dynfield.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_lokkt-high.
      v_fname01    = c_fname02.
      v_dynfield01 = c_dynfield02.
      PERFORM f_get_help
      USING v_fname01
                 v_dynfield01.
    FORM f_get_help USING fp_v_fname    TYPE fieldname
                          fp_v_dynfield TYPE dynfnam.
    TYPES:
    BEGIN OF ty_f4_tab,
      data type char2,               
    END OF ty_f4_tab. 
    DATA:
    l_it_return TYPE STANDARD TABLE OF ddshretval,
    l_wa_return TYPE ddshretval,
    l_it_f4_tab TYPE STANDARD TABLE OF ty_f4_tab,
    l_wa_f4_tab TYPE ty_f4_tab,
    l_v_program TYPE sy-repid,
    l_v_dynnr   TYPE sy-dynnr.
    CONSTANTS: c_s    TYPE char1 VALUE 'S'.
    * Populate the hardcoded values here
    l_wa_f4_tab-data = 'AA'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
    l_wa_f4_tab-data = 'AB'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
    l_wa_f4_tab-data = 'AC'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
    l_wa_f4_tab-data = 'AD'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
      l_v_program = sy-repid.
      l_v_dynnr   = sy-dynnr.
    *Function module used to display F4 help in the selection-screen
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = fp_v_fname
          dynpprog        = l_v_program
          dynpnr          = l_v_dynnr
          dynprofield     = fp_v_dynfield
          value_org       = c_s
        TABLES
          value_tab       = l_it_f4_tab
          return_tab      = l_it_return
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
      IF sy-subrc NE 0.
        CLEAR l_it_f4_tab.
      ELSE.
        READ TABLE l_it_return INTO l_wa_return INDEX 1.
        IF sy-subrc = 0.
          fp_v_fname =  l_wa_return-fieldval.
        ENDIF.
      ENDIF.
    ENDFORM.
    Hope this is clear.
    BR,
    Suhas
    Edited by: Suhas Saha on Dec 18, 2008 2:18 PM

  • One search help for multiple select-options in webdynpro abap

    Hi,
    I need a way to use one search help for multiple select-options fields. My scenario is :
    I have a table for keeping different organizational units' values of different systems. I have pasted some sample data from this table at the end of this mail. On the screen I want to have 1 select-options filed for werks, and 1 select-options filed for vkorg. (In fact I will have more org. unit fields...) In the beginning of my application the user will select sid.
    If the user selects ADS as SID, when he opens search-help for the first org. unit (werks), he will see the records with SID: ADS, VARBL = $WERKS, LANGU = SY-LANGU.
    If the user selects AGT as SID, when he opens search-help for the second org. unit (vkorg), he will see the records with SID: AGT, VARBL = $VKORG, LANGU = SY-LANGU.
    I have created a search-help taking SIDD, VARBL and LANGU as import parameters; used field mapping and bound this search help to my table. I have created 2 context nodes : org1 and org2 having attributes SID, VARBL, VALUE, LANGU .
    I have assigned related SID, VARBL and Langu values to these attributes at runtime as I needed. That way, if I use input field and reference to the related context attributes org1-value and org2-value2 accordingly, search help works well as I want.
    However, when I use select-options field , I can not bind the field to the context data. I can give reference only to ddic structure. Is there any way to reference to a context attribute? I searched for this in SDN, but could find nothing.
    I think I won't be able to use this way. What do you say?
    As I read from forums maybe using OVS help will be suitable for me. But I have to use one search-help for all select-options fields. Do you know how I can determine the active select-options field and pass its name (for instance "werks" ) as parameter to this OVS search help. (Also I'll pass SID and LANGU.)
    MY TABLE (ZBYYT080) CONTENTS:
    SID     VARBL     VALUE     LANGU     VTEXT
    ADS     $WERKS     1     T     Werk 0001
    ADS     $WERKS     11     T     OZYAS  GIDA URETIM YERI
    ADS     $WERKS     5501     T     BOYA GEBZE FABRİKASI
    ADS     $WERKS     5502     T     BOYA CIGLI FABRİKASI
    AGT     $WERKS     2301     T     KAMLI DAMIZLIK
    AGT     $WERKS     9601     T     PANAR DENIZ URETIM YERI
    ADS     $VKORG     22     T     AA KİMYASALLAR
    ADS     $VKORG     8001     T     İINSAAT BOYALARI
    AGT     $VKORG     6500     T     DAMk St.Org
    AGT     $VKORG     5400     T     PANAR St.Org.
    I wish I'm clear enough..
    I will be gald if someone answers me as soon as possible...
    Thanks İn advance..
    MERAL

    Hi,
    Your ques is how to refer to a DDIC search help to refer to selection screen parameter ?
    Am I right ?
    If Yes, then in the interface IF_WD_SELECT_OPTIONS
    method ADD_SELECTION_FIELD, ADD_PARAMETER_FIELD etc
    have importing param like I_VALUE_HELP_TYPE and  I_VALUE_HELP_ID, I_VALUE_HELP_MODE, I_VALUE_HELP_STRUCTURE
    etc which may help you to link your create DDIC Search help to selection screen params.
    this is just a clue from my side. I haven't tried it myself.
    You can go to the where used list of this method and find some sample implementations which use these params.
    Hope this helps.
    Regards
    Manas Dua

  • F4 Help for the selection screen field

    Hi Gurus,
    I have to display F4 help for a selection screen field. i am using following code:
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
             EXPORTING
                  retfield        = 'CODE'
                  dynpprog        = lw_repid
                  dynpnr          = sy-dynnr
                  VALUE_ORG       = 'S'
             TABLES
                  value_tab       = gi_text
                 field_tab       = li_fields_tab
                  return_tab      = pi_return_tab
             EXCEPTIONS
                  parameter_error = 1
                  no_values_found = 2
                  OTHERS          = 3.
    My internal table gi_emp has two fields CODE & TEXT. When i select 1 particular value, it returns the CODE value in the pi_return_tab table.
    But my requirement is i have to capture the corresponding TEXT value for the Returned CODE. Ex: following is the F4 help being displayed: -
    001    test
    001    test1
    but is i select code 001(First Value), i also need to capture it's corresponding Text value. In return table pi_return_tab i have only Code value.
    Please help me out.
    Note: Based on return code i can't search into the internal table gi_code, because as shown in the example, code has multiple text.

    Sachin,
    I think this is what you need. The following code will return the key and the text (OR any other columns), if both columns are in the selection screen the selected values (both columns) will also be passed to the corresponding parameters. If you only need the text to be in the return table and not passed to the selection screen then set the parameter for text with NO-DISPLAY option.
    REPORT zktest01 .
    DATA :
      BEGIN OF value_tab OCCURS 0,
        field  LIKE e070-trkorr,
        text   LIKE e07t-as4text,
      END OF value_tab.
    DATA: t_fldtab LIKE dfies OCCURS 0 WITH HEADER LINE,
          t_rettab LIKE ddshretval OCCURS 0 WITH HEADER LINE,
          t_dynmap LIKE dselc OCCURS 0 WITH HEADER LINE.
    PARAMETERS : p_field  LIKE value_tab-field,
                 p_text   LIKE value_tab-text. "NO-DISPLAY.
    INITIALIZATION.
      t_fldtab-tabname   = 'VALUE_TAB'.
      t_fldtab-fieldname = 'FIELD'.
      t_fldtab-langu     = 'E'.
      t_fldtab-position  = 1.
      t_fldtab-offset    = 0.
      t_fldtab-fieldtext = 'Key'.
      t_fldtab-reptext   = 'Key'.
      t_fldtab-leng      = 20.
      t_fldtab-intlen    = 20.
      t_fldtab-outputlen = 20.
      t_fldtab-datatype  = 'CHAR'.
      t_fldtab-inttype   = 'C'.
      t_fldtab-headlen   = 20.
      t_fldtab-keyflag   = 'X'.
      t_fldtab-lowercase = ' '.
      APPEND t_fldtab.
      t_fldtab-tabname   = 'VALUE_TAB'.
      t_fldtab-fieldname = 'TEXT'.
      t_fldtab-position  = 2.
      t_fldtab-offset    = 20.
      t_fldtab-fieldtext = 'Text'.
      t_fldtab-reptext   = 'Text'.
      t_fldtab-leng      = 60.
      t_fldtab-intlen    = 60.
      t_fldtab-outputlen = 60.
      t_fldtab-headlen   = 60.
      t_fldtab-keyflag   = ' '.
      t_fldtab-lowercase = ' '.
      APPEND t_fldtab.
      value_tab-field = '101'.
      value_tab-text = 'dddd'.
      APPEND value_tab.
      value_tab-field = '202'.
      value_tab-text = 'aaaa'.
      APPEND value_tab.
      t_dynmap-fldname = 'FIELD'.
      t_dynmap-dyfldname = 'P_FIELD'.
      APPEND t_dynmap.
      t_dynmap-fldname = 'TEXT'.
      t_dynmap-dyfldname = 'P_TEXT'.
      APPEND t_dynmap.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'FIELD'
                dynpprog        = 'ZKTEST01'
                dynpnr          = '1000'
                dynprofield     = 'P_FIELD'
                value_org       = 'S'
           TABLES
                field_tab       = t_fldtab
                value_tab       = value_tab
                return_tab      = t_rettab
                dynpfld_mapping = t_dynmap
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc EQ 0.
      ENDIF.
    START-OF-SELECTION.
    Jeffrey Satriadi

  • Help on a selection screen

    I need some help on a selection screen.  I have the following:
    SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
    PARAMETERS:       p_bldat TYPE bkpf-bldat OBLIGATORY DEFAULT sy-datum,
                      p_budat TYPE bkpf-budat OBLIGATORY DEFAULT sy-datum,
                      p_xref1 TYPE proj-pspid OBLIGATORY,
                      p_bktxt TYPE bkpf-bktxt,
                      p_bukrs TYPE bkpf-bukrs OBLIGATORY DEFAULT '1100',
                      p_waers TYPE bkpf-waers OBLIGATORY DEFAULT 'USD'.
    SELECTION-SCREEN: END OF BLOCK a1.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
    PARAMETERS:       p_lifnr TYPE ekko-lifnr OBLIGATORY,
                      p_ebeln TYPE ekko-ebeln OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK b1.
    SELECTION-SCREEN: BEGIN OF BLOCK c1 WITH FRAME TITLE text-003.
    PARAMETERS:       p_amt TYPE wrbtr,
                      p_ret  TYPE wrbtr.
    SELECTION-SCREEN: END OF BLOCK c1.
    SELECTION-SCREEN: BEGIN OF BLOCK d1 WITH FRAME TITLE text-004.
    PARAMETERS:       p_cmode  TYPE callmode DEFAULT 'N' OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK d1.
    AT SELECTION-SCREEN ON p_ebeln.
      SELECT SINGLE kwert INTO p_ret FROM zretention WHERE ebeln = p_ebeln AND ebelp = '00000' AND TYPE = 'C'.
      IF NOT sy-subrc = 0 OR p_ret IS INITIAL.
        CONCATENATE 'Purchase Order' p_ebeln 'does not have any retention available for release!' INTO d_string.
        MESSAGE d_string TYPE 'E'.
      ENDIF.
    AT SELECTION-SCREEN.
      check p_ret is not INITIAL.
      IF p_amt > p_ret.
        MESSAGE 'Amt. To Be Released is more than the remaining retention. Please check your input.' TYPE 'E'.
      ELSEIF p_amt IS INITIAL.
        MESSAGE 'Amt. To Be Released is required. Please check your input.' TYPE 'E'.
      ENDIF.
    What I want is for the parameter p_ret to be populated when the user inputs a PO (p_ebeln).  This seems to work except I want this to be brought in without running through the other checks (AT SELECTION-SCREEN).  In order to bring in p_ret I am having to hit ENTER which will trigger the event AT SELECTION-SCREEN.
    How can I bring in p_ret without triggering the event AT SELECTION-SCREEN?
    Regards,
    Davis

    In this case.
    If you don't want at selection-screen to be triggered on hitting enter, you can give an if condition in at selection-screen.
    tables : sscrfields.
    AT SELECTION-SCREEN ON p_ebeln.
      SELECT SINGLE kwert INTO p_ret FROM zretention WHERE ebeln = p_ebeln AND ebelp = '00000' AND TYPE = 'C'.
      IF NOT sy-subrc = 0 OR p_ret IS INITIAL.
        CONCATENATE 'Purchase Order' p_ebeln 'does not have any retention available for release!' INTO d_string.
       clear sscrfield-ucomm.
        MESSAGE d_string TYPE 'E'.
      ENDIF.
    AT SELECTION-SCREEN.
    if sscrfields-ucomm = 'ONLI'.
      check p_ret is not INITIAL.
      IF p_amt > p_ret.
        MESSAGE 'Amt. To Be Released is more than the remaining retention. Please check your input.' TYPE 'E'.
      ELSEIF p_amt IS INITIAL.
        MESSAGE 'Amt. To Be Released is required. Please check your input.' TYPE 'E'.
      ENDIF.
    endif.
    The code in at selection-screen is executed only when user presses F8. on pressing 'Enter' it will not be executed.
    Hope this helps you.
    Regards,
    Siddarth

Maybe you are looking for

  • SQL Command code for multiple value string parameter

    Hi, I'm using crystal 2008 and there is a check box for multiple value  SQL Command  I need some help in writing the SQL Command code  for oracle (or sql server) for a multiple value STRING  parameter. Thanks in advance, Marilyn

  • X3-02 Update FirmWare V6.00

    Hello Guys, Do AnyOne Of You Still HAd Not Recieved The X3-02 Firmware V6.00? I Had Been Waiting For 3 Months And Still Stuck At V5.60. Help!!! MODERATOR'S NOTE: Post edited to remove reference link for a third party website which offers unauthorised

  • Trying to buy book. Hit buy, enter Apple ID and password. Note says this email is not available. What to do?

    I Am simply trying to download an audiobook. I have done this many times with books and music. I had forgotten my password so I reset that. I click on the book, click buy, enter Apple ID and new password. A pop up tells me I have not verified my acco

  • Error opening photoshop

    Hello there , I have problem opening adobe photoshop , whenever I try to open photoshop or open any image with photoshop it gives me same error : not a valid win32  application , i tried everything , tried opening as administrator but same error ever

  • BUGS - Mine or "Ours" - Share & Compare Your Suspected Bugs.

    Plenty of bugs are to be expected with any significant software upgrade, and to be an early adopter is to welcome such little devils into your digital workflow. One of the best things to do is to take an extra 20 seconds and type a snippet into the A