Search help behavior  with user exit

When a search help is executed you get a result (that appears in the internal table record_tab that satisfies your selection criteria. If, without leaving the search help, you enter a new selection it can return an entirely different set of records. That is the normal behavior and what users expect.
However, I do some processing in the CALLCONTROL-STEP = 'DISP' that pares down the result set in record_tab based on the users authorization. When I return to another selection it operates on the pared down result set in record_tab and does not make another selection. i.e. record_tab is not refereshed for the new selection. I am clearly doing something wrong.
This is the specific case:  Users are limited to customers in their specific sales group defined in KNVV-VKGRP. I use an exit in search help DEBIS to check whether the user is authorized for the sales group. A user is authorized for users in group 001 and 042. There first selection is from sales group 001. It returns 50 records. They decide that they chose the wrong group so they select sales group 042. It returns 0 records. However, had they selected from group 042 from the outset they would have had two hits. The second pass is working on the selection set from the first pass. (or so it seems)
Any thoughts?

Hi Corwin
<REMOVED BY MODERATOR>
FUNCTION z_shlp_exit_bpartner_reltyp.
*"*"Local Interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCT
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" VALUE(SHLP) TYPE SHLP_DESCR
*" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
DATA: rc LIKE sy-subrc,
dialog_canceled TYPE c,
lc_bp_shlp_badi TYPE funcname VALUE 'BUP_SHLP_EXIT_BADI'.
TYPES: BEGIN OF ls_view.
INCLUDE STRUCTURE but050.
TYPES: END OF ls_view.
DATA: lt_view TYPE STANDARD TABLE OF ls_view,
wa_view TYPE ls_view.
DATA: wa_shlp LIKE LINE OF shlp-fielddescr.
CALL FUNCTION 'F4UT_OPTIMIZE_COLWIDTH'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
CHANGING
shlp = shlp
callcontrol = callcontrol.
*------ Rolle auf jeden Fall als Mußfeld ------------------------------
CALL FUNCTION 'F4UT_PARAMETER_REQUIRED'
EXPORTING
parameter_required = 'RELTYP'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
CHANGING
shlp = shlp
callcontrol = callcontrol.
* STEP SELONE (Select one of the elementary searchhelps)
* This step is only called for collective searchhelps. It may be used
* to reduce the amount of elementary searchhelps given in SHLP_TAB.
* The compound searchhelp is given in SHLP.
* If you do not change CALLCONTROL-STEP, the next step is the
* dialog, to select one of the elementary searchhelps.
* If you want to skip this dialog, you have to return the selected
* elementary searchhelp in SHLP and to change CALLCONTROL-STEP to
* either to 'PRESEL' or to 'SELECT'.
IF callcontrol-step = 'SELONE'.
* PERFORM SELONE .........
EXIT.
ENDIF.
* STEP PRESEL (Enter selection conditions)
* This step allows you, to influence the selection conditions either
* before they are displayed or in order to skip the dialog completely.
* If you want to skip the dialog, you should change CALLCONTROL-STEP
* to 'SELECT'.
* Normaly only SHLP-SELOPT should be changed in this step.
IF callcontrol-step = 'PRESEL'.
*--... Datendeklartionen.
CLASS cl_exithandler DEFINITION LOAD.
DATA: lv_exit_object TYPE REF TO if_ex_bupa_augrp, "#EC NEEDED
ls_auth_selopt TYPE ddshselopt,
lt_auth_selopt TYPE TABLE OF ddshselopt WITH DEFAULT KEY.
CALL FUNCTION 'F4UT_PARAMETER_REQUIRED'
EXPORTING
parameter_required = 'RELTYP'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
CHANGING
shlp = shlp
callcontrol = callcontrol.
* Call "AUGRP" badi
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = lc_bp_shlp_badi
EXCEPTIONS
function_not_exist = 1
OTHERS = 2.
IF sy-subrc EQ 0.
CALL FUNCTION lc_bp_shlp_badi
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
CHANGING
shlp = shlp
callcontrol = callcontrol.
rc = sy-subrc.
ENDIF.
EXIT.
ENDIF.
* STEP SELECT (Select values)
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
IF callcontrol-step = 'SELECT'.
DATA: BEGIN OF ls_result,
partner LIKE but000-partner,
weekday LIKE crmm_tour_i-weekdayfrom,
terr_id LIKE crmm_territory-terr_id,
mc_name1 LIKE but000-mc_name1,
mc_name2 LIKE but000-mc_name2,
reltyp LIKE but050-reltyp,
partner2 LIKE but000_td-partner,
city LIKE adrc-city1,
post_code1 LIKE adrc-post_code1,
tel_number LIKE adrc-tel_number,
region LIKE adrc-region,
END OF ls_result.
* Local Variables
DATA: lv_resultcount TYPE i,
lv_adrno TYPE but020-addrnumber,
lv_name1 TYPE but000-mc_name1,
lv_name2 TYPE but000-mc_name2,
lv_pc TYPE adrc-post_code1,
lv_tele TYPE adrc-tel_number,
lv_guid TYPE but000-partner_guid,
lv_last TYPE adrc-name1,
lv_first TYPE adrc-name2,
lv_region TYPE adrc-region,
lv_city1 TYPE adrc-city1,
lv_trguid TYPE crmm_territory-terr_guid.
* Local Tables
DATA: ls_ddshselop TYPE ddshselopt,
lt_ddshselops TYPE ddshselops,
lt_result LIKE STANDARD TABLE OF ls_result,
wa_result LIKE ls_result.
* Ranges
RANGES: lr_reltyp FOR but050-reltyp,
lr_partner FOR but000-partner,
lr_name1 FOR but000-mc_name1,
lr_name2 FOR but000-mc_name2,
lr_region FOR adrc-region,
lr_city FOR adrc-city1,
lr_tele FOR adrc-tel_number,
lr_pc FOR adrc-post_code1.
SELECT rltyp FROM z_bupar_td INTO TABLE lt_view.
lt_ddshselops = shlp-selopt.
LOOP AT lt_ddshselops INTO ls_ddshselop.
CASE ls_ddshselop-shlpfield.
WHEN 'RELTYP'.
MOVE-CORRESPONDING ls_ddshselop TO lr_reltyp.
APPEND lr_reltyp.
WHEN 'PARTNER'.
MOVE-CORRESPONDING ls_ddshselop TO lr_partner.
APPEND lr_partner.
WHEN 'MC_NAME1'.
MOVE-CORRESPONDING ls_ddshselop TO lr_name1.
APPEND lr_name1.
WHEN 'MC_NAME2'.
MOVE-CORRESPONDING ls_ddshselop TO lr_name2.
APPEND lr_name2.
WHEN 'REGION'.
MOVE-CORRESPONDING ls_ddshselop TO lr_region.
APPEND lr_region.
WHEN 'CITY'.
MOVE-CORRESPONDING ls_ddshselop TO lr_city.
APPEND lr_city.
WHEN 'TEL_NUMBER'.
MOVE-CORRESPONDING ls_ddshselop TO lr_tele.
APPEND lr_tele.
WHEN 'POST_CODE1'.
MOVE-CORRESPONDING ls_ddshselop TO lr_pc.
APPEND lr_pc.
ENDCASE.
ENDLOOP.
SELECT * FROM but050 INTO TABLE lt_view
WHERE reltyp IN lr_reltyp
AND partner1 IN lr_partner.
LOOP AT lt_view INTO wa_view.
wa_result-partner = wa_view-partner1.
wa_result-reltyp = wa_view-reltyp.
*___ adress details
SELECT SINGLE addrnumber FROM but020 INTO lv_adrno
WHERE partner EQ wa_result-partner.
SELECT SINGLE post_code1 tel_number name1 name2 region city1 FROM adrc
INTO (lv_pc , lv_tele, lv_last, lv_first, lv_region, lv_city1)
WHERE addrnumber EQ lv_adrno AND region IN lr_region
AND city1 IN lr_city AND tel_number IN lr_tele
AND post_code1 IN lr_pc.
*___ names
SELECT SINGLE mc_name1 mc_name2 FROM but000
INTO (lv_name1 , lv_name2)
WHERE partner IN lr_partner
AND mc_name1 IN lr_name1
AND mc_name2 IN lr_name2.
*___ CRM patner guid
SELECT SINGLE partner_guid FROM but000
INTO lv_guid
WHERE partner EQ wa_result-partner.
*___ Territory guid
SELECT SINGLE terr_guid FROM crmm_territory_v
INTO lv_trguid
WHERE guid EQ lv_guid.
SELECT SINGLE terr_id FROM crmm_territory
INTO wa_result-terr_id
WHERE terr_guid EQ lv_trguid.
*__ weekfrom
SELECT SINGLE weekdayfrom FROM crmm_tour_i
INTO wa_result-weekday
WHERE guid EQ lv_guid.
wa_result-post_code1 = lv_pc.
wa_result-tel_number = lv_tele.
wa_result-mc_name1 = lv_name1.
wa_result-mc_name2 = lv_name2.
wa_result-partner2 = lv_first.
wa_result-region = lv_region.
wa_result-city = lv_city1.
APPEND wa_result TO lt_result.
lv_resultcount = lv_resultcount + 1.
IF lv_resultcount GE callcontrol-maxrecords.
EXIT.
ENDIF.
CLEAR: lv_pc,lv_tele,lv_name1,lv_name2,lv_first,lv_region,lv_city1.
CLEAR: wa_view, wa_result.
ENDLOOP.
* Prepare for output
CALL FUNCTION 'F4UT_RESULTS_MAP'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_result
CHANGING
shlp = shlp
callcontrol = callcontrol
EXCEPTIONS
illegal_structure = 1
OTHERS = 2.
IF rc = 0.
callcontrol-step = 'DISP'.
ELSE.
callcontrol-step = 'EXIT'.
ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
* STEP DISP (Display values)
* This step is called, before the selected data is displayed.
* You can e.g. modify or reduce the data in RECORD_TAB
* according to the users authority.
* If you want to get the standard display dialog afterwards, you
* should not change CALLCONTROL-STEP.
* If you want to overtake the dialog on you own, you must return
* the following values in CALLCONTROL-STEP:
* - "RETURN" if one line was selected. The selected line must be
* the only record left in RECORD_TAB. The corresponding fields of
* this line are entered into the screen.
* - "EXIT" if the values request should be aborted
* - "PRESEL" if you want to return to the selection dialog
* Standard function modules F4UT_PARAMETER_VALUE_GET and
* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
IF callcontrol-step = 'DISP'.
* PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL.
EXIT.
ENDIF.
ENDFUNCTION.
Edited by: Alvaro Tejada Galindo on Jan 24, 2008 4:32 PM

Similar Messages

  • Please help me with user-exits or baids for TCode : FOE2 & FOE1

    Hi  Experts
    Please help me with user-exits or baids for TCode : FOE2 & FOE1.
    I found these but not picking values from VIMI01,VIOB03 and VIOB41.
    User-exits
    FVCH0001                                CH-specific enhancements: Esp. POR
    ISRE0001                                Determine bank procedure account no.
    ISRE0002                                IPD reporting data retrieval
    Business Add-in
    FVD_HANDLE_FORMULA                      Processing of Condition Formulas

    Hi,
    ASk your basis regarding the CI_CSKB table active issue, and first of all i dont see any table with the name CI_CSKB.
    And check this exit-COOMKS03 whether it works for your screen exits.
    Cheers!!
    VEnk@
    Edited by: Venkat Reddy on Nov 4, 2008 5:59 PM

  • Help required with User exit logic

    Hi gurus,
    Please help me with the logic I wrote for the user exit for a PP Work Center View extract structure. Here is the details of the add on fields: VGW01, VGW02, VGW03, STEUS(from table PLPO); DataSource: 2LIS_04_P_ARBPL,
    data: l_s_pp1 like MC04P_0ARB(extract structure of 2LIS_04_P_ARBPL),
    l_tabix like sy-tabix,
    lv_VGW01 like PLPO-VGW01.
    lv_VGW02 like PLPO-VGW02.
    lv_VGW03 like PLPO-VGW03.
    lv_STEUS like PLPO-STEUS.
    tables : PLPO.
    case i_datasource.
    when '2LIS_04_P_ARBPL'.
    loop at c_t_data into l_s_pp1.
    select single vgw01into lv_vgw01
    from PLPO
    where field = l_s_pp1-field.
    if sy-subrc = 0.
    l_s_pp-zzvgw01 = lv_vgw01.
    l_s_pp-zzvgw02 = lv_vgw02.
    l_s_pp-zzvgw03 = lv_vgw03.
    l_s_pp-zzsteus  = lv_steus.
    endif.
    modify c_t_data from l_s_pp1 index l_tabix.
    endloop.
    Any additional comments welcome. Thanks in advance.

    Hi,
    Try coding as per the below code
    case i_datasource.
      When '2LIS_04_P_ARBPL'.
      DATA: lt_data TYPE TABLE OF MC04P_0ARB.
      FIELD-SYMBOLS: <ls_data> TYPE MC04P_0ARB.
    Internal table for
      TYPES:
            BEGIN OF ty_tbl1,
                     lv_VGW01 TYPE PLPO-VGW01,
                     lv_VGW02 TYPE PLPO-VGW02,
                     lv_VGW03 TYPE PLPO-VGW03,
                     l_bmsch  TYPE XXXX-XXXX,
                     l_plnnr  TYPE XXXX-XXXX
                     l_datuv  TYPE XXXX-XXXX
                     l_aennr  TYPE XXXX-XXXX
                     l_plnkn  TYPE XXXX-XXXX
                     l_plnal  TYPE XXXX-XXXX
            END OF ty_tbl1.
      DATA:
             lt_tb1 type standard table of ty_tbq,
             ls_tb1 type ty_tb1.
      lt_data[] = c_t_data[].
    Read data into internal memory using jOins
      select aVGW01 aVGW02 aVGW02 aVGW02 bbmsch bplnnr bdatuv baennr bplnkn bplnal into into  CORRESPONDING FIELDS OF TABLE
      lt_tb1 from PLPO as a innerjoin XXXX as b where aXXXX=bXXXX.        
    use the internal table to get the data to the enhaced fileds
    LOOP AT lt_data ASSIGNING <ls_data>.
        read table lt_tb1 into ls_tb1
             with key XXXXX = <ls_data>-XXXX .
        if sy-subrc eq 0.
          <ls_data>-lV_VGW01 = ls_tb1-lv_VGW01,
          <ls_data>-lV_VGW02 = ls_tb1-lv_VGW02,
          <ls_data>-lV_VGW03 = ls_tb1-lv_VGW03,
          <ls_data>-bmsch    = ls_tb1-bmsch,
          <ls_data>-plnnr    = ls_tb1-plnnr,
          <ls_data>-datuv    = ls_tb1-datuv,
          <ls_data>-aennr    = ls_tb1-aennr,
          <ls_data>-plnkn    = ls_tb1-plnkn,
          <ls_data>-pln1l    = ls_tb1-plnal.
          MODIFY lt_data FROM <ls_data>.
        endif.
      ENDLOOP.
      REFRESH c_t_data.
      c_t_data[] = lt_data[].
    Note that the code is not written with the exact fields. Change the fields where necessary(also i have joined only 2 tables if needs to be joind form more than 2  table change the join statement accordingly).
    Thanks,
    Nagarjuna
    Edited by: Nagarjuna Reddy on Oct 20, 2011 3:39 AM

  • Please help me with user exits

    I am getting an error message as   "*Table CI_CSKB is not an active table*"
    while executing trxn ka01. Also i have to write screen exit for the same . Suggest some help in the form of documentation or solution .
    thankx in advance
    Please use a meaningful subject in your future posts

    Hi,
    ASk your basis regarding the CI_CSKB table active issue, and first of all i dont see any table with the name CI_CSKB.
    And check this exit-COOMKS03 whether it works for your screen exits.
    Cheers!!
    VEnk@
    Edited by: Venkat Reddy on Nov 4, 2008 5:59 PM

  • Search Help in a Field Exit

    Hi all, i would like to know if it is possible to put a search help in a Field exit or if there is some other way to create a searh help for a standard field of a standard trax. the Search help i need is for a <b>date</b> that is not contemplated by SAP.
    Reward points guaranteed!!!!!thanks in advance, sorry for my bad English

    For example i have the field section in fch5. as it did not use that field (char 10) i was needing to input a date that was not contemplated by SAP. So i use this field 'section' to do this. this field has a field exit that validate the date, because it is a char field. i did this with FM RP_CHECK_DATE, so if the user enter 12.56.2006 an E message is displayed. My question is: is it possible to put a search help of date in that field?
    thank all.

  • Valuation price with user exit/BADI/Enhancement Spot (In valuation variant)

    Hi all,
    i am facing problem finding enhancement when creation of sales order of Valuation price with user exit/BADI/Enhancement Spot  (In valuation variant)
    For refferenece:
    When going to t.code VA03, select one item and go to extras in the menu bar and select costing then you find some amounts calculation i.e valuation price automatically.
    So when creation of sales order i am giving material and that material price automatically takes from material master and creating sales order.
    My customer requirement is to get the valuation price of the input material from Z-table during the sales order cost estimate.
    This Z-table contains the material code, plant , grade  of the material.
    Ex:
    Material         Plant   Grade Price
    A                1000    XYZ     25000
    A                1000    PQR     35000
    A                1000    BCD     45000
    Suppose it depends on sales document type and which grade price i have to take.
    So first of all i am unable to find enhancement where to change this code to get change the valuation price.
    Does anybody have any idea , is there any user exit/BADI/enhancement for this.
    So please help me in this issue.
    Thanks & Regards,
    lokeshgoud

    pls allow me to post the questions

  • Valuation price with user Exit on activity types

    Hi All,
    Our customer could have different activity cost for different products even if they are processed on the same cost center, same activity type and same activity time. So I wonder whether SAP has valuation price with user Exit on activity types as what on material valuation, when we select "U" in the relevant valuation variant. Could anyone knows advise please?
    Regards
    Walter

    Hi Walter,
    an idea might be to include an ABC template into the costing. ABC tempaltes allow a big degree of freedom in determinin which processes to use and in which quantities. To use the product as a cost driver is certainly not an issue. I doubt that you can directly influence the process 'price' to be applied, but to change the quantity could bring the same result.
    See the docu for more info:
    [http://help.sap.com/saphelp_erp60_sp/helpdata/en/7e/cb7d1443a311d189ee0000e81ddfac/frameset.htm]
    best regards,
                        Udo

  • Formula variable with User Exit

    Hi,
    Can we create a Formula Variable of processing type USER EXIT...which will display a constant Value Y
    Any syntax would be helpful
    Thanks

    Hi,
    check this for formula variables with user exits;
    http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw/customer-exit-to-derive-formula-variable-to-text-variable-sap-bw-35-3030684
    Also Check the issues and solution :
    Formula Variable with User Exit....Problem
    Thanks
    Hemav

  • Difference between the different structures while dealing with User-Exits

    While dealing with User-Exits, we come across the different structures/Tables like XVBAP,YVBAP,TVBAP,IVBAP,*VBAP....
    What is the difference between them ?

    Usually X<tablename> and Y<tablename> are used in change document management to determine records updated (Y is old values and X new ones).  (Look at transaction SCDO)
    T<tablename is an internal table read from database and I<tablename> is an import table parameter of the same structure. <tablename> is an equivalent of <tablename> declared with statement TABLES and contains usually the "old" value.
    Look at exit documentation. start at [User Exits In Sales Document Processing|http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm]
    Regards

  • MRP Run with User Exit key for Follow up material

    Dear Gurus,
    I want to run MRP only for followup materials by using User exit key. For example i have a material X(with discontinued Indicator as 1) and it's follow material is Y.
    So we have a user exit key as ZFL, with coding as shown below. Now when i run MD01 with user exit key ZFL and parametre as 1, it only runs MRP for material X and not for material Y. What else we need to do so that when i run MD01 with user exit key ZFL, it shoudl consider both X and Y. 
    WHEN 'ZFL'.
    DATA : BEGIN OF ITAB5 OCCURS 0,
    KZAUS LIKE MT61D-KZAUS,
    END OF ITAB5.
    TRANSLATE USER_PAR TO UPPER CASE.
    SPLIT USER_PAR AT ',' INTO TABLE ITAB5.
    IF ITAB5[] IS INITIAL.
    EXIT.
    ENDIF.
    CLEAR: NO_PLANNING, STOP_PLANNING.
    READ TABLE ITAB5 WITH KEY KZAUS = MT61D-KZAUS.
    IF SY-SUBRC <> 0.
    NO_PLANNING = 'X'.
    ENDIF. 

    Hi Kumar,
         You can use either MRP Type, MRP Controller, MRP Group in this user exit to control the MRP run. For these set of Materials you have to assign any of same value or at least differentiate these material from other material. Then only you can control the MRP by using this user exit even though if you use different MRP Group and MRP Controller. In User Exit, you may have to add your dependent material's MRP Group/MRP Controller. Make sure that these set of materials are different than all other materials.
    If you don't have any plan to run MRP for other materials then as per Ajit suggestion you make that material's MRP type as "ND". But, in your business case they may want to activate the MRP for all the material not now but may be latter.
    Thanks

  • Issue with user exit ZXPADU01 and ZXPADU02

    Hi,
    I am trying to change the existing record for the info type 0015 for an employee in Pa30 transaction.
    my requirement is i need old value and new value when i am changing the existing record in info type 0015.
    When i kept break point in user exit ZXPADU01 it is not triggering it is triggering only when we creating the record.
    i tried with user exit ZXPADU02 it is not working as per my requirement.
    My requirement is :whenever i am changing the existing record(modifying record) i need old value and new value.
    Anybody can suggest me how to fix this issue.
    Thanks,
    Maheedhar

    Dear Maheedhar,
    The best way to achieve this requirement is to use the PAI user exit ZXPADU02 import parameter PSAVE. The PSAVE parameter contains the PBO original / initial record, before any changes take place.
    The INNNN parameter contains the current PAI record as usual, in order to be used for customer check and new values. Thus, you've got both the old and the new record in place, and you can make your comparison according to the business requirements:

  • BPS Help with user exit.----- Quick one for Marc.B?

    Hi All,
           I'm using an user exit to prefix the GL/account with '2' to make it a stat account.In the fields to be changed , i have included all the characteristics like gl account,region,line of business...key fig name..etc.However when i run the exit, my key figure amount is doubling up.Need a quick fix or a second pair of eyes..also found that xth_data cannot be used in MODIFY statement because of hash table .so I'm using a collect.But as soon as i exit out of the loop, the key figure amount doubles....any pointers????
    Here is the code.................................
    FUNCTION Z_SEM_PREFIX_2ACCOUNTS.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(I_AREA) TYPE  UPC_Y_AREA
    *"     REFERENCE(I_PLEVEL) TYPE  UPC_Y_PLEVEL
    *"     REFERENCE(I_PACKAGE) TYPE  UPC_Y_PACKAGE
    *"     REFERENCE(I_METHOD) TYPE  UPC_Y_METHOD
    *"     REFERENCE(I_PARAM) TYPE  UPC_Y_PARAM
    *"     REFERENCE(IT_EXITP) TYPE  UPF_YT_EXITP
    *"     REFERENCE(ITO_CHASEL) TYPE  UPC_YTO_CHASEL
    *"     REFERENCE(ITO_CHA) TYPE  UPC_YTO_CHA
    *"     REFERENCE(ITO_KYF) TYPE  UPC_YTO_KYF
    *"  EXPORTING
    *"     REFERENCE(ET_MESG) TYPE  UPC_YT_MESG
    *"  CHANGING
    *"     REFERENCE(XTH_DATA) TYPE  HASHED TABLE
      DATA:
        ls_data   TYPE t_s_alloc,
        lth_data  TYPE t_th_alloc.
    *Loop thru the data and check if its a valid GL account.
    *If its a valid GL account, Prefix '2' to the beginning of the
    *account and also add 'DDD' to the transaction type in order to
    *identify the record.once the prefixing is over , you will have the  old as well as the new set of records.
    *records as they will not have the 'LOB' flag in the transaction type.
      lth_data = xth_data.
      LOOP AT lth_data INTO ls_data.
        if ls_data-s_chas-0gl_account
                                    is not initial.
           if ls_data-s_chas-0gl_account+3(1) = '0' AND
             ls_data-s_chas-0gl_account+4(1) <> '0'.
              concatenate '000' '2'
              ls_data-s_chas-0gl_account+4(6)
              into ls_data-s_chas-0gl_account.
              ls_data-s_chas-zoctrtype = 'LOB'.
           endif.
       endif.
      collect ls_data into lth_data.
      ENDLOOP.
    DELETE Lth_data
            where s_chas-0gl_account+3(1) <> '2' and
                  s_chas-zbpsflag = 'C'.
      xth_data = lth_data.
    ENDFUNCTION.

    Hi Sudz,
    you got it almost right. If you do the collect the system will add the changed records to the exiting ones since you start with lth_data = xth_data. So use the following logic:
    start with empty table
    refresh lth_data.
    now process all exiting data
    LOOP AT xth_data INTO ls_data.
    if ls_data-s_chas-0gl_account is not initial.
    if ls_data-s_chas-0gl_account+3(1) = '0' AND
    ls_data-s_chas-0gl_account+4(1) <> '0'.
    concatenate '000' '2' ls_data-s_chas-0gl_account+4(6)
    into ls_data-s_chas-0gl_account.
    ls_data-s_chas-zoctrtype = 'LOB'.
    endif.
    endif.
    and collect the new data
    collect ls_data into lth_data.
    ENDLOOP.
    return only the new data
    xth_data = lth_data.
    Regards,
    Marc
    SAP NetWeaver RIG

  • Help with User Exit

    Hello,
    I am and include within a user exit and what i am trying to do is:
    populating a field that shows up in a screen popup. transaction is iw32 for which the program name is different than that of the screenvalue that im trying to populate. in iw32, in components tab, i add a component and then i get a popup to populate the purchasing group field and this is the field that i am trying to put a default value into so that I do not get prompted. Please help.
    Thanks.

    Hey Jasmeet
    You can definitely get the values of RESBD in this exit. Please use the code below to get the resbd-ingrp value from the screen:
    DATA:l_field(60)         TYPE C        VALUE '(SAPLCOMK)RESBD',
              ls_resbd          TYPE resbd. 
    FIELD-SYMBOLS: <fs_resbd>          TYPE ANY.  
    *Fetching the Component Item from the Screen. This is for read-only
    *purpose and content should not be changed.
    ASSIGN (l_field) to <fs_resbd>.
    if sy-subrc eq 0.
        ls_resbd = <fs_resbd>.
    UNASSIGN <fs_resbd>.
    endif.
    Now you have all the values in the structure ls_resbd and you can easily set the value for ingrp according to your conditions.
    Hope this helps. Let me know if this is what you want.
    cheers
    shivika

  • Help reqd on USER EXIT

    Hi all....
    I got a new object in USER EXIT for my current impl project...
    1st,i know that how to creat it in cmod but i desnt know how to do enhancement assignment and writing a code for the below requirement
    my SD consultant req is......
    IN VA01, the end user will able to enter(create std order) only 4 items(POSNR)
    at a time as maximum....(should restrict it) and if while entering the 5th item,it throws an error msg and revert back it.....
    the std program is "MV45AFZZ" ,here the enhancement assignment should be added in,inside the below sub-routine......as include program
    "Form USEREXIT_SAVE_DOCUMENT_PREPARE"...
    Endform..
    Do u people know how to do it.....if anyone have done already...pls help on this by replying with sample codes and ur helps...
    waiting for ur replies
    thanks & regards
    sankar

    Hi,
    These are standard enhancements available for VA01.
    SDAPO001 Activating Sourcing Subitem Quantity Propagation
    SDTRM001 Reschedule schedule lines without a new ATP check
    V45A0001 Determine alternative materials for product selection
    V45A0002 Predefine sold-to party in sales document
    V45A0003 Collector for customer function modulpool MV45A
    V45A0004 Copy packing proposal
    V45E0001 Update the purchase order from the sales order
    V45E0002 Data transfer in procurement elements (PRreq., assembly)
    V45L0001 SD component supplier processing (customer enhancements)
    V45P0001 SD customer function for cross-company code sales
    V45S0001 Update sales document from configuration
    V45S0003 MRP-relevance for incomplete configuration
    V45S0004 Effectivity type in sales order
    V45W0001 SD Service Management: Forward Contract Data to Item
    V46H0001 SD Customer functions for resource-related billing
    V60F0001 SD Billing plan (customer enhancement) diff. to billing plan
    this can be checkit out in 'SMOD' and find out the user exits  like screen, filed, funtionction exits etc under each enhancement which mentioned above.
    Once if you find the user exit under one enhancement let suppose 'V60F0001' go to 'CMOD' and crete one project and click on create button.
    then give the enhance ment name V60F0001 under the 'enhancement assign' componet
    Then bydefault u will get all userexits available under this enhancement select one them a/c to your require ment press on one userexit and it enter the funtion exit and double click on 'INCLUDE' it ask to create press yes then write ur won code 'ACTIVATE' and come back and 'ACTIVATE' and come backe 'ACTIVATE'  and come to initial screen ie 'CMOD' and press 'ACTIVATE' button.
    this is the way how to create user exit.
    There are some exit for checking order
    User exits in the program MV45AFZZ :
    USEREXIT_SAVE_DOCUMENT_PREPARE
    Use this user exit to make certain changes or checks immediately before saving a document. It is the last possibility for changing or checking a document before posting.
    The user exit is carried out at the beginning of the FORM routine BELEG_SICHERN.
    User-Exits in program MV45AFZB :
    USEREXIT_CHECK_VBAK
    This user exit can be used to carry out additional checks (e.g. for completion) in the document header. The system could, for example, check whether certain shipping conditions are allowed for a particular customer group.
    USEREXIT_CHECK_VBAP
    This user exit can be used to carry out additional checks (e.g. for completion) at item level.
    etc.
    Look at User Exits in Sales Docuemnet Processing
    <a href="http://">User Exits in Sales Docuemnet Processing</a>
    <b>some of tips to find user exits  :</b>
    User Exits & Customer Exits :
         User Exits: Executed with the help of user exits (these are subroutines reserved for customers that have been inserted in objects in the SAP namespace) 'hard-coded' at various points within SAP Repository objects.
         Customer Exits :
         1. Menu Exits: Menu exits add items to the pull down menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications. These special entries have function codes that begin with "+" (a plus sign).
         2. Screen Exits: Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special sub screen areas on a standard R/3 screen and calling a customer sub screen from the standard screen’s flow logic.
         it is called by call customer- sub screen
         3.Function Module Exits :Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits. When you add a new menu item to a standard pulldown menu, you use a function module exit to define the actions that should take place once your menu is activated. Function module exits also control the data flow between standard programs and screen exit fields.
         it is called by Call Customer- function
         Go to SMOD and press F4 where you will get the options of screen, menu, function exits.
         Go to SE81 select the module which you want to check and find the       enhancement.
          In IMG (SPRO), search for enhancements in interested area.
         Go to the program or transaction and search for  “CALL CUSTOMER-FUCTION” or  “EXIT_<Progname>_nnn”
         For screen exits go to screen in SE51/SE80 search for-  “CALL CUSTOMER-SUBSCREEN..”
    <b>Reward with points if helpful.</b>
    Regards,
    Vijay

  • Help needed about user exits

    Hi frnds.
    For long time i have been searching for user exits for following txns. If any body have some idea i will appreciate it a lot.
    1.ME01(MAINTAIN SOURCE LIST)
    2.ME11(CREATE INFO RECORD)
    3.MB01(GR for PO)
    4.ME31(CREATE ONLINE AGREEMENT)
    5.ME51(CREATE PURCHASE REQUISITION)
    Waiting for your replies.
    Regards,
    Arpit

    Hi Arpit,
    You can use following code to find user-exits in any SAP standard transactions...
    Finding the user-exits of a SAP transaction code
    Enter the transaction code in which you are looking for the user-exit
    and it will list you the list of user-exits in the transaction code.
    Also a drill down is possible which will help you to branch to SMOD.
    Written by : SAP Basis, ABAP Programming and Other IMG Stuff
                 http://www.sap-img.com
    report zuserexit no standard page heading.
    tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
             tables : tstct.
    data : jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    parameters : p_tcode like tstc-tcode obligatory.
    select single * from tstc where tcode eq p_tcode.
    if sy-subrc eq 0.
       select single * from tadir where pgmid = 'R3TR'
                        and object = 'PROG'
                        and obj_name = tstc-pgmna.
       move : tadir-devclass to v_devclass.
          if sy-subrc ne 0.
             select single * from trdir where name = tstc-pgmna.
             if trdir-subc eq 'F'.
                select single * from tfdir where pname = tstc-pgmna.
                select single * from enlfdir where funcname =
                tfdir-funcname.
                select single * from tadir where pgmid = 'R3TR'
                                   and object = 'FUGR'
                                   and obj_name eq enlfdir-area.
                move : tadir-devclass to v_devclass.
              endif.
           endif.
           select * from tadir into table jtab
                         where pgmid = 'R3TR'
                           and object = 'SMOD'
                           and devclass = v_devclass.
            select single * from tstct where sprsl eq sy-langu and
                                             tcode eq p_tcode.
            format color col_positive intensified off.
            write:/(19) 'Transaction Code - ',
                 20(20) p_tcode,
                 45(50) tstct-ttext.
                        skip.
            if not jtab[] is initial.
               write:/(95) sy-uline.
               format color col_heading intensified on.
               write:/1 sy-vline,
                      2 'Exit Name',
                     21 sy-vline ,
                     22 'Description',
                     95 sy-vline.
               write:/(95) sy-uline.
               loop at jtab.
                  select single * from modsapt
                         where sprsl = sy-langu and
                                name = jtab-obj_name.
                       format color col_normal intensified off.
                       write:/1 sy-vline,
                              2 jtab-obj_name hotspot on,
                             21 sy-vline ,
                             22 modsapt-modtext,
                             95 sy-vline.
               endloop.
               write:/(95) sy-uline.
               describe table jtab.
               skip.
               format color col_total intensified on.
               write:/ 'No of Exits:' , sy-tfill.
            else.
               format color col_negative intensified on.
               write:/(95) 'No User Exit exists'.
            endif.
          else.
              format color col_negative intensified on.
              write:/(95) 'Transaction Code Does Not Exist'.
          endif.
    at line-selection.
       get cursor field field1.
       check field1(4) eq 'JTAB'.
       set parameter id 'MON' field sy-lisel+1(10).
       call transaction 'SMOD' and skip first   screen.
    *---End of Program
    Regards,
    Sriram

Maybe you are looking for

  • Song pause/skip at the beginning of each song

    I've recently been experiencing my music pausing for a second when a new song starts playing. The music will just stop playing for a short time after the song has begun. Sometimes when I quit iTunes and open it back up, the issue is resolved temporar

  • Is there any option to be set so that the multicolum​n list box column and row can't be editable on run time

    In my application i am using multicolumn list box. Usually while running the program the column width is editable. in my program i should be able to select or hightlight the row , but should not be able to edit the row or column size.Is there any pro

  • PDF Custom Annotations Types?

    Can some kind reader comment and/or point to documentation on PDF's Custom Annotation Types? I was first introduced to those by Aandi Inston's reply to my "Click to Dial Plugin" posting. Unfortunately, such posting seems to have been pulled (lost?, r

  • How to dismiss "This plug-in may require an update" warning

    Like in this thread, if a Audio unit plug-in crashes during launch, GarageBand will block that plugin, presumably until a later version is installed. An error has occured with an installed Audio Unit plug-in. GarageBand unexpectedly quit while trying

  • Sap bw thesis project

    hi everyone! I m starting to land some ideas about my thesis project that I have to present in order to apply 4 my enginner title, so considering I have 1 year experience in sap bw, i was wondering whether it'd be a good idea 2 get some thesis 'bout