Free Memory in User Exit

Hi,
We are having an issue that while doing invoicing using TCode MIRO, the invoice number gets generated and can be seen in Purchase Order History but the invoice document is not found in the system.
According to SAP Note 743744, this could be because of the command Free Memory used in SD user exits (user exits called in program SAPMV45A, can be seen using TCode SE80). In our case we have used the free memory command in a customised function module called in  USEREXIT_DELETE_DOCUMENT (Include MV45AFZZ).
1) Is it neccesary to use free memory to clear the ABAP memory. Can we use some other command like CLEAR instead of free memory?
2) Suppose if we do  not use FREE MEMORY, and then assign some value to the memory (it already had some value originally), what will happen?
Any other suggestions would also be welcome.
Thanks in advance.
Mick

Clear it will clear the variable value and header line of internal table.But not the memory value.
For that we need to use the Free Memory ID 'XXX'.
While Processing the transaction again the previous value may come. Thats the reason why we are free the memory.
Regards,
madan.

Similar Messages

  • Export internal table to memory in User Exit FM

    Hi all,
    My scenario here is to export an internal table in one user exit FM and import it back in another user exit FM.
    I was trying to use
    Export lt_table to memory id 'LABEL'.
    then
    Import lt_table from memory id 'LABEL'.
    But then i hit error in the import statement. How can I rectify this?
    Thanks. Answer will be rewarded.

    Refer to the below related threads
    Export an internal table to memory and import from memory into an internal
    http://help.sap.com/saphelp_erp2005/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm
    Regards,
    Santosh

  • Import itab in memory in user exit

    I am trying to export an internal table to memory in BADI and import from memory into an internal table in User exit . It looks like the export works, but when I import in program2, the internal table is empty. Even when the command returns sy-subrc = 0.
    Has anyone made this work?
    Program1
    DATA: wa_medoc LIKE MEASUREMENT_DOC.
    DATA: WA_TEXT LIKE LINE OF CE_MEASUREMENT.
    TYPES: BEGIN OF obj_line,
                MEASUREMENT_POINT(12) ,
                READING_DATE(8),
                READING_TIME(6),
                RECORDED_UNIT(6),
                LONG_TEXT(16384),
                END OF obj_line.
    DATA: obj_tab_wa TYPE obj_line.
    Move: MEASUREMENT_DOC to wa_medoc.
    LOOP AT CE_MEASUREMENT INTO WA_TEXT.
    MOVE:  wa_medoc-MEASUREMENT_POINt TO obj_tab_wa-MEASUREMENT_POINT,
           wa_medoc-READING_DATE  TO obj_tab_wa-READING_DATE ,
           wa_medoc-READING_TIME  TO obj_tab_wa-READING_TIME,
           wa_medoc-RECORDED_UNIT TO obj_tab_wa-RECORDED_UNIT,
           WA_TEXT-LONG_TEXT TO obj_tab_wa-LONG_TEXT.
    EXPORT obj_line FROM  obj_tab_wa  TO MEMORY ID 'SQ'.
    ENDLOOP.
    Program 2 : User exit   EXIT_SAPLIMR0_001  and include ZXMRCU01.
    TYPES: BEGIN OF obj_line,
                MEASUREMENT_POINT(12) ,
                READING_DATE(8),
                READING_TIME(6),
                RECORDED_UNIT(6),
                LONG_TEXT(16384),
                END OF obj_line.
    DATA: obj_tab_wa TYPE obj_line.
    IMPORT obj_line FROM  MEMORY ID 'SQ'.

    Try this......
    Program1
    DATA: wa_medoc LIKE MEASUREMENT_DOC.
    DATA: WA_TEXT LIKE LINE OF CE_MEASUREMENT.
    TYPES: BEGIN OF obj_line,
    MEASUREMENT_POINT(12) ,
    READING_DATE(8),
    READING_TIME(6),
    RECORDED_UNIT(6),
    LONG_TEXT(16384),
    END OF obj_line.
    DATA: obj_tab_wa TYPE obj_line.
    data: obj_tab_tab type standard table of obj_line.
    Move: MEASUREMENT_DOC to wa_medoc.
    LOOP AT CE_MEASUREMENT INTO WA_TEXT.
    MOVE: wa_medoc-MEASUREMENT_POINt TO obj_tab_wa-MEASUREMENT_POINT,
    wa_medoc-READING_DATE TO obj_tab_wa-READING_DATE ,
    wa_medoc-READING_TIME TO obj_tab_wa-READING_TIME,
    wa_medoc-RECORDED_UNIT TO obj_tab_wa-RECORDED_UNIT,
    WA_TEXT-LONG_TEXT TO obj_tab_wa-LONG_TEXT.
    append obj_tab_wa to obj_tab_tab.
    ENDLOOP.
    if sy-subrc = 0.
    EXPORT obj_tab_tab[] TO MEMORY ID 'SQ'.
    endif.
    Program 2 : User exit EXIT_SAPLIMR0_001 and include ZXMRCU01.
    TYPES: BEGIN OF obj_line,
    MEASUREMENT_POINT(12) ,
    READING_DATE(8),
    READING_TIME(6),
    RECORDED_UNIT(6),
    LONG_TEXT(16384),
    END OF obj_line.
    DATA: obj_tab_wa TYPE obj_line.
    data: obj_tab_tab type standard table of obj_line.
    IMPORT obj_tab_tab[] FROM MEMORY ID 'SQ'.
    Edited by: Joyjit Ghosh on Jul 8, 2008 2:22 PM

  • Free Goods Problem and User Exit if needed in Sales Order

    Hello All,
    The problem is related to Free Goods in Sales Order which is given with an example -
    We have maintained Free Goods ( T Code - VBN1) in inclusive scenario which is as follows -
    For 210 PAC (Pack) of Material A 18 PAC Free.
    Where 1 PAC = 20 BT (Bottle) and 20 PAC = 1 CV (Case Pack)
    In the material master of Material A the Base Unit Of Measurement (UOM) = PAC and Sales UOM = Blank so that we can use any conversion factor maintained for the material.
    The conversion factors maintained for Material A are as follows -
    1 BT = 1BT
    1 PAC = 20 BT
    1 CV = 20 PAC
    Now when we are raising sales order for 11 CV the free goods are not generated in the Sale Order.
    Again if we maintain the Sales UOM in CV and raise the sales order it is showing :
    10 CV as main item and 1 CV as Free which is wrong because in the conversion factor we have already maintained 1CV = 20 PAC , Whereas in the inclusive scenario it is given 11CV = 210 PAC and 210 PAC = 18 PAC is free.So in any case it is taking into account 2 more PACs.
    Please suggest what need to be done in this case in respect of User Exit or Source Code in ABAP if needed.
    Thanks & Regards
    Priyanka Mitra

    Hello Priyanka Mitra,
    We are facing a problem same as you.
    How did you solve this problem?
    We are very glad if you teach it concretely.
    Please advise your solution to us.
    Thanks.

  • Export to memory"  (bukrs) in one user exit and import to memory in other.

    I have to "export to memory"  (bukrs) in one user exit and import to memory in other.
    Does anyone has an example

    in one user exit:
    EXPORT field TO MEMORY ID 'Z_BUKRS'.
    in another user exit:
    IMPORT field FROM MEMORY ID 'Z_BUKRS'.
    what is the problem?

  • User Exit ..... how many line free

    Dear Experts ...
    I have learn that the number of line available to develop specific source code in a BW user exit is limited !
    Do you know how many line are available ???

    Hi,
    I am also not aware of any limitations to source codes in the routines in BW or user exits.
    regards
    Siggi

  • To find out user exit/ badi for the VT01n transaction triggered in Save

    Hi Friends,
              I have the following requirement and for this appropriate user exit/ badi should be needed which will trigger during saving of the shipment.
    Cass shipment type (VTTK-ADD03) field needs to be required and should be automatically populated upon creation of the shipment document.  The rules for populating the value (SO, ST, PO and RA) are as follows:
    If any of the orders on the shipment are customer order types, then the CASS shipment type should be a SO,
    If all of the orders are STO orders, then the Cass shipment type should be "ST",
    If all of the orders are PO orders, then the Cass shipment type should be "PO" , and
    If all of the orders are customer return orders, then the Cass shipment type should be "RA".
    I have tried with the 3 badi available and 7 to 8 user exit, but it won't work.
    Thanking a lot in advance for giving the solution.
    With Regards,
    Ajit.

    Hi,
    This code will give you all the user-exits.
    Code:
    & Report ZPJA_PM002 (Ver4) &
    & PJA Consultancy Services (www.pjas.com) &
    & This report attmpts to find Enhancements, Program-Exits, BADIs &
    & and Business Transaction Events in a particular program/tcode. &
    & Other search options: &
    & Program: RPR_ABAP_SOURCE_SCAN &
    & FModule: &
    & Text Elements: &
    & P_DEVC Show user-exits from development class &
    & P_LIMIT Limit submit program selection &
    & P_FUNC Show function modules &
    & P_SUBM Show submit programs &
    & S01 Selection data (TCode takes precedence over program name) &
    report zpja_pm002
    no standard page heading
    line-size 221.
    data: tabix like sy-tabix,
    w_linnum type i,
    w_off type i,
    w_index like sy-tabix,
    w_include like trdir-name,
    w_prog like trdir-name,
    w_incl like trdir-name,
    w_area like rs38l-area,
    w_level,
    w_fsel like sy-ucomm, " Determination of screen field
    w_str(50) type c,
    w_funcname like tfdir-funcname.
    constants: c_fmod(40) type c value 'Function modules selected: ',
    c_subm(40) type c value 'Submit programs selected: ',
    c_col1(12) type c value 'Enhanmt Type',
    c_col2(40) type c value 'Enhancement',
    c_col3(30) type c value 'Program/Include',
    c_col4(20) type c value 'Enhancement Name',
    c_col5(40) type c value 'Enhancement Description',
    c_col6(8) type c value 'Project',
    c_col7(1) type c value 'S',
    c_col8(12) type c value 'ChangeName',
    c_col9(10) type c value 'ChangeDate'.
    Work Areas: ABAP Workbench
    data: begin of wa_d010inc.
    data: master type d010inc-master.
    data: end of wa_d010inc.
    data: begin of wa_tfdir.
    data: funcname type tfdir-funcname,
    pname type tfdir-pname,
    include type tfdir-include.
    data: end of wa_tfdir.
    data: begin of wa_tadir.
    data: devclass type tadir-devclass.
    data: end of wa_tadir.
    data: begin of wa_tstc.
    data: pgmna type tstc-pgmna.
    data: end of wa_tstc.
    data: begin of wa_tstcp.
    data: param type tstcp-param.
    data: end of wa_tstcp.
    data: begin of wa_enlfdir.
    data: area type enlfdir-area.
    data: end of wa_enlfdir.
    Work Areas: BADIs
    data: begin of wa_sxs_attr.
    data: exit_name type sxs_attr-exit_name.
    data: end of wa_sxs_attr.
    data: begin of wa_sxs_attrt.
    data: text type sxs_attrt-text.
    data: end of wa_sxs_attrt.
    Work Areas: Enhancements
    data: begin of wa_modsap.
    data: member type modsap-member.
    data: end of wa_modsap.
    data: begin of wa_modsapa.
    data: name type modsapa-name.
    data: end of wa_modsapa.
    data: begin of wa_modsapt.
    data: modtext type modsapt-modtext.
    data: end of wa_modsapt.
    Work Areas: Business Transaction Events
    data: begin of wa_tbe01t.
    data: text1 type tbe01t-text1.
    data: end of wa_tbe01t.
    data: begin of wa_tps01t.
    data: text1 type tps01t-text1.
    data: end of wa_tps01t.
    user-exits
    types: begin of ty_mod,
    member like modact-member,
    name like modact-name,
    status like modattr-status,
    anam like modattr-anam,
    adat like modattr-adat,
    end of ty_mod.
    data: w_mod type ty_mod.
    types: begin of t_userexit,
    type(12) type c,
    pname like trdir-name,
    txt(300),
    level type c,
    modname(30) type c,
    modtext(60) type c,
    modattr type ty_mod,
    end of t_userexit.
    data: i_userexit type standard table of t_userexit with header line.
    Function module developmnet classes
    types: begin of t_devclass,
    clas like trdir-clas,
    end of t_devclass.
    data: i_devclass type standard table of t_devclass with header line.
    types: begin of t_enlfdir,
    area type enlfdir-area,
    end of t_enlfdir.
    data: i_enlfdir type standard table of t_enlfdir with header line.
    Submit programs
    types: begin of t_submit,
    pname like trdir-name,
    level,
    done,
    end of t_submit.
    data: i_submit type standard table of t_submit with header line.
    Source code
    types: begin of t_sourcetab, "#EC * (SLIN lügt!)
    line(200), "#EC * (SLIN lügt!)
    end of t_sourcetab. "#EC * (SLIN lügt!)
    data: sourcetab type standard table of t_sourcetab with header line.
    data c_overflow(30000) type c.
    Description of an ABAP/4 source analysis token
    data: i_stoken type standard table of stokex with header line.
    data wa_stoken like i_stoken.
    Description of an ABAP/4 source analysis statement
    data: i_sstmnt type standard table of sstmnt with header line."#EC NEEDED
    keywords for searching ABAP code
    types: begin of t_keywords,
    word(30),
    end of t_keywords.
    data: keywords type standard table of t_keywords with header line.
    function modules within program
    types: begin of t_fmodule,
    name like rs38l-name,
    pname like trdir-name,
    pname2 like trdir-name,
    level,
    bapi,
    done,
    end of t_fmodule.
    data: i_fmodule type standard table of t_fmodule with header line.
    & Selection Options &
    selection-screen begin of block selscr1 with frame title text-s01.
    parameter: p_pname like trdir-name memory id rid,
    p_tcode like syst-tcode,
    p_limit(4) type n default 100,
    p_devc like rihea-dy_ofn default ' ',
    p_func like rihea-dy_ofn default ' ',
    p_subm like rihea-dy_ofn default ' '.
    selection-screen end of block selscr1.
    & START-OF-SELECTION &
    start-of-selection.
    if p_pname is initial and p_tcode is initial.
    message e008(hrfpm). "Make entry on the selection screen
    stop.
    endif.
    ensure P_LIMIT is not zero.
    if p_limit = 0.
    p_limit = 1.
    endif.
    perform data_select.
    perform get_submit_data.
    perform get_fm_data.
    perform get_additional_data.
    perform data_display.
    & Form DATA_SELECT &
    form data_select.
    data selection message to sap gui
    call function 'SAPGUI_PROGRESS_INDICATOR'
    destination 'SAPGUI'
    keeping logical unit of work
    exporting
    text = 'Get programs/includes' "#EC NOTEXT
    exceptions
    system_failure
    communication_failure
    . "#EC *
    determine search words
    keywords-word = 'CALL'.
    append keywords.
    keywords-word = 'FORM'.
    append keywords.
    keywords-word = 'PERFORM'.
    append keywords.
    keywords-word = 'SUBMIT'.
    append keywords.
    keywords-word = 'INCLUDE'.
    append keywords.
    if not p_tcode is initial.
    get program name from TCode
    select single pgmna from tstc into wa_tstc-pgmna
    where tcode eq p_tcode.
    if not wa_tstc-pgmna is initial.
    p_pname = wa_tstc-pgmna.
    TCode does not include program name, but does have refereve TCode
    else.
    select single param from tstcp into wa_tstcp-param
    where tcode eq p_tcode.
    if sy-subrc = 0.
    check wa_tstcp-param(1) = '/'.
    check wa_tstcp-param+1(1) = '*'.
    if wa_tstcp-param ca ' '.
    endif.
    w_off = sy-fdpos + 1.
    subtract 2 from sy-fdpos.
    if sy-fdpos gt 0.
    p_tcode = wa_tstcp-param+2(sy-fdpos).
    endif.
    select single pgmna from tstc into wa_tstc-pgmna
    where tcode eq p_tcode.
    p_pname = wa_tstc-pgmna.
    if sy-subrc <> 0.
    message e110(/saptrx/asc) with 'No program found for: ' p_tcode."#EC NOTEXT
    endif.
    else.
    message e110(/saptrx/asc) with 'No program found for: ' p_tcode."#EC NOTEXT
    endif.
    endif.
    endif.
    Call customer-function aus Program coding
    read report p_pname into sourcetab.
    if sy-subrc > 0.
    message e017(enhancement) with p_pname raising no_program."#EC *
    endif.
    scan abap-source sourcetab tokens into i_stoken
    statements into i_sstmnt
    keywords from keywords
    overflow into c_overflow
    with includes.
    if sy-subrc > 0. "keine/syntakt. falsche Ablauflog./Fehler im Skanner
    message e130(enhancement) raising syntax_error. "#EC *
    endif.
    check I_STOKEN for entries
    clear w_linnum.
    describe table i_stoken lines w_linnum.
    if w_linnum gt 0.
    w_level = '0'.
    w_prog = ''.
    w_incl = ''.
    perform data_search tables i_stoken using w_level w_prog w_incl.
    endif.
    endform. "DATA_SELECT
    & Form GET_FM_DATA &
    form get_fm_data.
    data selection message to sap gui
    call function 'SAPGUI_PROGRESS_INDICATOR'
    destination 'SAPGUI'
    keeping logical unit of work
    exporting
    text = 'Get function module data' "#EC NOTEXT
    exceptions
    system_failure
    communication_failure. "#EC *
    Function module data
    sort i_fmodule by name.
    delete adjacent duplicates from i_fmodule comparing name.
    loop at i_fmodule where done ne 'X'.
    clear: i_stoken, i_sstmnt, sourcetab, wa_tfdir, w_include .
    refresh: i_stoken, i_sstmnt, sourcetab.
    store function groups
    select single area from enlfdir into wa_enlfdir-area
    where funcname = i_fmodule-name.
    i_enlfdir-area = wa_enlfdir-area.
    append i_enlfdir.
    Store development classes
    if not wa_enlfdir-area is initial.
    select single devclass into wa_tadir-devclass
    from tadir where pgmid = 'R3TR'
    and object = 'FUGR'
    and obj_name = wa_enlfdir-area.
    check not wa_tadir-devclass is initial.
    move wa_tadir-devclass to i_devclass-clas.
    append i_devclass.
    endif.
    clear wa_tfdir.
    select single funcname pname include from tfdir into wa_tfdir
    where funcname = i_fmodule-name.
    check sy-subrc = 0.
    call function 'FUNCTION_INCLUDE_SPLIT'
    exporting
    program = wa_tfdir-pname
    importing
    group = w_area.
    concatenate 'L' w_area 'U' wa_tfdir-include into w_include.
    i_fmodule-pname = w_include.
    i_fmodule-pname2 = wa_tfdir-pname.
    modify i_fmodule.
    read report i_fmodule-pname into sourcetab.
    if sy-subrc = 0.
    scan abap-source sourcetab tokens into i_stoken
    statements into i_sstmnt
    keywords from keywords
    with includes.
    if sy-subrc > 0.
    message e130(enhancement) raising syntax_error.
    endif.
    check i_stoken for entries
    clear w_linnum.
    describe table i_stoken lines w_linnum.
    if w_linnum gt 0.
    w_level = '1'.
    w_prog = i_fmodule-pname2.
    w_incl = i_fmodule-pname.
    perform data_search tables i_stoken using w_level w_prog w_incl.
    endif.
    endif.
    endloop.
    sort funtion groups
    sort i_devclass.
    delete adjacent duplicates from i_devclass.
    sort i_enlfdir.
    delete adjacent duplicates from i_enlfdir.
    endform. "GET_FM_DATA
    & Form GET_SUBMIT_DATA &
    form get_submit_data.
    data selection message to sap gui
    call function 'SAPGUI_PROGRESS_INDICATOR'
    destination 'SAPGUI'
    keeping logical unit of work
    exporting
    text = 'Get submit data' "#EC NOTEXT
    exceptions
    system_failure
    communication_failure
    . "#EC *
    sort i_submit.
    delete adjacent duplicates from i_submit comparing pname.
    w_level = '0'.
    loop at i_submit where done ne 'X'.
    check i_submit-pname ne p_pname. " ensure not the same as origianl program
    clear: i_stoken, i_sstmnt, sourcetab.
    refresh: i_stoken, i_sstmnt, sourcetab.
    read report i_submit-pname into sourcetab.
    if sy-subrc <> 0.
    delete i_submit.
    continue.
    else.
    scan abap-source sourcetab tokens into i_stoken
    statements into i_sstmnt
    keywords from keywords
    with includes.
    if sy-subrc > 0.
    continue.
    endif.
    check i_stoken for entries
    clear w_linnum.
    describe table i_stoken lines w_linnum.
    if w_linnum gt 0.
    w_prog = i_submit-pname.
    w_incl = ''.
    perform data_search tables i_stoken using w_level w_prog w_incl.
    endif.
    endif.
    restrict number of submit program selected for processing
    describe table i_submit lines w_linnum.
    if w_linnum ge p_limit.
    w_level = '1'.
    endif.
    i_submit-done = 'X'.
    modify i_submit.
    endloop.
    sort i_submit.
    delete adjacent duplicates from i_submit comparing pname.
    endform. "GET_SUBMIT_DATA
    & Form DATA_SEARCH &
    form data_search tables p_stoken structure stoken
    using p_level p_prog p_incl.
    loop at p_stoken.
    clear i_userexit.
    tabix = sy-tabix + 1.
    i_userexit-level = p_level.
    if i_userexit-level = '0'.
    if p_incl is initial.
    i_userexit-pname = p_pname.
    else.
    concatenate p_pname '/' p_incl into i_userexit-pname.
    endif.
    else.
    if p_incl is initial.
    i_userexit-pname = p_prog.
    else.
    concatenate p_prog '/' p_incl into i_userexit-pname.
    endif.
    endif.
    Include
    if p_stoken-str eq 'INCLUDE'.
    check p_level eq '0'. " do not perform for function modules (2nd pass)
    w_index = sy-tabix + 1.
    read table p_stoken index w_index into wa_stoken.
    check not wa_stoken-str cs 'STRUCTURE'.
    check not wa_stoken-str cs 'SYMBOL'.
    read table i_submit with key pname = wa_stoken-str.
    if sy-subrc <> 0.
    i_submit-pname = wa_stoken-str.
    i_submit-level = p_level.
    append i_submit.
    endif.
    endif.
    Enhancements
    if p_stoken-str eq 'CUSTOMER-FUNCTION'.
    clear w_funcname.
    read table p_stoken index tabix.
    translate p_stoken-str using ''' '.
    condense p_stoken-str.
    if p_prog is initial.
    concatenate 'EXIT' p_pname p_stoken-str into w_funcname
    separated by '_'.
    else.
    concatenate 'EXIT' p_prog p_stoken-str into w_funcname
    separated by '_'.
    endif.
    select single member from modsap into wa_modsap-member
    where member = w_funcname.
    if sy-subrc = 0. " check for valid enhancement
    i_userexit-type = 'Enhancement'.
    i_userexit-txt = w_funcname.
    append i_userexit.
    else.
    clear wa_d010inc.
    select single master into wa_d010inc-master
    from d010inc
    where include = p_prog.
    concatenate 'EXIT' wa_d010inc-master p_stoken-str into w_funcname
    separated by '_'.
    i_userexit-type = 'Enhancement'.
    i_userexit-txt = w_funcname.
    endif.
    endif.
    BADIs
    if p_stoken-str cs 'cl_exithandler='.
    w_index = sy-tabix + 4.
    read table p_stoken index w_index into wa_stoken.
    i_userexit-txt = wa_stoken-str.
    replace all occurrences of '''' in i_userexit-txt with space.
    i_userexit-type = 'BADI'.
    append i_userexit.
    endif.
    Business transaction events
    if p_stoken-str cs 'OPEN_FI_PERFORM'.
    i_userexit-type = 'BusTrEvent'.
    i_userexit-txt = p_stoken-str.
    replace all occurrences of '''' in i_userexit-txt with space.
    i_userexit-modname = i_userexit-txt+16(8).
    case i_userexit-txt+25(1).
    when 'E'.
    clear wa_tbe01t.
    select single text1 into wa_tbe01t-text1 from tbe01t
    where event = i_userexit-txt+16(8)
    and spras = sy-langu.
    if wa_tbe01t-text1 is initial.
    i_userexit-modtext = ''. "#EC NOTEXT
    else.
    i_userexit-modtext = wa_tbe01t-text1.
    endif.
    i_userexit-modname+8 = '/P&S'. "#EC NOTEXT
    when 'P'.
    clear wa_tps01t.
    select single text1 into wa_tps01t-text1 from tps01t
    where procs = i_userexit-txt+16(8)
    and spras = sy-langu.
    i_userexit-modtext = wa_tps01t-text1.
    i_userexit-modname+8 = '/Process'.
    endcase.
    append i_userexit.
    endif.
    Program exits
    if p_stoken-str cs 'USEREXIT_'.
    i_userexit-type = 'Program Exit'.
    i_userexit-txt = p_stoken-str.
    replace all occurrences of '''' in i_userexit-txt with space.
    append i_userexit.
    endif.
    Submit programs
    if p_stoken-str cs 'SUBMIT'.
    check p_level eq '0'. " do not perform for function modules (2nd pass)
    check not p_stoken-str cs '_'. " ensure not SUBMIT_XXX
    w_index = sy-tabix + 1.
    read table p_stoken index w_index into wa_stoken.
    check not wa_stoken-str cs '_'. " ensure not SUBMIT_XXX
    replace all occurrences of '''' in wa_stoken-str with space.
    read table i_submit with key pname = wa_stoken-str.
    if sy-subrc <> 0.
    i_submit-pname = wa_stoken-str.
    i_submit-level = p_level.
    append i_submit.
    endif.
    endif.
    Perform routines (which reference external programs)
    if p_stoken-str cs 'PERFORM'.
    check p_level eq '0'. " do not perform for function modules (2nd pass)
    w_index = sy-tabix + 1.
    read table p_stoken index w_index into wa_stoken.
    if not wa_stoken-ovfl is initial.
    w_off = wa_stoken-off1 + 10.
    w_str = c_overflow+w_off(30).
    find ')' in w_str match offset w_off.
    w_off = w_off + 1.
    wa_stoken-str = w_str(w_off).
    endif.
    check wa_stoken-str cs '('.
    w_off = 0.
    while sy-subrc = 0.
    if wa_stoken-str+w_off(1) eq '('.
    replace section offset w_off length 1 of wa_stoken-str with ''.
    replace all occurrences of ')' in wa_stoken-str with space.
    read table i_submit with key pname = wa_stoken-str.
    if sy-subrc <> 0.
    i_submit-pname = wa_stoken-str.
    append i_submit.
    endif.
    exit.
    else.
    replace section offset w_off length 1 of wa_stoken-str with ''.
    shift wa_stoken-str left deleting leading space.
    endif.
    endwhile.
    endif.
    Function modules
    if p_stoken-str cs 'FUNCTION'.
    clear i_fmodule.
    check p_level eq '0'. " do not perform for function modules (2nd pass)
    w_index = sy-tabix + 1.
    read table p_stoken index w_index into wa_stoken.
    if wa_stoken-str cs 'WF_'.
    if wa_stoken-str cs 'IDOC'.
    break-point.
    endif.
    if wa_stoken-str cs 'BAPI'.
    i_fmodule-bapi = 'X'.
    endif.
    replace first occurrence of '''' in wa_stoken-str with space.
    replace first occurrence of '''' in wa_stoken-str with space.
    if sy-subrc = 4. " didn't find 2nd quote (ie name truncated)
    clear wa_tfdir.
    concatenate wa_stoken-str '%' into wa_stoken-str.
    select single funcname into wa_tfdir-funcname from tfdir
    where funcname like wa_stoken-str.
    if sy-subrc = 0.
    i_fmodule-name = wa_tfdir-funcname.
    else.
    continue.
    endif.
    else.
    i_fmodule-name = wa_stoken-str.
    endif.
    read table i_fmodule with key name = i_fmodule-name.
    if sy-subrc <> 0.
    i_fmodule-level = p_level.
    append i_fmodule.
    endif.
    endif.
    endloop.
    endform. "DATA_SEARCH
    & Form GET_ADDITIONAL_DATA &
    form get_additional_data.
    data selection message to sap gui
    call function 'SAPGUI_PROGRESS_INDICATOR'
    destination 'SAPGUI'
    keeping logical unit of work
    exporting
    text = 'Get additional data' "#EC NOTEXT
    exceptions
    system_failure
    communication_failure
    . "#EC *
    loop at i_userexit.
    Enhancement data
    if i_userexit-type cs 'Enh'.
    clear: wa_modsapa.
    select single name into wa_modsapa-name from modsap
    where member = i_userexit-txt.
    check sy-subrc = 0.
    i_userexit-modname = wa_modsapa-name.
    clear wa_modsapt.
    select single modtext into wa_modsapt-modtext from modsapt
    where name = wa_modsapa-name
    and sprsl = sy-langu.
    i_userexit-modtext = wa_modsapt-modtext.
    MOH - enhancement to get the project name
    clear w_mod.
    select single modactmember modactname modattr~status
    modattranam modattradat
    into w_mod
    from modact
    inner join modattr
    on modattrname = modactname
    where modact~member = wa_modsapa-name
    and modact~typ = space.
    i_userexit-modattr = w_mod.
    MOH - eoe
    endif.
    BADI data
    if i_userexit-type eq 'BADI'.
    clear wa_sxs_attr.
    select single exit_name into wa_sxs_attr-exit_name from sxs_attr
    where exit_name = i_userexit-txt.
    if sy-subrc = 0.
    i_userexit-modname = i_userexit-txt.
    else.
    i_userexit-modname = 'Dynamic call'. "#EC NOTEXT
    endif.
    clear wa_sxs_attrt.
    select single text into wa_sxs_attrt-text from sxs_attrt
    where exit_name = wa_sxs_attr-exit_name
    and sprsl = sy-langu.
    i_userexit-modtext = wa_sxs_attrt-text.
    endif.
    modify i_userexit.
    endloop.
    get enhancements via program package
    clear wa_tadir.
    select single devclass into wa_tadir-devclass from tadir
    where pgmid = 'R3TR'
    and object = 'PROG'
    and obj_name = p_pname.
    if sy-subrc = 0.
    clear: wa_modsapa, wa_modsapt.
    select name from modsapa into wa_modsapa-name
    where devclass = wa_tadir-devclass.
    select single modtext from modsapt into wa_modsapt-modtext
    where name = wa_modsapa-name
    and sprsl = sy-langu.
    read table i_userexit with key modname = wa_modsapa-name.
    if sy-subrc <> 0.
    i_userexit-modtext = wa_modsapt-modtext.
    i_userexit-type = 'Enhancement'. "#EC NOTEXT
    i_userexit-modname = wa_modsapa-name.
    i_userexit-txt = 'Determined from program DevClass'."#EC NOTEXT
    i_userexit-pname = 'Unknown'. "#EC NOTEXT
    append i_userexit.
    endif.
    endselect.
    endif.
    Get IDOCs
    loop at i_devclass.
    endloop.
    endform. "GET_ADDITIONAL_DATA
    & Form DATA_DISPLAY &
    form data_display.
    data selection message to sap gui
    call function 'SAPGUI_PROGRESS_INDICATOR'
    destination 'SAPGUI'
    keeping logical unit of work
    exporting
    text = 'Prepare screen for display' "#EC NOTEXT
    exceptions
    system_failure
    communication_failure
    . "#EC *
    sort i_userexit by type txt modname.
    delete adjacent duplicates from i_userexit comparing txt modname.
    format headings
    write: 'Enhancements from main program'. "#EC NOTEXT
    write: /.
    uline.
    format color col_heading.
    write: / sy-vline,
    (12) c_col1, "Enhanmt Type
    sy-vline,
    (40) c_col2, "Enhancement
    sy-vline,
    (30) c_col3, "Program/Include
    sy-vline,
    (20) c_col4, "Enhancement name
    sy-vline,
    (60) c_col5, "Enhancement description
    sy-vline,
    (8) c_col6, "Project
    sy-vline,
    (1) c_col7, "S
    sy-vline,
    (12) c_col8, "ChangeName
    sy-vline,
    (10) c_col9, "ChangeDate
    sy-vline.
    format reset.
    uline.
    format lines
    loop at i_userexit.
    set line colour
    case i_userexit-type.
    when 'Enhancement'.
    format color 3 intensified off.
    when 'BADI'.
    format color 4 intensified off.
    when 'BusTrEvent'.
    format color 5 intensified off.
    when 'Program Exit'.
    format color 6 intensified off.
    when others.
    format reset.
    endcase.
    write: / sy-vline,
    i_userexit-type,
    sy-vline,
    i_userexit-txt(40),
    sy-vline,
    i_userexit-pname(30),
    sy-vline,
    i_userexit-modname(20),
    sy-vline,
    i_userexit-modtext(60),
    sy-vline,
    i_userexit-modattr-name,
    sy-vline,
    i_userexit-modattr-status,
    sy-vline,
    i_userexit-modattr-anam,
    sy-vline,
    i_userexit-modattr-adat no-zero,
    sy-vline.
    hide: i_userexit-type,
    i_userexit-txt,
    i_userexit-pname,
    i_userexit-modname,
    i_userexit-modtext.
    endloop.
    format reset.
    uline.
    user-exits from development class of function modules
    if p_devc = 'X'.
    write: /.
    write: / 'User-exits from function module development class'."#EC NOTEXT
    write: 157''.
    uline (90).
    write: 157''.
    loop at i_devclass.
    clear wa_modsapa.
    select name from modsapa into wa_modsapa
    where devclass = i_devclass-clas.
    select single name modtext into corresponding fields of wa_modsapt
    from modsapt
    where name = wa_modsapa-name
    and sprsl = sy-langu.
    format color 3 intensified off.
    write: / sy-vline,
    (12) 'Enhancement',
    sy-vline,
    wa_modsapa-name,
    sy-vline,
    wa_modsapt-modtext,
    sy-vline.
    endselect.
    endloop.
    uline (90).
    format reset.
    endif.
    describe table i_fmodule lines w_linnum.
    write: / c_fmod , at 35 w_linnum. "#EC NOTEXT
    write: 157''.
    if p_func = 'X'.
    display fuction modules used in program
    uline (38).
    write: 157''.
    loop at i_fmodule.
    write: sy-vline,
    i_fmodule-name,
    sy-vline,
    i_fmodule-bapi,
    sy-vline.
    write: 157''.
    endloop.
    uline (38).
    write: 157''.
    endif.
    describe table i_submit lines w_linnum.
    write: / c_subm , at 35 w_linnum. "#EC NOTEXT
    write: 157''.
    if p_subm = 'X'.
    display submit programs used in program
    uline (44).
    write: 157''.
    loop at i_submit.
    write: sy-vline,
    i_submit-pname,
    sy-vline.
    write: 157''.
    endloop.
    uline (44).
    endif.
    issue message with number of user-exits displayed
    describe table i_userexit lines w_linnum.
    message s697(56) with w_linnum.
    endform. "DATA_DISPLAY
    & User Selection Processing &
    at line-selection.
    get cursor field w_fsel.
    case w_fsel.
    when 'I_USEREXIT-MODNAME'.
    case i_userexit-type.
    when 'Enhancement'.
    set parameter id 'MON' field i_userexit-modname.
    call transaction 'SMOD' and skip first screen.
    when 'BADI'.
    check i_userexit-modname ne 'Dynamic call'.
    set parameter id 'EXN' field i_userexit-modname.
    call transaction 'SE18' and skip first screen.
    when 'BusTrEvent'.
    submit rfopfi00 with attr_typey_selm = 'A'
    with event = i_userexit-modname(8)
    via selection-screen
    and return.
    when others.
    endcase.
    when 'I_USEREXIT-PNAME'.
    check i_userexit-modname ne 'Unknown'.
    w_off = 0.
    find '/' in i_userexit-pname match offset w_off.
    if w_off = 0.
    set parameter id 'RID' field i_userexit-pname.
    call transaction 'SE38' and skip first screen.
    else.
    w_off = w_off + 1.
    w_prog = i_userexit-pname+w_off.
    set parameter id 'RID' field w_prog.
    call transaction 'SE38' and skip first screen.
    endif.
    when others.
    endcase.
    Feel free to revert back.
    --Ragu

  • User exit in ME21N

    hi everybody
    I have added 2 additional fields(zzqty, zzprice) at item level in PO, Ive also added the subscreen in me21N
    My requirement is that these 2 fields should be copied from the fields menge and netpr for each line
    I have coded the following in the user exit
    EXIT_SAPMM06E_016
    DATA:  ekpo type ekpo.
    ekpo = i_ekpo.
    ekpo-zzqty = i_ekpo-netpr.
    ekpo-zzprice = i_ekpo-netpr.
    FREE MEMORY ID 'CUS_AKTYP'.
    EXPORT aktyp FROM I_AKTYP TO MEMORY ID 'CUS_AKTYP'.
    EXIT_SAPMM06E_018
    data: ekpo type ekpo.
    move-corresponding ekpo to e_ci_ekpo.
    but its not working
    can somebody tell me wat im missing?

    if you can tell me what you want to achieve , i can tell you what to code.
    but as of now you can try with the below coding,
    EXIT_SAPMM06E_016
    DATA: ekpo type ekpo.
    ekpo = i_ekpo.
    ekpo-zzqty = i_ekpo-netpr.
    ekpo-zzprice = i_ekpo-netpr.
    EXPORT ekpo FROM ekpo TO MEMORY ID 'SOMEID'.
    EXIT_SAPMM06E_018
    data: ekpo type ekpo.
    import ekpo to ekpo from memory id 'SOMEID'.
    "this id is should be same as above
    move-corresponding ekpo to e_ci_ekpo.

  • MIRO User exit - processing order

    Hi
    I've had a user request to try to copy the text line entered in the header part of MIRO into the posted transactions in BSEG so that when GL account analysis jobs are run eg FS10N, relevant text info is shown as well (as it does when manual invoices are posted). I've worked on the User exits available and with the Export/Import to memory option I thought that I'd cracked it.
    I used the Export option in EXIT_SAPLMRMP_010 as required input data is available there. Then I used the Import option in EXIT_SAPLMRMP_004 as that exit is used to post data to the accounting functions. For testing I put a breakpoint into each of them.
    During testing, I was surprised to find that EXIT_SAPLMRMP_004 was actually processed before EXIT_SAPLMRMP_010 during MIRO although I proved that the concept would work would work by manually keying some text into the relevant field at the breakpoint as it appeared in BSEG afterwards.
    Can anyone please advise if there is an easy way to discover the order of processing of the exits available to MIRO (dozens of includes in SAPLMR1M!!) so I can put the Export option into the correct place.
    Thanks
    Jim Jackson

    Hi Jim,
    You can try with BTE (Business Transaction Events).
    Goto SE37 - SAMPLE_PROCESS_00001120 (this is the standard BTE for account document posting). copy this with ZSAMPLE_PROCESS_00001120.
    In this you cannot modify the tables t_bkpf and t_bseg. you can use t_bkpfsub and t_bsegsub.
    For this a little bit config is required.
    1) Goto t-code FIBF-> settings->Products->... of a customer.
        Click new entries -> product name- ZPRODUCT , text - any text, RFC dest -                                     ZSAMPLE_PROCESS_00001120, A - enable check box -> save.
    2) Go back -> settings -> P/S Modules -> ... of a customer.
        Click new entries -> event - 00001120, Product - ZPRODUCT, Ctr - Country key, Appl - FI-FI,   Function module - ZSAMPLE_PROCESS_00001120 -> save.
    3) Go back -> settings -> Process Modules -> ... of a customer.
        Click new entries ->Process - 00001120, Ctr - Country key, Appl - FI-FI, Func module - ZSAMPLE_PROCESS_00001120, Product - ZPRODUCT -> save.
    Now goto SE37->ZSAMPLE_PROCESS_00001120
    logic.
    loop at t_bkpf.
    loop at t_bkpfsub.
         move 'your value' to t_bkpfsub-value.
         modify t_bkpfsub index sy-tabix.
    endloop.
    endloop.
    loop at t_bseg.
      loop at t_bsegsub.
          move 'your value' to t_bsegsub-value.
          modify t_bsegsub index sy-tabix.
      endloop.
    endloop.
    ''your value' is imported value.
    no need to worry abt modified values. after execution of BTE it will go to standard prog and copy the values of t_bkpfsub[] and t_bsegsub[] to SAP tables. so pls be perfect with code. SAP wouldn't allow change the values in t_bkpf[] and t_bseg[] values. you can add your own fields in bkpf_subst and bseg_subst.
    But make sure that, pls write the code in FM with conditions like cocode doc type etc. bcz this BTE is very important. it will executes before acc doc is posted.if you do not specify any conditions it will execute for all co codes in acc doc. it will affect business. you can debug this BTE. put a break point in FM and see the values while post the MIRO.
    once import the values free memory id and clear the variables what ever u used in BTE.
    Best Regards,
    Mohan.

  • IW31 - User Exit / BADI for changing data in Component's Order.

    Hi gurus,
    I need to update the field WEMPF in the order components during the Order Creation (Tx IW31).
    Is there any User Exit or Badi I can use?
    Thanks in advance !!

    At WO10009 User Exit...we can use this FM:
    CO_BC_RESBD_OF_ORDER_GET -> Get RESB internal table.
    CO_BT_RESB_UPDATE -> Update RESB table.
    Althought during creation (IW31) when the order numer is temporal ($$$$$$$$$$$1), this FM works great, cause it reads from memory, not from database.
    Regards,

  • My macbook pro model mid 2009 is running slow. free memory is 35 mbs and inactive memory is  1.36 gb with a total of 5 gb RAM memory

    Problem description:
    too much inactive memory 1.87 gb and free memory only 35 mb
    EtreCheck version: 2.1.1 (104)
    Report generated 10 December 2014 3:30:26 pm IST
    Hardware Information: ℹ️
      MacBook Pro (13-inch, Mid 2009) (Verified)
      MacBook Pro - model: MacBookPro5,5
      1 2.26 GHz Intel Core 2 Duo CPU: 2-core
      5 GB RAM Upgradeable
      BANK 0/DIMM0
      1 GB DDR3 1067 MHz ok
      BANK 1/DIMM0
      4 GB DDR3 1067 MHz ok
      Bluetooth: Old - Handoff/Airdrop2 not supported
      Wireless:  en1: 802.11 a/b/g/n
    Video Information: ℹ️
      NVIDIA GeForce 9400M - VRAM: 256 MB
      Color LCD 1280 x 800
    System Software: ℹ️
      OS X 10.10.1 (14B25) - Uptime: 4:42:54
    Disk Information: ℹ️
      WDC WD5000LPVT-80G33T2 disk0 : (500.11 GB)
      S.M.A.R.T. Status: Verified
      EFI (disk0s1) <not mounted> : 210 MB
      [redacted] (disk0s2) / : 499.25 GB (142.01 GB free)
      Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
      HL-DT-ST DVDRW  GS23N 
    USB Information: ℹ️
      Apple Inc. Built-in iSight
      Apple Internal Memory Card Reader
      Apple Inc. Apple Internal Keyboard / Trackpad
      Apple Computer, Inc. IR Receiver
      Apple Inc. BRCM2046 Hub
      Apple Inc. Bluetooth USB Host Controller
    Gatekeeper: ℹ️
      Anywhere
    Kernel Extensions: ℹ️
      /System/Library/Extensions
      [not loaded] com.driver.KUSBModemCDC07 (4.0.2) [Support]
      [not loaded] com.driver.KUSBModemDataA07 (4.0.2) [Support]
    Startup Items: ℹ️
      JHHPortDetect: Path: /Library/StartupItems/JHHPortDetect
      Sudochmod: Path: /Library/StartupItems/Sudochmod
      Startup items are obsolete in OS X Yosemite
    Launch Agents: ℹ️
      [not loaded] com.adobe.AAM.Updater-1.0.plist [Support]
      [running] com.bjango.istatmenusagent.plist [Support]
      [loaded] com.google.keystone.agent.plist [Support]
      [loaded] com.oracle.java.Java-Updater.plist [Support]
      [running] jp.co.canon.CUPSCAPT.BG.plist [Support]
      [loaded] org.macosforge.xquartz.startx.plist [Support]
    Launch Daemons: ℹ️
      [loaded] com.adobe.fpsaud.plist [Support]
      [invalid?] com.adobe.SwitchBoard.plist [Support]
      [running] com.bjango.istatmenusdaemon.plist [Support]
      [loaded] com.google.keystone.daemon.plist [Support]
      [loaded] com.microsoft.office.licensing.helper.plist [Support]
      [loaded] com.oracle.java.Helper-Tool.plist [Support]
      [loaded] com.oracle.java.JavaUpdateHelper.plist [Support]
      [loaded] org.macosforge.xquartz.privileged_startx.plist [Support]
      [loaded] org.tcpdump.chmod_bpf.plist [Support]
    User Launch Agents: ℹ️
      [loaded] com.adobe.ARM.[...].plist [Support]
    User Login Items: ℹ️
      iTunesHelper Application (/Applications/iTunes.app/Contents/MacOS/iTunesHelper.app)
      Caffeine Application (/Applications/Caffeine.app)
      AdobeResourceSynchronizer ApplicationHidden (/Applications/Adobe Reader.app/Contents/Support/AdobeResourceSynchronizer.app)
      Dropbox Application (/Applications/Dropbox.app)
      HyperDock Helper UNKNOWN (missing value)
    Internet Plug-ins: ℹ️
      o1dbrowserplugin: Version: 5.38.6.0 - SDK 10.8 [Support]
      Default Browser: Version: 600 - SDK 10.10
      AdobePDFViewerNPAPI: Version: 11.0.09 - SDK 10.6 [Support]
      FlashPlayer-10.6: Version: 15.0.0.246 - SDK 10.6 [Support]
      Flash Player: Version: 15.0.0.246 - SDK 10.6 Mismatch! Adobe recommends 16.0.0.235
      QuickTime Plugin: Version: 7.7.3
      googletalkbrowserplugin: Version: 5.38.6.0 - SDK 10.8 [Support]
      SharePointBrowserPlugin: Version: 14.0.0 [Support]
      AdobePDFViewer: Version: 11.0.09 - SDK 10.6 [Support]
      zako: Version: zako 1.0.0.0 - SDK 10.8 [Support]
      iPhotoPhotocast: Version: 7.0 - SDK 10.8
      JavaAppletPlugin: Version: Java 7 Update 71 Check version
    User internet Plug-ins: ℹ️
      BlueStacks Install Detector: Version: Unknown
    Safari Extensions: ℹ️
      AdBlock
      ClickToFlash
      Awesome Screenshot
      Breaking News
      The New York Times
    3rd Party Preference Panes: ℹ️
      Flash Player  [Support]
      Java  [Support]
    Time Machine: ℹ️
      Skip System Files: NO
      Mobile backups: ON
      Auto backup: YES
      Volumes being backed up:
      Arupreet: Disk size: 499.25 GB Disk used: 357.24 GB
      Destinations:
      CHIKKI [Local]
      Total size: 331.41 GB
      Total number of backups: 2
      Oldest backup: 2014-06-10 13:36:00 +0000
      Last backup: 2014-09-08 13:57:40 +0000
      Size of backup disk: Too small
      Backup size 331.41 GB < (Disk used 357.24 GB X 3)
    Top Processes by CPU: ℹ️
          8% python
          3% WindowServer
          3% uTorrent
          2% SystemUIServer
          0% mtmfs
    Top Processes by Memory: ℹ️
      1.29 GB JavaAppLauncher
      123 MB SystemUIServer
      102 MB iStatMenusDaemon
      86 MB com.apple.WebKit.WebContent
      81 MB WindowServer
    Virtual Memory Information: ℹ️
      50 MB Free RAM
      1.97 GB Active RAM
      1.90 GB Inactive RAM
      673 MB Wired RAM
      6.70 GB Page-ins
      8 MB Page-outs
    Diagnostics Information: ℹ️
      Dec 10, 2014, 10:48:11 AM Self test - passed
      Dec 9, 2014, 02:54:15 AM VLC_2014-12-09-025415_Arus-MacBook-Pro.crash

    Not sure if using Terminal would help:
    Launch Activity Monitor
    Select Memory tab
    Launch Terminal
    type sudo purge
    password
    10-15 sec later Terminal should refresh and show freed memory & cache

  • Sales Order - user exit at item level

    I am new in writing user-exits. Pls do share your exp !
    When creating a sales order I encounter error, system says "Enter batch number".
    We basically create batch when doing GoodsReceive for Production Orders. At this time the Material Revision is copied as Batch into MCHB table.
    For example:
    Material ABC has the below,
    Rev    Batch
    A        A
    B        B
    C        blank
    If I create a SO for part ABC for Rev C, it does not allow me becos batch does not exists. But my SO should be allowed to be copy C into the batch field in VBAP.
    Pls let me know if we must create custom user-exit rather than modifying std.SAP user-exit for Sales Order processing (MV45AFZZ).
    Is there any contraints using the batch field in SO? As I came to know that the problem is when creating a Purchase Order  it allows to enter free text in batch field but SO doesn’t allow. Is't?
    Is there any standard way to config the system such that SO will bypass the existence checking of the batch
    Pls share !
    Pri

    Hi, but inplace of Batch we only enter the Revision of the material. Becos rev-batch relationship is 1-1, meaning is rev is A, the batch will be A too.
    We just use the batch field to represent the revision
    Rev    Batch
    A        A
    B        B
    C        blank
    I  can enter A in SO item batch field because system check that batch A exists
    I can enter B in SO item batch field because system check that batch B exists
    But I can’t enter C in SO item batch field because system check that batch C doesn’t exist
    Wondering how the system might know the batch is actually my revision. Not sure if I use User  EXIT to move “C” into VBAP-CHARG, will it give me error message because it will find out that there is no C batch
    Your views !

  • User Exit and BDC for ME22N

    Hello All,
    A code has been written in the User exit for Tcode ME22N, Which sets the indicator on PO line item. This has been done by modifying the standard itab POT by using field symbols, because the fields to be modified are shown in display mode in the tcode ME22N and cannot be done in BDC. See the below code in user exit ZXM06U43.
    DATA char(50) VALUE '(SAPLMEPO)POT[]'.
    CLEAR wa_ind.
        FIELD-SYMBOLS <f1> TYPE ANY.
    Move memory of internal table POT to field symbol f1.
        ASSIGN (char) TO <f1>.
    Move content of f1 to internal table i_ind
        i_ind[] = <f1> .
        LOOP AT i_ind INTO wa_ind.
          IF wa_ind-pstyp = '9'.            " Service PO - item category
    IF PO Line item has History per Purchasing Document as 'D'
    Set indicators on, for the line item.
            CLEAR v_cnt.
            SELECT COUNT( * ) INTO v_cnt FROM ent5100
                                         WHERE ebeln = wa_ind-ebeln
                                           AND ebelp = wa_ind-ebelp
                                           AND bewtp = 'D'.
            IF sy-subrc = 0.
              wa_ind-wepos = 'X'.            " Set Goods Receipt Indicator
              wa_ind-webre = 'X'.            " Set GR-based IV Indicator
              wa_ind-lebre = 'X'.            " Set Srv-based IV Indicator
            ELSE.
    *End of addition SAP-20070910104025 - SL36 - D01K963369
              wa_ind-wepos = ' '.            " Clear Goods Receipt Indicator
              wa_ind-webre = ' '.            " Clear GR-based IV Indicator
              wa_ind-lebre = ' '.            " Clear Srv-based IV Indicator
              wa_ind-xersy = ' '.            " Clear ERS Indicator
            ENDIF.                                           
            MODIFY i_ind FROM wa_ind INDEX sy-tabix.
          ENDIF.
        ENDLOOP.
        <f1> = i_ind[].
      ENDIF.          
    ENDIF.
    This code is in production and has been working fine.
    The requirnment is now to make this indicator work for all the Purchase order before this code has been written in the Exit. For this my functional suggests that to write a separate program using BDC for PO change and jus add a period/dot  in the short text and save it. The code has been written, the user exit and the above code is getting triggrred values are updated in internal table correctly.
    However the flags was not set or cleared when seen in the tcode ME22N . This works fine if the tcode me22n is run directly and not working in BDC.
    I have tried with ME22 without enjoy transaction in BDC changing the POT Program to SAPMM06E. It does not work.
    Please help me as why it is not uodating in the table when using BDC.
    Thanks in Advance.
    Senthil Kumar

    Hi All,
    Any luck on this??
    Thanks

  • User exit(very very urgent)

    hello
    below is my coding........
    the transaction is IW22 and the the code would be triggered when the notification complete button is checked.
    when the first case gets executed. i will get a pop-up.when i press continue the required operation is been performed but when i press cancel its returning to the notification screen which is going perfectly.but when i edit some values in the screen and press save in that transaction, as per the transaction it has to go the first screen showing that the notification is saved but its returning to the first screen showing the notification is complete.
    do help me
    TABLES : kssk, "Allocation Table: Object to Class
    klah. "Class Header data
    TYPES: BEGIN OF ty_it_itab,
    objek TYPE ausp-objek, "Object
    clint TYPE kssk-clint, "Internal Class Number
    END OF ty_it_itab.
    DATA: v_answer TYPE c,
    f_mr_flag(1) TYPE c.
    DATA: it_itab TYPE STANDARD TABLE OF ty_it_itab.
    DATA: it_classes TYPE STANDARD TABLE OF sclass,
    it_obj_data TYPE STANDARD TABLE OF clobjdat WITH HEADER LINE,
    it_alloc TYPE STANDARD TABLE OF api_kssk WITH HEADER LINE.
    CONSTANTS: c_class_nflag TYPE klah-class
    VALUE 'NFLAG',
    c_atnam_mrule TYPE clobjdat-atnam
    VALUE 'MRULE',
    c_ausp1_hss TYPE clobjdat-ausp1
    VALUE 'HSS',
    c_iflot TYPE tclt-obtab
    VALUE 'IFLOT',
    c_a(1) TYPE c VALUE 'A',
    c_b(1) TYPE c VALUE 'B',
    c_c(1) TYPE c VALUE 'C',
    c_x(1) TYPE c VALUE 'X',
    c_1(1) TYPE c VALUE '1',
    c_2(2) TYPE c VALUE '2'.
    DATA: v_object TYPE kssk-objek,
    v_class TYPE klah-class,
    v_ctyp TYPE klah-klart.
    DATA: it_status TYPE STANDARD TABLE OF jstat WITH HEADER LINE.
    break shrotrb.
    *Functional location M-Rule Critical Check
    *Get the Classes related to Functional location
    CLEAR f_mr_flag.
    v_object = e_viqmel-tplnr.
    DATA : v_key TYPE sy-ucomm.
    IF sy-ucomm EQ 'BUCH'.
    IMPORT v_key FROM MEMORY ID 'GKEY' .
    FREE MEMORY ID 'GKEY'.
    ENDIF.
    IF ( sy-ucomm EQ 'BUCH' AND ( v_key EQ 'WTER' OR
    v_key EQ 'BUCH' ) ) OR
    sy-ucomm EQ 'WTER'.
    CALL FUNCTION 'CLAP_DDB_GET_CLASSIFICATION'
    EXPORTING
    object = v_object
    obtab = c_iflot
    spras = sy-langu
    TABLES
    allocations = it_alloc
    EXCEPTIONS
    no_allocation = 1
    set_aennr = 2
    change_nr_not_exist = 3
    date_in_past = 4
    error_class = 5
    error_date_restriction = 6
    error_status = 7
    OTHERS = 8.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    CLEAR it_alloc.
    READ TABLE it_alloc WITH KEY class = c_class_nflag.
    IF sy-subrc EQ 0.
    v_class = it_alloc-class.
    v_ctyp = it_alloc-klart.
    *Get the characteristics of Class
    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    EXPORTING
    class = v_class
    classtext = c_x
    classtype = v_ctyp
    features = c_x
    language = sy-langu
    object = v_object
    TABLES
    t_class = it_classes
    t_objectdata = it_obj_data
    EXCEPTIONS
    no_classification = 1
    no_classtypes = 2
    invalid_class_type = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    CLEAR it_obj_data.
    ELSE.
    READ TABLE it_obj_data WITH KEY atnam = c_atnam_mrule
    ausp1 = c_ausp1_hss.
    IF sy-subrc EQ 0.
    f_mr_flag = c_x.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    IF ( f_mr_flag = c_x ).
    IF ( e_viqmel-wmmrule EQ c_a "WM:Maintenance rule applicability
    OR e_viqmel-wmmrule EQ c_b ).
    IF viqmsm-kzloesch = c_x AND "Delete Data Record
    IF e_viqmel-msaus NE c_x . "Break down indicator
    v_key = sy-ucomm.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
    titlebar = text-001
    text_question = text-002
    text_button_1 = text-006
    icon_button_1 = text-008
    text_button_2 = text-007
    icon_button_2 = text-009
    display_cancel_button = ' '
    IMPORTING
    answer = v_answer
    EXCEPTIONS
    text_not_found = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    IF v_answer = c_1. "Continue
    e_viqmel-msaus = c_x. "Breakdown indicator
    ELSEIF v_answer = c_2. "Cancel
    SET PF-STATUS 'IV2000'.
    EXPORT v_key TO MEMORY ID 'GKEY'.
    leave to screen '7200'.
    ENDIF.
    CLEAR v_answer.
    ELSEIF i_viqmel-msaus EQ c_x AND "Breakdown indicator
    i_viqmel-ausbs IS INITIAL AND "End of Malfunction(date)
    i_viqmel-auztb IS INITIAL. "End of Malfunction(time)
    MESSAGE e000(zpm1) WITH text-003. " Error Message
    ENDIF.
    ELSEIF i_viqmel-msaus EQ c_x . "Breakdown indicator
    v_key = sy-ucomm.
    CALL FUNCTION 'POPUP_TO_CONFIRM' "Pop-up to
    EXPORTING "auto uncheck the breakdown indicator"
    titlebar = text-001
    text_question = text-004
    text_button_1 = text-006
    icon_button_1 = text-008
    text_button_2 = text-007
    icon_button_2 = text-009
    display_cancel_button = ' '
    IMPORTING
    answer = v_answer
    EXCEPTIONS
    text_not_found = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    IF v_answer = c_1. "Continue
    e_viqmel-msaus = space. "Breakdown indicator
    ELSEIF v_answer = c_2. "Cancel
    EXPORT v_key TO MEMORY ID 'GKEY'.
    LEAVE SCREEN.
    ENDIF.
    CLEAR v_answer.
    ENDIF.
    ENDIF.
    ELSE.
    IF ( e_viqmel-wmmrule EQ c_a OR e_viqmel-wmmrule EQ c_b ) AND
    i_viqmel-msaus EQ c_x.
    v_key = sy-ucomm.
    CALL FUNCTION 'POPUP_TO_CONFIRM' "mrule component and auto unchecking
    EXPORTING "the breakdown indicator
    titlebar = text-001
    text_question = text-005
    text_button_1 = text-006
    icon_button_1 = text-008
    text_button_2 = text-007
    icon_button_2 = text-009
    display_cancel_button = ' '
    IMPORTING
    answer = v_answer
    EXCEPTIONS
    text_not_found = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    IF v_answer = c_1. "Continue
    e_viqmel-msaus = space. "Breakdown indicator
    ELSEIF v_answer = c_2. "Cancel
    EXPORT v_key TO MEMORY ID 'GKEY'.
    LEAVE SCREEN.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.

    Hi,
            pls explain the sceanario in brief so that we also will have clear understanding about requriement and we can give most suitable info.
    pls provide me more info so i can give suitable user-exist
    Regards
    Hari Shankar

  • Updating custom field in table EKKO within user exit when PO is saved

    I am trying to update a custom field in table EKKO when a PO is saved.  I am using FM EXIT_SAPMM06E_013, within enhancement MM06E005.  Since EKKO is not a table that can be updated with this user exit, I am using a technic that I read about on SDN where I assign a field symbol to the calling program variable and then am able to access data within EKKO table.  But when I pass this data back into the field symbol, for some reason this field is not getting saved when the PO is saved.  In debug mode, it looks like this field is getting updated, but when I look in the table after the PO is saved, it is not there.  My code sample is below.  What I am doing wrong?
    data:
      CHAR(50) VALUE '(SAPLMEPO)EKKO-ZHDRCSTCENTER',
      g_zhdrcstcenter like ekko-zhdrcstcenter,
      FIELD-SYMBOLS <F1> type any.
    if i_ekko-ekorg = '5401'.
      ASSIGN (char) to <F1>.
      g_zhdrcstcenter = <F1>.
      move '0000113322' to g_zhdrcstcenter.
      <F1> = g_zhdrcstcenter.
    endif.
    Thanks!
    Sarah Smyth.

    Firstly, have you investigated using EXIT_SAPMM06E_008 to set any custom fields you have added in the EKKO_CI / CI_EKKODB structure?.. that might work more easily.
    In terms of doing an assign back into a calling program's memory, it can work but it's probably worth setting a break point in your code then stepping through watching the values in EKKO - sometimes you can find subsequent code that re-writes an earlier copy of values back into the structure, thereby preventing you doing your change...  SAP does warn this method is for "internal use".  Also check in your debugger that it's SAPLMEPO and not SAPMM06E you need.

Maybe you are looking for