Code reusabilty for custom F4 helps

Hi Folks,
i want to reuse my code for F4 functionality like
im having two characterstics selections screen fields,
im creating custom f4 helps since both are same
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CHNAM1-LOW.
  PERFORM CHAR_F4_HELP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CHNAM2-LOW.
  PERFORM CHAR_F4_HELP.
FORM CHAR_F4_HELP .
DATA: BEGIN OF T_KLAH OCCURS 0,
     CLINT TYPE CLINT,
      END OF T_KLAH.
  DATA: BEGIN OF T_KSML OCCURS 0,
        IMERK TYPE ATINN,
        END OF T_KSML.
DATA: BEGIN OF T_CABN OCCURS 0,
        ATINN TYPE ATINN,
        ATNAM TYPE ATNAM,
        END OF T_CABN.
  DATA: BEGIN OF T_CABNT OCCURS 0,
       ATINN TYPE ATINN,
       SPRAS TYPE SPRAS,
       ATBEZ TYPE ATBEZ,
       END OF T_CABNT.
  DATA: BEGIN OF T_FINAL OCCURS 0,
        ATNAM TYPE ATNAM,
        ATBEZ TYPE ATBEZ,
          END OF T_FINAL.
  DATA: T_RETURN3 LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE,
        V_NEW TYPE P.
        w_cabns type atinn .
  IF NOT S_CLASS1 IS INITIAL.
    SELECT CLINT FROM KLAH INTO TABLE T_KLAH
                      WHERE KLART = '011' AND
                        CLASS =   S_CLASS1-LOW .
    IF NOT T_KLAH[] IS INITIAL.
      SELECT IMERK FROM KSML INTO TABLE T_KSML
        FOR ALL ENTRIES IN T_KLAH
                   WHERE CLINT = T_KLAH-CLINT.
    ENDIF.
    IF NOT T_KSML[] IS INITIAL.
      SELECT ATINN ATNAM FROM CABN INTO TABLE T_CABN
         FOR ALL ENTRIES IN T_KSML
             WHERE ATINN = T_KSML-IMERK.
      SELECT ATINN SPRAS ATBEZ FROM CABNT INTO TABLE T_CABNT
         FOR ALL ENTRIES IN T_KSML
                   WHERE ATINN = T_KSML-IMERK.
    ENDIF.
    REFRESH T_FINAL[].
    LOOP AT T_CABN.
      T_FINAL-ATNAM = T_CABN-ATNAM.
      READ TABLE T_CABNT WITH KEY ATINN = T_CABN-ATINN  SPRAS = 'E'.
      T_FINAL-ATBEZ = T_CABNT-ATBEZ.
      APPEND T_FINAL.
      CLEAR T_FINAL.
    ENDLOOP.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        RETFIELD        = 'ATNAM'
        DYNPPROG        = SY-CPROG
        DYNPNR          = SY-DYNNR
        DYNPROFIELD     = 'S_CHNAM1-LOW'
        VALUE_ORG       = 'S'
      TABLES
        VALUE_TAB       = T_FINAL
        RETURN_TAB      = T_RETURN3
      EXCEPTIONS
        PARAMETER_ERROR = 1
        NO_VALUES_FOUND = 2
        OTHERS          = 3.
    IF SY-SUBRC = 0.
      READ TABLE T_RETURN3 WITH KEY RETFIELD = 'S_CHNAM1-LOW'.
      IF SY-SUBRC EQ 0.
        S_CHNAM1-LOW = T_RETURN3-FIELDVAL.
        SELECT ATINN FROM CABN INTO W_CABNS
               WHERE ATNAM = T_RETURN3-FIELDVAL.
        ENDSELECT.
      ENDIF.
    ENDIF.
  ENDIF.
i want to use the same for my s_chnam2 , s_cham3 fields etc.,
please give some inputs.
Thanks,
Shwetha

FORM get_f4cvalues  USING    p_ifield
                  CHANGING   p_ofield
                             p_table TYPE ANY TABLE.
  TYPES : BEGIN OF t_cabnt,
           atinn TYPE atinn,
           spras TYPE spras,
           atbez TYPE atbez,
          END OF t_cabnt.
  TYPES : BEGIN OF t_cabn,
           atinn TYPE atinn,
           atnam TYPE atnam,
         END OF t_cabn.
  TYPES: BEGIN OF t_final,
          atnam TYPE atnam,
          atbez TYPE atbez,
        END OF t_final.
  DATA : lt_cabnt  TYPE STANDARD TABLE OF t_cabnt,
         lt_cabn   TYPE STANDARD TABLE OF t_cabn,
         lt_final  TYPE STANDARD TABLE OF t_final,
         lwa_cabnt TYPE t_cabnt,
         lwa_cabn  TYPE t_cabn,
         lwa_final TYPE t_final,
         lv_svalue TYPE dynpread-fieldvalue..
  DATA :  lt_return      TYPE STANDARD TABLE OF ddshretval, " Selected
          lwa_return     TYPE ddshretval.                  " Workarea
  PERFORM get_screen_values USING    p_ifield
                            CHANGING lv_svalue.
  IF v_fieldvalue <> lv_svalue.
    CLEAR : v_fieldvalue.
    v_fieldvalue = lv_svalue.
    CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'
      EXPORTING
        input  = lv_svalue
      IMPORTING
        output = lv_svalue.
    SELECT atinn
           atnam FROM cabn
                 INTO TABLE lt_cabn
                 WHERE atinn = lv_svalue.
    SELECT atinn
           spras
           atbez FROM cabnt
                 INTO TABLE lt_cabnt
                 WHERE atinn = lv_svalue.
    REFRESH : lt_final, p_table.
    LOOP AT lt_cabn INTO lwa_cabn.
      lwa_final-atnam = lwa_cabn-atnam.
      READ TABLE lt_cabnt INTO lwa_cabnt WITH KEY
                                            atinn = lwa_cabn-atinn
                                            spras = 'E'.
      IF sy-subrc = 0.
        lwa_final-atbez = lwa_cabnt-atbez.
      ENDIF.
      APPEND lwa_final TO lt_final.
      CLEAR : lwa_final, lwa_cabn, lwa_cabnt.
    ENDLOOP.
    SORT lt_final.
    p_table[] = lt_final[].
  ENDIF.
  lt_final[] = p_table[].
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'ATNAM'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      window_title    = 'Select Size'
      display         = ' '
      value_org       = 'S'
    TABLES
      value_tab       = lt_final
      return_tab      = lt_return
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
* Check whether LT_RETURN is blank
  CHECK NOT lt_return[] IS INITIAL.
  READ TABLE lt_return INTO lwa_return INDEX 1.
  CALL FUNCTION 'CONVERSION_EXIT_ATINN_OUTPUT'
    EXPORTING
      input  = lwa_return-fieldval
    IMPORTING
      output = p_ofield.
  REFRESH : lt_return.
  CLEAR : lwa_return.
ENDFORM.                    " GET_F4CVALUES
FORM get_screen_values  USING    p_ifield
                        CHANGING p_svalue.
  DATA : lt_dynpread   TYPE  STANDARD TABLE OF dynpread,
         lwa_dynpread  TYPE dynpread,
         lv_repid      TYPE sy-repid.
  lwa_dynpread-fieldname = p_ifield.
  APPEND lwa_dynpread TO lt_dynpread.
  CLEAR lwa_dynpread.
  lv_repid = sy-repid.
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname                         = lv_repid
      dynumb                         = '1000'
*   TRANSLATE_TO_UPPER             = ' '
*   REQUEST                        = ' '
*   PERFORM_CONVERSION_EXITS       = ' '
*   PERFORM_INPUT_CONVERSION       = ' '
*   DETERMINE_LOOP_INDEX           = ' '
    TABLES
      dynpfields                     = lt_dynpread
   EXCEPTIONS
     invalid_abapworkarea           = 1
     invalid_dynprofield            = 2
     invalid_dynproname             = 3
     invalid_dynpronummer           = 4
     invalid_request                = 5
     no_fielddescription            = 6
     invalid_parameter              = 7
     undefind_error                 = 8
     double_conversion              = 9
     stepl_not_found                = 10
     OTHERS                         = 11
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  READ TABLE lt_dynpread INTO lwa_dynpread INDEX 1.
  IF sy-subrc = 0.
    p_svalue = lwa_dynpread-fieldvalue.
  ENDIF.
ENDFORM.                    " GET_SCREEN_VALUES
Thanks & Regards
Bala Krishna

Similar Messages

  • Update tool-tip for customized portal Help URL

    I have customized the Help Link in Portal Masthead with our own URL. It works fine. However, when the user moves their mouse over the "Help" link, the tool-tip still shows the original text, i.e. "Display the online help ...". How can I also customize the tool-tip of the customized Help URL?
    Thanks.

    Hi,
    you'll have to customize the masthead application. This text is saved in the file:
    PORTAL-INF\private\classes\headeriView_nls.properties -> pick the one that matches your language.
    The String you'll have to modify is:
    HELP_TOOLTIP=Display the online help for more information about the portal
    Change it, save the file and create the PAR again (it's only to zip, nothing to compile) and deploy it.
    br,
    Tobias

  • Company code data for custom replicated from CRM

    Hi,
    I am trying to default the company code data for a BP replicated from CRM as a customer but it is not working.
    How should this be done in CRM 7.0, ECC 6.
    I am have so far copied function module SAMPLE_INTERFACE_DE_BALE, added my own code and created the entry in table TBE34. But it doesn't work.  Is this correct or is there another method?
    regards
    Tim

    This is what we did wen we had a similar requirement...
    u2022     In the ECC create a FM u2018Z_USER_EXIT_BEFORE_SEND_TO_MWu2019.
    u2022     Register this function module for the CRM0_200 exit user in the ERP system.
    a.     Use Transaction SM30, table TPS34, to go to the maintenance of the modules. Here, enter the Z_USER_EXIT_BEFORE_SEND_TO_MWu2019 module for the CRM0_200 process.
    b.     Use Transaction SM30, table TBE24, to check whether the application you have selected (Product column in TPS34) is active.
    u2022     The FM will be triggered whenever a Sold gets successfully replicated from CRM to ECC system.
    a.     Check for the Object Class u2018BUPAu2019.
    b.     Check for the Object Name u2018CUSTOMER_MAINu2019.
    c.     If yes copy the BP GUID from the BAPIMTCS Structure.
    d.     Now call rfc FM ZLSD_BP_EXTRACT_FRM_GUID in CRM to get the BP number and Acc Group for the respective GUID.
    e.     Check if the ACC GRP is Z001.
    f.     If yes make a BDC call to transaction FD01 and update the Company Code data u2026. Recon. Account     110000
                                 Terms Of Payment ZN30       
                               for the  respective BP
    Note: we have recorded a BDC program to create the company code data.
    regards,
    Sameer Ahamad

  • Transaction codes/path for Customer(Sold To) and related associations

    Hello all,
    being very new to this, can any one tell me the transactions/path to add the records in tables
    KNVS-Customer master shipping data
    KNVP-Customer master partner functions(Sold to Ship to association)
    KNVV-Customer master sales data
    TVKBT-Organizational Unit: Sales Offices: Texts
    TVKWZ-Org.Unit: Allowed Plants per Sales Organization
    T001L-Storage Locations
    T001W-Plants/Branches
    Is it possible to add new records to these table through trancations or is there any other way?
    Please help me out.
    Regards,
    Sandip

    Hi,
    Welcome to SDN forum
    KNVV, KNVS, KNVP are maintained in the Transaction code in XD01
    TVKBT  this is assigning Text in OUTPUTS for sales office
    Path: SPRO->SD->BASIC FUNCTIONS>OUTPUT DETERMINATION>ASSIGN FORM TEXTS-->
    TVKWZ:   OVX6
    T001L:  OX09
    T001W: OX10.
    thanks,
    santosh

  • Code snippet for custom scheduler

    Hi,
    I need to write a custom scheduler as per one of the solutions present in doc in metalink (doc id:1109539.1). Few lines of information in the doc is as below:
    A better solution is to:
    1. Create a custom scheduled task.
    2. The task should run every 10 minutes, and should do a simple call to the server using the singleton instance.
    3. This will assure that the instance is kept alive, hence it will not timeout.
    As per the above solution, what exactly is meant by "do a simple call to the server using the singleton instance". Does anyone help me to provide a code snippet to do the same.
    Thanks
    DPK

    That Metalink ID is not related to your requirement.
    It is a workaround if someone is using Singleton Pattern in their code.
    If they are using Singleton then session will expire after some time and it throws error that's why they are suggesting to use that instance by creating a schedule task after every 10 min so that instance should be alive. It's no where related to your use case. Don't use Singleton Pattern in your code.
    You can read here about Singleton
    http://java.sun.com/developer/technicalArticles/Programming/singletons/

  • Code assist for custom tags

    Hi everybody,
    I'm working with Facelets and have just defined some custon tags (using
    com.sun.facelets.tag.AbstractTagLibrary) which works just fine.
    But how do I get content assist for those???
    Do I have to create some tld-file?
    Thanks in advance :-)
    Tory

    ok, now I'm confused.... I don't have a TLD file at all. I use the
    com.sun.facelets.tag.AbstractTagLibrary
    to define the new tags. (and that works fine). I thought I'll need a TLD file to get content assist...
    So, any idea how I can get it for my custom tags (or is it impossible)
    Or does anyone know how content assist works on standard tags?
    Thanks in advance,
    Tory
    Edited by: tory77 on Aug 19, 2008 6:48 AM

  • HT4623 After 7.0.2 update to iPhone 4 the key pad response is up to 10 seconds for the security code and for text. Help?

    Post 7.0.2 update the response time from keying security code and text is up to 10 seconds. Help please?

    Post 7.0.2 update the response time from keying security code and text is up to 10 seconds. Help please?

  • Error in the ABAP Code for Customer Exit Variable

    Could you please update me what is the wrong with the below ABAP Code developed for Customer Exit Variable in BW
    i created a Variable (ZVWKNO) of Customer Exit,Single Value ,Mandatory and Variable is ready for input
    In CMOD i had written the below Code:
    When 'ZVWKNO'.
    DATA: WEEK(2) TYPE N,
    WEEKNO(2) TYPE N.
    IF i_step = 1.
    l_st_date = SY-DATUM.
    CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
    DATE = l_st_date
    IMPORTING
    WEEK = l_fn_week.
    CHECK sy-subrc = 0.
    WEEK = l_fn_week+4(2).
    If WEEK 0.
    WEEKNO = WEEK - 1.
    l_s_range-low = WEEKNO.
    l_s_range-sign = k_sign_inclusive.
    l_s_range-opt = k_option_equals.
    APPEND l_s_range to e_t_range.
    ENDIF.
    ENDIF.
    But when i execute the query the default value is not populated with Week-1 No in the variable screen
    Please update me what went wrong
    Thanks

    Case ZVWKNO.                "write this with out comments
    When '1'.              "write the value that needs to equal with value in varaible ZVWKNO after when in sungle quotes
    DATA: WEEK(2) TYPE N,
    WEEKNO(2) TYPE N.
    IF i_step = 1.
    l_st_date = SY-DATUM.
    CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
    DATE = l_st_date
    IMPORTING
    WEEK = l_fn_week.
    CHECK sy-subrc = 0.
    WEEK = l_fn_week+4(2).
    If WEEK 0.                                    "check this Week Minimum is '01' and Maximum '52'
    WEEKNO = WEEK - 1.
    l_s_range-low = WEEKNO.
    l_s_range-sign = k_sign_inclusive.
    l_s_range-opt = k_option_equals.
    APPEND l_s_range to e_t_range.
    ENDIF.
    ENDIF.
    Prabhudas

  • Search help for custom field in SRM

    Hi All,
    Im new to abap. I want to add(enhancement) custom input field with search help function for organization unit. I hv added input field and its displaying in portal also.
    Now i want to add f4 help. Can u please help me in this regard. Can u tell me the steps to do for adding f4 help.
    Thanks,
    Rani.

    add search help to input fields data type. or you could assign search help via structure there that field is defined. you could enhance standard code adding custom search help which is called via FM. Choose the way.
    best regards,
    dez_

  • Search Help for Custom field in Sourcing Cockpit

    Hi SRM Experts,
    I added custom field "rush order" in the Structures as per requirement. I added code in MODIFY_SCREEN function module. Search help is working for "rush order" in Process Purchase Orders (to search PO) and Check Status (Searching Shopping Cart). But it is not working in sourcing cockpit. Please guide or suggest me is there any additional settings or programming is required to have search help for custom fields in Sourcing Cockpit.
    Thanks a lot in advance.
    Thanks,
    Koyya

    Hi SRM Experts,
    Please let me know any suggestion on this issue.
    Thanks a lot in advance.
    Thanks,
    Koyya

  • Custom process code and FM for custom IDoc...

    Hello Experts,
    I created a custom IDoc based from ARTMAS05 IDoc. This is because we only need 3 segments and
    the standard idoc(Artmas05) contains so many segments that we need.
    Now, will I create a custom process code and FM for this? how do I go about this?
    Thank you guys and take care!

    Hello,
                 Here are the Steps that we need to be following while creating a Custom Process Code with Custom Function Module. ( Since the Segments to be handled are very Less, I am recommending that you go for a Custom Function Module).
    1. Go to SE37 Create a Function Module. Please ensure to Create it with the IMPORT / EXPORT /TABLES parameters exactly in the way that they exist in any Standard SAP Inbound FM (Refer to IDOC_INPUT_ORDERS for example).
    2. Once our FM is Ready (Need not be Complete with the Code to go ahead with the Process Code Creation) and Active, the next Step is to Create an Entry in the Transaction Code BD51 where we will register the Function Module.
    3. Next, we'll have to go to T-Code WE57 where we'll have to make an entry for the Function Module with the IDoc Type & Message Type.
    4. Finally, go to WE42 and Create a New Process Code and assign the Function Module and the Message Type.
    NOTE 1 : The Process Code is, as we know, Client Dependent. So, once you create a Process Code, we need to have it migrated to the Testing Environment to Start & Carry Out Testing.
    NOTE 2: If Step 2 & 3 are missing, then we'll not be able to assign the Function Module in WE42 while Creating Process Code.
    Hope it was helpful.
    Thanks and Regards,
    Venkata Phani Prasad K

  • ABAP Help for customer exit

    Hi All, I need help with ABAP code for customer exit for formula variable. I have ZVKDATE as formula var from customer exit. user enters date in ZVKEYDT(this is selection type var). I have the below code, I debugged it the l_var_range-low get the date but when I append it to e_t_range the table doesn't gets the date. The report shows the ZVKDATE has empty demarcation. kindly help.
    data l_var_range like rrrangeexit.
    data: l_s_range type RSR_s_RANGESID.
    data: w_day(2) type c,
          w_mth(2) type c,
          w_year(4) type c.
    define append_range_table.
    l_s_range-low = &1.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    append l_s_range to e_t_range.
    end-of-definition.
    *Activities performed before selection screen pop-up window
    if i_step = 2.
    Calculate the current date based on system date
      case i_vnam.
        when 'ZVKDATE'.
          read table i_t_var_range into l_var_range
                            with key vnam = 'ZVKEYDAT'.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          w_day = l_var_range-low+6(2).
          w_mth = l_var_range-low+4(2).
          w_year = l_var_range-low(4).
          concatenate w_year w_mth w_day into l_var_range-low.
          append l_s_range to e_t_range.
      endcase.
    endif.
    puneet

    Hi,
    Check your code again. You are not appending l_var_range but l_s_range. Also I think the concatenate statement should contain l_s_range-low instead of l_var_range-low.
    Hope this will help you.
    Regards,
    Vaibhav

  • Help Needed: Enable local currency for Customer Invoicing

    We are needing to enable local currency for customer invoicing on a project coming very soon.  Does anyone have any information on the best way to get this done and/or documentation to look over?  Any help would be greatly appreciated!!
    Thank You in Advance!
    Jay Esparza
    SAP Functional Consultant

    Hi
    Local currency automatically gets activated as you set your company code currency.
    No need to enable separately for customer invoicing
    Plz assign points if it is helpful.
    Regards
    Tapan

  • Shipto search help for customer

    Hi Experts,
    Can anybody help on my requirement.
    Requirement:
    I have field KUNNR as my selection screen(select option).
    Whenever user get F4 help of  customer ,Customer number will always
    be ship to. A drop down selection is required to search for the ship to.
    For my requirement I want to create custom search help,need to assign that searchhelp to field KUNNR.
    I want to pick          Kunnr
                                    parvw = 'SH'  from KNVV.
    Can anyone help me on logic? and how to assign it?
    Thanking you...
    Best Regards,
    Rekha.

    Hi
              Use below Code snippet
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR Kunnr-low.
       PERFORM f4helpShipto.
    form f4helpShipto.
    TYPES :  BEGIN OF ty_Kunnr,
                 KUNNR TYPE KNA1-KUNNR,
                 NAME1 TYPE KNA1-NAME1,
                 ORT01 TYPE  KNA1-ORT01,
                END OF ty_KUNNR.
       DATA: it_help TYPE STANDARD TABLE OF ty_KUNNR INITIAL SIZE 0,
           wa_help TYPE ty_KUNNR,
           it_return TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE,
           wa_return LIKE LINE OF it_return.
       SELECT K~KUNNR K~NAME1 K~ORT01 FROM KNA1 AS K
         INNER JOIN KNVP AS P ON P~KUNNR EQ K-KUNN2
    INTO  TABLE it_help
    WHERE K~PARVW EQ 'WE'.
       CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
         EXPORTING
           retfield        = 'KUNNR'
           dynpprog        = sy-repid
           dynpnr          = sy-dynnr
           value_org       = 'S'
           dynprofield     = 'KUNNR'
           window_title    = 'SHIP TO PARTY HELP'
         TABLES
           value_tab       = it_help
           return_tab      = it_return
         EXCEPTIONS
           parameter_error = 1
           no_values_found = 2
           OTHERS          = 3.
    endform.
    Regards:
    Somendra

  • According to postal code should block the purticular material for customer

    In sales order According to postal code should block the purticular material for the customer.for this Can I go for User exit?can anyone explain how to do this?I m new to user exit.

    You can use the material listing/exclusion in SD cutomizing, instead of writing a userexit. SPRO: sales-> basic functions -> listing/exclusion
    Here you can define the criteria and make tables and accesses that manage this kind of problem without writing code.
    pls. reward points if helpful
    regards
    Roberto

Maybe you are looking for