About function module in alv

hai all
iwant to know about few function modules in alv
1) reuse_alv_default_varients_get.
2)reuse alv_varients_f4
what is the use of these function modules
how to use these function modules, what r the structures used to use these function module. where to pass this in
in list and grid display function modules.
plz help me.
thanks & regards
sindu

HI,
check this.
REPORT Z_TEST_alv_variant .
TYPE-POOLS : SLIS.
PARAMETERS: ONE RADIOBUTTON GROUP G1 DEFAULT 'X',
            TWO RADIOBUTTON GROUP G1.
DATA: BEGIN OF I_TAB OCCURS 0,
FIELD1 TYPE I,
FIELD2 TYPE I,
END OF I_TAB.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: L_VARIANT TYPE DISVARIANT,
      LX_VARIANT LIKE DISVARIANT,
      L_SAVE TYPE C,
      L_EXIT(1) TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-VAR.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK 0.
INITIALIZATION.
  L_SAVE = 'A'.
  PERFORM VARIANT_INIT.
Get default variant
  LX_VARIANT = L_VARIANT.
  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      I_SAVE     = L_SAVE
    CHANGING
      CS_VARIANT = LX_VARIANT
    EXCEPTIONS
      NOT_FOUND  = 2.
  IF SY-SUBRC = 0.
    P_VARI = LX_VARIANT-VARIANT.
  ENDIF.
Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
  PERFORM F4_FOR_VARIANT.
  I_TAB-FIELD1 = 19.
  I_TAB-FIELD2 = 20.
  APPEND I_TAB.
  I_TAB-FIELD1 = 19.
  I_TAB-FIELD2 = 20.
  APPEND I_TAB.
  I_TAB-FIELD1 = 19.
  I_TAB-FIELD2 = 20.
  APPEND I_TAB.
  I_TAB-FIELD1 = 19.
  I_TAB-FIELD2 = 20.
  APPEND I_TAB.
  I_TAB-FIELD1 = 19.
  I_TAB-FIELD2 = 20.
  APPEND I_TAB.
  PERFORM INITIALIZE_FIELDCAT USING GT_FIELDCAT[].
  PERFORM CALL_ALV  TABLES I_TAB[]
                   USING GT_FIELDCAT.
*& Form initialize_fieldcat
text
-->P_GT_FIELDCAT[] text
FORM INITIALIZE_FIELDCAT USING L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
  LS_FIELDCAT-FIELDNAME = 'FIELD1'.
  LS_FIELDCAT-KEY = 'X'.
  LS_FIELDCAT-COL_POS = 1.
  LS_FIELDCAT-SELTEXT_S = 'Work center'.
  LS_FIELDCAT-SELTEXT_L = 'Work center'.
  APPEND LS_FIELDCAT TO L_FIELDCAT.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-FIELDNAME = 'FIELD2'.
  LS_FIELDCAT-KEY = ' '.
  LS_FIELDCAT-COL_POS = 2.
  LS_FIELDCAT-SELTEXT_S = 'Work center2'.
  LS_FIELDCAT-SELTEXT_L = 'Work center2'.
  APPEND LS_FIELDCAT TO L_FIELDCAT.
  CLEAR LS_FIELDCAT.
ENDFORM. " initialize_fieldcat
*&      Form  call_alv
      text
     -->P_GT_FIELDCAT  text
     -->P_I_TAB  text
FORM CALL_ALV  TABLES   P_TAB
                USING    P_GT_FIELDCAT .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
      IT_FIELDCAT        = P_GT_FIELDCAT
      I_DEFAULT          = 'X'
      IS_VARIANT         = L_VARIANT
      I_SAVE             = L_SAVE
    TABLES
      T_OUTTAB           = P_TAB[]
    EXCEPTIONS
      PROGRAM_ERROR      = 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.
ENDFORM.                    " call_alv
*&      Form  VARIANT_INIT
      text
FORM VARIANT_INIT.
  CLEAR L_VARIANT.
  L_VARIANT-REPORT = SY-REPID.
ENDFORM.                               " VARIANT_INIT
*&      Form  variant_SELECTION_SCREEN
      text
FORM VARIANT_SELECTION_SCREEN .
  IF NOT P_VARI IS INITIAL.
    MOVE L_VARIANT TO LX_VARIANT.
    MOVE P_VARI TO LX_VARIANT-VARIANT.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        I_SAVE     = L_SAVE
      CHANGING
        CS_VARIANT = LX_VARIANT.
    L_VARIANT = LX_VARIANT.
  ELSE.
    PERFORM VARIANT_INIT.
  ENDIF.
ENDFORM.                    " variant_SELECTION_SCREEN
*&      Form  F4_FOR_VARIANT
      text
FORM F4_FOR_VARIANT.
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      IS_VARIANT = L_VARIANT
      I_SAVE     = L_SAVE
    IMPORTING
      E_EXIT     = L_EXIT
      ES_VARIANT = LX_VARIANT
    EXCEPTIONS
      NOT_FOUND  = 2.
  IF SY-SUBRC = 2.
    MESSAGE ID SY-MSGID TYPE 'S'      NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE.
    IF L_EXIT = SPACE.
      P_VARI = LX_VARIANT-VARIANT.
    ENDIF.
  ENDIF.
ENDFORM.                    "F4_FOR_VARIANT
Regards,
Laxmi.

Similar Messages

  • What is the difference b/w ALV Function Module and ALV Methods?

    Hello Friends,
          Can anybody help me in finding out the difference between ALV Function Modules and ALV methods?
    Thanks & Regards
    Sathish Kumar

    Hi Sathish,
    Plz go through this info. It is very useful.
    hi,
    chk these excellent links.
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    OOPs:
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    Rewords some points if it is helpful.
    Rgds,
    P.Naganjana Reddy

  • HOW TO USE FUNCTION MODULE IN ALV

    hi guyz
    I developed an alv report using join statements .But i got all that fields in a function module. so how can i use function module in alv .
    if i got a function module with all the fileds do i need to use select statement.
    plz help me.
    thanks
    sudheer

    Hi,
    Hope the following helps..
    1)
    LOOP AT IT_OUTPUT.
    Call the function module to get the tracking number and store the output in the
    variable V_TRACKINGNO.
      IT_OUTPUT-TRACKING_NO = V_TRACKINGNO.
      MODIFY IT_OUTPUT TRANSPORTING TRACKING_NO.
    ENDLOOP.
    2) Date conversion
    DATA: V_CHAR(10) VALUE '2006.11.17'.
    DATA: V_DATE       TYPE SYDATUM.
    CONCATENATE V_CHAR(4) V_CHAR5(2) V_CHAR8(2) INTO V_DATE.
    WRITE: V_DATE TO V_CHAR MM/DD/YYYY.
    WRITE: / 'MM/DD/YYY Format - ',  V_CHAR.
    Please make sure to reward points for helpful answers..
    Thanks,
    Naren

  • Regarding variant function module in alv

    hi,
        could any body tell about the function modules
    reuse_alv_variant_default_get
    reuse_alv_variant_f4
    reuse_alv_variant_existence
               and how to use it.(by giving an example program)
    Regards,
    Pavan.

    reuse_alv_variant_default_get - Provides the default variant for the list specified in the structure parameter CS_VARIANT of a program.
    reuse_alv_variant_f4 - Display variant selection dialog box. Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.
    reuse_alv_variant_existence - This function module checks the existence in the database of a display variant passed in the interface.
    Check the Link for Example REUSE_ALV_VARIANT_F4' how to use it when we iuse it
    Kanagaraja L
    Edited by: Kanagaraja  Lokanathan on Jan 17, 2008 5:39 AM

  • About Function module reltate to Enhancement

    Hi All,
    i need to know about the Usage and purpose of the function module FKK_BP_BADI_UPDATE.
    Kindly help me to know about this function module

    Hi Venkat,
    The function module BAPI_CUBE_GETDETAIL provides you the detials of infocube (including dimension, characteristics, keyfigures etc).
    Moreoverthis FM is RFC enabled; so you can call this FM from DEV and pass RFC connection of PROD to get detials of the cube in prod. This compare the structures between DEV and PROD.
    Similarly you can use BAPI_ODSO_GETDETAIL from DSO structure comparision across the system landscape.
    Thanks
    Vasu

  • Table that stores information about function module

    Hi All,
    I know that table TFDIR stores primary information about any function module.
    Could anyone tell me where the code of that function module gets stored in?
    Also.. If I want to write an ABAP code to read the function module code then what is the best possible solution?
    Thanks in advace and any answer will be appreciated.
    Regards
    Jignesh

    Hi All,
    Apologies for the same!
    The codes are not stored in any table, they are stored as cluster.
    To read the code, you can use READ REPORT.
    But there you must provide the Include Name For Example , If you want to read the code of READ_TEXT,
    READ REPORT 'LSTXDU01'.
    You can get this include name inside include LSTXDUXX
    Table TFDIR also stores the program name and include number.
    You need to truncate first 3 char 'SAP' and append UXX at the end and that will be your program name.
    Then we can use READ REPORT!!!
    Regards
    Jignesh

  • ABOUT FUNCTION MODULE  (urgent)

    hi ,
    is any one know about below function module.
    CUST_ACCT_STMT_REQUEST_LITE
    we schedule customer account statement in th background.
    we want to add some functionality.
    if any one know anything then it will be appreciated.
    thans,
    jack

    Hi,
    I am giving the Function Modules list link, from there you can findout which is suitable for your application:
    http://sap-img.com/abap/function-list.htm
    Regards,
    Bhaskar

  • About Function module 'PRICING'

    Hi experts,
    Now My requirement is get all contract condition data. If I don't want to create a new contract to get these condition data, I can use Function module 'PRICING' to get all condition data. But the question is the parameter COMM_ITEM_I is a structure, it only can store a record(single material). If the contract has many item, eg Service + Goods............ How to process this scenario? If you have experience in this, please give me any idea. Thanks in advance!
    function pricing.
    ""Globale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(CALCULATION_TYPE) LIKE  KOMV-KSTEU DEFAULT 'A'
    *"     VALUE(COMM_HEAD_I) LIKE  KOMK STRUCTURE  KOMK
    *"     VALUE(COMM_ITEM_I) LIKE  KOMP STRUCTURE  KOMP
    *"     VALUE(PRELIMINARY) TYPE  C DEFAULT ' '
    *"     VALUE(NO_CALCULATION) TYPE  C DEFAULT ' '
    *"  EXPORTING
    *"     VALUE(COMM_HEAD_E) LIKE  KOMK STRUCTURE  KOMK
    *"     VALUE(COMM_ITEM_E) LIKE  KOMP STRUCTURE  KOMP
    *"  TABLES
    *"      TKOMV STRUCTURE  KOMV
    *"      SVBAP STRUCTURE  VBAPU OPTIONAL
    *"  CHANGING
    *"     VALUE(REBATE_DETERMINED) TYPE  C DEFAULT ' '

    Hi,
    I guess contracts will be found in EKKO, not in VBAK. Correct me if I am wrong.
    If I am correct, you can use the BAPI "BAPI_PO_GETDETAIL1". POCONDHEADER and POCOND inporting tables will retrieve pricing information.
    Regards,
    Ganga

  • Query about  Function Module  'RSPO_RETURN_SPOOLJOB'

    Hi all,
         I am currently working on a report that takes the SPOOL NO. for the back ground runned job and passes to the Function module 'RSPO_RETURN_SPOOLJOB' that gives the data in BUFFER after reading this data I am converting it to the excel format and sending it as an attached mail to the specified recepient.
         But the FM mentioned is getting data in weird manner. I am converting it to excel format as we do for the normal internal table data being converted to excel format. But the problem is ragarding the data...
         Is there a way to covert this data into excel format? Or is there any other function Module that converts the data into excel format for the job. If it is there then let me know...
    regards,
    Brijesh Patel

    I have not used this myself, but check if this works for you.
    RSPO_DOWNLOAD_SPOOLJOB
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • Doubt About Function Module

    Hi Experts,
    I want one function module which wil allows us to attach a attachment to the material in the SAP PLM System.
    Please clear my doubt . Why Because i got strucked here in this issue of selecting a right Function Module.
    Please clear my doubt. Helpful ANswers wil be Reward.
    Regards
    Khanna

    Hi khanna,
    try this MATERIAL_MAINT_DIAL_GET_DOC Functional Module for attachment in Material Master,
    In DIR try this CV110_DOC_ASSIGN_FILE,
    Regards
    Rehman

  • Question about Function Module ME_PO_PRICE_SIMULATION

    Hi experts,
    I am trying to solve an issue concerning the importing parameter I_ROLL_BACK of the function module ME_PO_PRICE_SIMULATION.
    Inside the coding of the user-exit ZXM06U44 (executed after saving a purchase order) there is a call to the function module ME_PO_PRICE_SIMULATION with this importing parameter set to true. In that case, purchase order is not created. Otherwise if I modify this value into false the order is created appropriately.
    Could someone more functional explain me what is the meaning of this parameter. I try to read the documentation but is in German, so I don't understand anything.
    Lots of thanks,
    Javier

    This is what happens inside the FM using I_ROLL_BACK:
    To understand what a rollback statement does, have a look at this:
    https://help.sap.com/abapdocu_70/en/ABAPROLLBACK.htm

  • Question about function Module

    Hi Expert,
             First tell me What is function Module & its working?
    And second is how to call dynamically function module?
    Moderator message : Search for available information, read forum rules before posting.  Thread locked.
    Edited by: Vinod Kumar on Nov 9, 2011 4:57 PM

    This is what happens inside the FM using I_ROLL_BACK:
    To understand what a rollback statement does, have a look at this:
    https://help.sap.com/abapdocu_70/en/ABAPROLLBACK.htm

  • About function module"IDOC_XML_TRANSFORM"?

    Hi Gurus:
         When i do the "IDOC_XML_TRANSFORM",where can i find the exporting file which is in  XML format?
         Thanks for advanced!
    alex zhang

    Check with below link :
    Re: IDOCS_OUTPUT_IN_XML_FORMAT -- IDOCS_OUTPUT_TO_FILE
    Re: any function module to write-xml schema of a idoctype to an internal table
    /people/michal.krawczyk2/blog/2005/11/13/xi-how-to-check-your-idocs-on-a-web-page-from-sapgui -> this will help you
    Thanks
    Seshu

  • About function module

    "FM_SELECTION_CRITERIA_PRINT"
    What is its use ? There is documentation available in english.

    hi,
    for documentation to the function module "FM_SELECTION_CRITERIA_PRINT"
    procedure to getting the Document.
    se37-->provide function module name-->select the option Document , then u will get the documentation provided by SAP.
    <u>for knowing the Use of FM    <b>FM_SELECTION_CRITERIA_PRINT</b></u>
    REPORT ZVVRLPOP.
    TABLES USR01.
    SELECT-OPTIONS: S_USER  FOR USR01-BNAME,
                    S_LANGU FOR USR01-LANGU.
    PARAMETER:      P_NAME(12) DEFAULT 'Victor',
                    P_CITY(12) DEFAULT 'Minsk'.
    DATA: BEGIN OF INFOTAB OCCURS 0,
            FLAG,
            OLENGTH TYPE X,
            LINE LIKE RSVAR-INFOLINE,
          END OF INFOTAB.
    *---- 1st -
    write / '1st: PRINT_SELECTIONS' color col_key.
    CALL FUNCTION 'PRINT_SELECTIONS'
         EXPORTING
              MODE      = 1
              RNAME     = SY-CPROG
              RVARIANTE = SY-SLSET
         TABLES
              INFOTAB   = INFOTAB
         EXCEPTIONS
              OTHERS    = 1.
    LOOP AT INFOTAB.
      WRITE: / '=>', INFOTAB-LINE.
    ENDLOOP.
    *---- 2nd -
    write / '2nd: FM_SELECTION_CRITERIA_PRINT' color col_key.
    CALL FUNCTION 'FM_SELECTION_CRITERIA_PRINT'
         EXPORTING
              I_REPORT_NAME = SY-CPROG
         EXCEPTIONS
              OTHERS        = 1.
    write / 'End of data.' color col_key.
    regards,
    sudheer.

  • About function module for personnel no

    is there any function module to provide search help for personnel no with search criterias.similarly for applicant nos also.can one help on this.

    Hello Murthy,
    I have read all the three of your latest posts. And they all seem very much related to me. I shall try to explain things out to you. Please get back with doubts and / or reward points :-).
    For Personnel Number, you can use the search help <b>PREM</b> provided by SAP.
    For Applicant No., the standard search help is <b>PAPM</b>.
    You just need to attach these search helps to your screen elements.
    Regards,
    Anand Mandalika.

Maybe you are looking for