Alv grid push button functionality

Hi all,
         I have a push button as one of the fields in fieldcatalog.i am using class cl_gui_alv_grid .
  I want that when that push button is clicked then some action should take place.
How can i get user action on clicking that Push button.
please reply soon with some sample code
regards,
kushagra

Hi,
Reference:http://www.erpgenie.com/sap/abap/controls/alvgrid.htm
Note that this example uses table ZSFLIGHT. The table is equivalent to the table SFLIGHT.
Steps:
Create an executable program (Report)
Create a screen (100) and place a custom container named ALV_CONTAINER on the screen
Create a Pushbutton. Give it the text Exit and the functioncode EXIT
   REPORT sapmz_hf_alv_grid .
   TABLES: zsflight.
G L O B A L   I N T E R N  A L   T A B L E S
   DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
G L O B A L   D A T A
   DATA: ok_code LIKE sy-ucomm,
         g_wa_sflight LIKE sflight.
Declare reference variables to the ALV grid and the container
   DATA:
     go_grid             TYPE REF TO cl_gui_alv_grid,
     go_custom_container TYPE REF TO cl_gui_custom_container.
S T A R T - O F - S E L E C T I O N.
   START-OF-SELECTION.
     SET SCREEN '100'.
   *&      Module  USER_COMMAND_0100  INPUT
   MODULE user_command_0100 INPUT.
     CASE ok_code.
       WHEN 'EXIT'.
         LEAVE TO SCREEN 0.
     ENDCASE.
   ENDMODULE.                 " USER_COMMAND_0100  INPUT
   *&      Module  STATUS_0100  OUTPUT
   MODULE status_0100 OUTPUT.
Create objects
     IF go_custom_container IS INITIAL.
       CREATE OBJECT go_custom_container
         EXPORTING container_name = 'ALV_CONTAINER'.
       CREATE OBJECT go_grid
         EXPORTING
           i_parent = go_custom_container.
       PERFORM load_data_into_grid.
     ENDIF.
   ENDMODULE.                 " STATUS_0100  OUTPUT
   *&      Form  load_data_into_grid
   FORM load_data_into_grid.
Read data from table SFLIGHT
     SELECT *
       FROM zsflight
       INTO TABLE gi_sflight.
Load data into the grid and display them
     CALL METHOD go_grid->set_table_for_first_display
       EXPORTING i_structure_name = 'SFLIGHT'
       CHANGING  it_outtab        = gi_sflight.
   ENDFORM.                    " load_data_into_grid
Reward points if helpful.
Regards,
Ramya

Similar Messages

  • How to create a secondary list of alv grid inside the function module

    Hi All,
    My requirement is to create a RFC function module to display the alv grid of one table.
    i have created that.
    while clicking on the records of the alv it should open the secondary list of another table.
    My problem is it is not fetching the records of the internal table of the primary list since it is created inside the function module(FUNCTION...ENDFUNCTION).
    pls help me on this.
    Thanks in Advance.

    hi,
    READ TABLE sel_sheet INTO wa_sheet INDEX rs_selfield-tabindex.
    here sel_sheet is the internal table for the primary list..
    i called the function module "reuse_lav_grid_display" inside Function...Endfunction.
    so when i am using  READ TABLE sel_sheet INTO wa_sheet INDEX rs_selfield-tabindex.
    inside the user command perform therecords in this internal table is not populating..
    pls help me on this.
    thanks in advance.

  • AlV Grid Standard Buttons

    Hi ,
                How to remove the standard buttons on the WD4A alv grid like View (Std. View) , Print Version , Export , Filter , Settings.
    Thanks,
    Kumar

    How did u solved ?

  • F4 help in ALV grid by using function module?

    Hi,
    I need to get f4 search help in ALV grid for a certain fields by using function module method.
    Please guide me.
    Thank You.

    Hi
    F4IF_INT_TABLE_VALUE_REQUEST  use this fm to get f4 search help for a certain fields .
    Regards
    Divya

  • Alv Grid     - back button

    Hi,
    My programs output displays an ALV Grid. Am selecting multiple rows on the grid through multi select button and with the help of a button on tool bar i could delete the rows selected in ALV grid. But when i pressed on back button which is present in the Standard tool bar it is not going to selection screen. it is displaying the sceen which is before deletion of the records that is previous screen is displayed insted of selection screen.
    I need to display selection screen when i press back button in the standard tool bar it should not show previous screen it has to show first screen that is selection screen.
    Thnaks
    <<removed_by_moderator>>
    Edited by: Vijay Babu Dudla on Feb 23, 2009 9:38 AM

    hi
    try this,
    when 'BACK'.
    leave to screen scrnnum.
    scrnnum - screen number of your selection screen. you can find your screen num by clicking system->status menu in your selection screen.
    feel free to revert back if you still have doubts.
    regards
    mano

  • ALV GRID - check box functionality

    Hello all,
    In ALV GRID display I want to have check box as the first column. I should be able to select some records using this checkbox and identify the selected records on USER_COMMAND. Could some one post some sample code to do this?
    Thanks,

    Check this [thread|How to select a row using a checkbox in ALV Grid??;

  • Reg oop alv for push buttons

    hi friends,
       can i make a particular fields of a column as pushbuttons (exactly as we do for check box)
           thank u
         urmila.t

    Hi,
        You can make a field on ALV as Pushbutton.
    To make a cell to be displayed as a pushbutton, we have two steps. Firstly, insert a new inner table of type u201CLVC_T_STYLu201D into your list data table.
    *--- Internal table holding list data
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA cellstyles TYPE lvc_t_styl .
    DATA END OF gtlist .
    Fill this inner table for each field to be displayed as pushbutton.
    DATA ls_style TYPE lvc_s_styl .
    READ TABLE gt_list INDEX 7 .
    ls_style-fieldname = 'SEATSMAX' .
    ls_style-style = cl_gui_alv_grid=>mc_style_button .
    APPEND ls_style TO gt_list-cellstyles .
    Now the field with fieldname SEATSMAX will be shown as a pushbutton
    Regards,
    Syed
    MODIFY gt_list INDEX 7 .

  • How can I call functionality of ALV Grid by event of button outside grid?

    Hello,
    How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
    Best regards,
    Josef Motl

    hi Motl,
    these are steps to create a button in ALV and trigger an event from it..
    1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
    i_callback_program = gd_repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status 'NEWALVSTATUS'.
    endform.
    You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
    2.You have to do the following to process the new button click.
    i_callback_user_command = 'USER_COMMAND'
    form user_command using i_ucomm like sy-ucomm
    is_selfield type slis_selfield.
    case i_ucomm.
    3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status.  Then look for the standard pf status. Copy this to Z range and then add your new button.
    reward points if helpful
    regards
    satesh

  • Printing ALV Report output through Function Modules

    Hi All,
    I want to print my ALV Grid output through function modules/statement (not through print option in menu).
    This is because, i am generating a PDF from spool when user clicks on a button. If any changes happened in the ALV output layout, they will be captured in spool through printing it.
    So can you please tell me how to print the ALV Output through FMs or sending the ALV output to spool.
    Thanks & Regards,
    Senthil.
    Edited by: senthil nathan on May 17, 2010 2:49 PM

    Hi Dev,
    Thanks for the reply.
    I want to print the ALV when the user clicks on a button in toolbar. Lets say the user has made some changes to the layout, (E.g hiding a field) and when i print that output it should use the changed layout, If i use the FM suggested by you, i cant acheive this.
    If you try to print this manually, the system uses the changed layout and not the original. Thats why i want to know FMs/statement to print.
    Regards,
    Senthil.

  • ALV Grid sub total issue

    Hi SAP Experts,
    Currently I have ALV Grid table as below as example :
    FIELD1
    FIELD2
    Account
    Amount
    1. Rev
    1.Rev
    Acct1
    100.00
    1. Rev
    1.Rev
    Acct2
    50.00
    Subtotal FIELD2 (1.Rev)
    150.00
    Subtotal FIELD1 (1.Rev)
    150.00
    2. Cost
    2.1 Cost1
    Acct3
    100.00
    2. Cost
    2.1 Cost1
    Acct4
    75.00
    Subtotal FIELD2  (2.1 Cost1)
    175.00
    2. Cost
    2.2 Cost2
    Acct5
    25.00
    Subtotal FIELD2 (2.2 Cost 2)
    25.00
    | Subtotal FIELD1 (2.Cost)                | 200.00             |          
    I have 2 questions.
    First, as you can see, I have 2 subtotal for 1.Rev eventhough 1.Rev actually only need one subtotal because there is no subgroup for 1.Rev. Is it possible to have only one subtotal for this 1.Rev but I still maintained 2 subtotal for 2.Cost because 2.Cost has subgroup?
    My 2nd issue is I need to insert another row exactly below Subtotal FIELD1 (2.Cost) row like this:
    Gross Margin
    (Some formula)
    This row does not come from any sub total. The problem is I can not just insert this column and put Gross Margin description in FIELD1 because I will have 3 row like below :
    Gross Margin
    (Formula)
    Subtotal FIELD2 (blank)
    (Formula) sub total
    Subtotal FIELD1 (Gross Margin)
    (Formula) sub total
    Is there any way I can insert Gross Margin Row without creating new subtotal for it so it will only have one line in the ALV Grid table? Please help. Thank you.
    Regards,
    Abraham

    Hi Vijay.
    I'm not posting this before I search everywhere and this is not the first time I post in this forum so I know what I should do before posting. If I miss something, maybe you can give me at least a hint whether it can be done or not.
    This report that I am using is ALV Grid using REUSE_ALV_GRID_DISPLAY function module and not OOP using dialog module. I never said I need sample code because I only want to know is there a way to do that using ALV Grid which until now I will say that SAP ALV grid has this limitation where you can not insert row without including it in the subtotal.
    So, I would be very thankful if someone can give me some clarity on this thing and Vijay, if you really don't know what is the answer, I really appreciate if you can hold your self from making that kind of reply. It does not need experienced ABAP Consultant to write such remarks. Thanks.
    Regards,
    Abraham

  • Maximum number of character we can print in a column uing ALV grid display

    Hi frnds,
    My requirment is to print 500 charcter data in a column using ALV grid display.
    Could any body tell me is it possible and the maximum character it can i print in a column using ALV grid dispaly.
    Regards,
    Sandipan

    Hi Sandipan,
    refer notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters.
    857823 - ALV grid: Strings with a maximum of 128 characters
    Symptom
    Entries in cells of the type CHAR or string are truncated after 128
    characters in the SAP GUI.
    also refer,
    ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid
    (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
    Cause and Prerequisites
    The data table that is sent to the front end only allows character values
    with the length 128.
    Solution
    This is the standard system behavior and cannot be changed.

  • Abap table /alv grid

    Hi Experts,
    I m looking for some abap sample programs to build a program with tabs.
    In any tab you have a table (ALV GRID ) with buttons to move up/down the selected row.

    1.Table maintanence generateor is used to maintain the table .
    If u want to allow others to create new entries u have to maintain the table.Which will have all the changes to the table.so that the users can get the newly activated table to go for further process..
    2.
    To edit the grid value u have to set the fieldcate.
    WA_FIELDCAT-EDIT = ''X'.
    3.
    Table control s used for the changes then and there and user friendly
    ALV is for Sort layoput changes and can download to wordformat etc...

  • Push Button In Forms6i

    hello Oracle Gurus,
    I need ur help,
    I have created a push button whose function is the same as the push button functions in windows explorer,i mean to say when i press the button for the first time i get the data ordered in ascending order
    and when the same push button is clicked second time the same data gets
    ordered in descending order,so the logic is complete,and what i want now is that," whenever the push buttons are pressed the push buttons must signify that the data is ordered in ascending and descending order as it is seen in windowsNT or windows2000 i.e when the data is in Acending Order An "Inverted 'V'" appears on the button and when the data is in descending Order An "V" appears on the button .
    So How TO design Such Engraved "V" and "Inverted 'V'" on the push buttons.plz help me
    Thanking u all
    shiju

    hi there again,
    I think i solved your problem with the help of the codes below.
    on the when-button-pressed trigger
    declare
         st varchar2(40);
    begin
         st:=get_item_property('block3.button',label);
    if st='A' then
         set_item_property('block3.button',label,'V');
    else
         set_item_property('block3.button',label,'A');
    end if;
    end;

  • Problem with ALV Grid Not Displaying Data

    Hi Gurus,
    I have a report program, when i run it I display an output summary on ALV Grid, and when i click on each of the row in the output summary, I'm suppose to see the item detail of each record.
    This item detail is showing for some record and is not showing for some other records (when i use different selections). I debugged it and observed that the table populating the ALV grid actually has records in it. The ALV grid is not just displaying the records.
    I debugged the 2 examples (one showing record and the other not showing), I found out that nothing is different in the way they run till they populate the final internal record to passed to the ALV Grid.
    Please any suggestions on this:
    This is the function code for the ALV grid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = g_program_id
          i_callback_pf_status_set = c_detail_status
          i_callback_user_command  = c_detail_user_comm
          i_grid_title             = lv_grid_title
          is_layout                = w_detail_layout
          it_fieldcat              = i_detail_fieldcat
          it_sort                  = i_detail_sort
        TABLES
          t_outtab                 = i_faglflexa[]   "NEM - detail
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE e064
          WITH sy-subrc.
    Function REUSE_ALV_GRID_DISPLAY failed on detail view SY-SUBRC = &
      ENDIF.

    This is the full code:
    ***INCLUDE ZFIGL_HYPERION_F01.
    *&      Form  open_files
    Open files used by the program.
    FORM open_files.
      OPEN DATASET p_fileot FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
        MESSAGE g_message.
      IF sy-subrc <> 0.
        MESSAGE e056
          WITH g_message.
    Unable to open output file &
      ENDIF.
    ENDFORM.                    " open_files
    *&      Form  close_files
    Close files used by the program.
    FORM close_files.
      CLOSE DATASET p_fileot.
    ENDFORM.                    " close_files
    *&      Form  extract_data
    Extract data from database needed to generate output file and report.
    FORM extract_data.
    Get the required general ledger totals records.
      PERFORM get_faglflext_data.
    Derive any other necessary fields for I_FAGLFLEXT.
      PERFORM derive_add_fields_faglflext.
    Split records by fiscal period.
      PERFORM split_records_by_period.
    Summarize the detail records to allow for creation of the file and
    reporting.
      PERFORM summarize_records_by_period.
    Get the required general ledger actual line items records.
      PERFORM get_faglflexa_data.
    Derive any other necessary fields for I_FAGLFLEXA.
      PERFORM derive_add_fields_faglflexa.
    Sort the detail and summary output tables into key sequence.
      PERFORM sort_output_tables.
    ENDFORM.                    " extract_data
    *&      Form  process_data
    Create the requested file and report.
    FORM process_data.
    Create the local file if requested by the user or the month-end file
    at month-end.
      IF cb_test = c_not_selected.
        PERFORM create_pc_file.
      ELSEIF sy-uname = c_user_batch_admin.
        PERFORM create_output_file.
      ENDIF.
    Create the necessary tables for summary ALV report.
      PERFORM build_summary_layout.
      PERFORM build_summary_field_catalog.
      PERFORM build_summary_sort_table.
    Check to see that there is data in the summary output table.  If yes,
    generate report, if not, then give a message to the user.
      READ TABLE i_output_summary INDEX 1 TRANSPORTING NO FIELDS.
      IF sy-subrc <> 0.
        MESSAGE s062.
        STOP.
    No data extracted for selection criteria entered
      ENDIF.
    Generate the summary ALV report view.
      PERFORM generate_summary_alv_report.
    ENDFORM.                    " process_data
    *&      Form  verify_user_selections
    Verify data input by the user.
    FORM verify_user_selections.
      IF NOT p_ryear IS INITIAL.
        IF p_ryear < 2006 OR
           p_ryear > 2100.
          MESSAGE e057.
    Fiscal year is invalid
        ENDIF.
      ENDIF.
    If program is being run in a non-test mode and the user has left the
    fiscal year selection blank, display a error message.
      IF cb_test IS INITIAL AND
         p_ryear IS INITIAL.
        MESSAGE e058.
    A fiscal year must be entered when generating the file
      ENDIF.
    If program is being run in a non-test mode and the user has left the
    period selection blank, display a error message.
      IF cb_test IS INITIAL AND
         s_rpmax IS INITIAL.
        MESSAGE e132.
    A period must be entered when generating the file
      ENDIF.
      IF cb_test IS INITIAL AND
         p_lfile IS INITIAL.
        MESSAGE e071.
    Local filename is required when generating the file
      ENDIF.
    ****Basil Balogun's addition to include the hyperion acct in selection. (10/03/2007)***
      IF s_rhype IS NOT INITIAL.
        LOOP AT s_rhype.
          CLEAR r_hyper.
          r_hyper-sign = 'I'.
          r_hyper-option = 'CP'.
          CONCATENATE '' s_rhype-low '' INTO r_hyper-low.
          APPEND r_hyper.
        ENDLOOP.
        SELECT bukrs saknr hyper
               FROM zall_gl_hype INTO TABLE i_zall_gl
               WHERE hyper IN r_hyper.
        LOOP AT i_zall_gl INTO w_zall_gl.
          w_zall_gl1-saknr = w_zall_gl-saknr.
          w_zall_gl2-bukrs = w_zall_gl-bukrs.
          APPEND w_zall_gl1-saknr TO i_zall_gl1.
          APPEND w_zall_gl2-bukrs TO i_zall_gl2.
          CLEAR: w_zall_gl, w_zall_gl1, w_zall_gl2.
        ENDLOOP.
        SORT i_zall_gl1 BY saknr.
        SORT i_zall_gl2 BY bukrs.
        DELETE ADJACENT DUPLICATES FROM i_zall_gl1 COMPARING saknr.
        DELETE ADJACENT DUPLICATES FROM i_zall_gl2 COMPARING bukrs.
        IF s_racct IS INITIAL.
          LOOP AT i_zall_gl1 INTO w_zall_gl1.
            r_saknr-sign = 'I'.
            r_saknr-option = 'EQ'.
            r_saknr-low = w_zall_gl1.
            APPEND r_saknr.
            CLEAR r_saknr.
            CLEAR w_zall_gl1.
          ENDLOOP.
        ELSE.
          r_saknr[] = s_racct[].
        ENDIF.
        IF s_rbukrs IS INITIAL.
          LOOP AT i_zall_gl2 INTO w_zall_gl2.
            r_bukrs-sign = 'I'.
            r_bukrs-option = 'EQ'.
            r_bukrs-low = w_zall_gl2-bukrs.
            APPEND r_bukrs.
            CLEAR r_bukrs.
            CLEAR w_zall_gl2.
          ENDLOOP.
        ELSE.
          r_bukrs[] = s_rbukrs[].
        ENDIF.
      ELSE.
        r_saknr[] = s_racct[].
        r_bukrs[] = s_rbukrs[].
        SELECT bukrs saknr hyper
               FROM zall_gl_hype INTO TABLE i_zall_gl.
      ENDIF.
    ****Basil Balogun's addition to include the hyperion acct in selection. (10/03/2007)***
    ENDFORM.                    " verify_user_selections
    *&      Form  get_faglflext_data
    Get FAGLFLEXT (General Ledger: Totals) data from the database.
    FORM get_faglflext_data .
    Use the fiscal year for the selection, if it was populated by the
    user.
      IF NOT p_ryear IS INITIAL.
        SELECT ryear rldnr rvers racct rbukrs prctr rfarea kokrs segment
               zzsarea zzsareaim rassc hsl01 hsl02 hsl03 hsl04 hsl05 hsl06
               hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 hsl16
               hslvt
          INTO TABLE i_faglflext
          FROM faglflext
          WHERE rldnr = c_run_ledger    AND
                rbukrs IN r_bukrs       AND
                racct  IN r_saknr       AND
                rfarea IN s_rfarea      AND
                prctr  IN s_prctr       AND
                ryear  =  p_ryear       AND
                rvers  = c_run_version.
      ELSE.
        SELECT ryear rldnr rvers racct rbukrs prctr rfarea kokrs segment
             zzsarea zzsareaim rassc hsl01 hsl02 hsl03 hsl04 hsl05 hsl06
             hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 hsl16
             hslvt
        INTO TABLE i_faglflext
        FROM faglflext
        WHERE rldnr = c_run_ledger    AND
              rbukrs IN r_bukrs       AND
              racct  IN r_saknr       AND
              rfarea IN s_rfarea      AND
              prctr  IN s_prctr       AND
              rvers  = c_run_version.
      ENDIF.
    ENDFORM.                    " get_faglflext_data
    *&      Form  derive_add_fields_faglflext
    Derive additional fields needed for the I_FAGLFLEXT.
    FORM derive_add_fields_faglflext.
    Get needed company code and profit center data from the database.
      PERFORM get_t001_data.
      PERFORM get_t880_data.
      READ TABLE i_faglflext INDEX 1 TRANSPORTING NO FIELDS.
      IF sy-subrc = 0.
        PERFORM get_cepc_data.
      ENDIF.
      SORT i_zall_gl BY bukrs saknr.
      LOOP AT i_faglflext INTO w_faglflext.
    Get necessary company code data.
        READ TABLE i_t001 INTO w_t001
          WITH KEY bukrs = w_faglflext-rbukrs
                   BINARY SEARCH.
        IF sy-subrc <> 0.
          MESSAGE e059
            WITH w_faglflext-rbukrs.
    Company code & not found on table T001
        ENDIF.
    Determine the entity.
        PERFORM derive_entity USING w_t001-rcomp
                           CHANGING w_faglflext-entity.
    Determine the strategic segment.
        PERFORM derive_strategic_segment USING w_faglflext-rassc
                                               w_faglflext-prctr
                                      CHANGING w_faglflext-strat_seg
                                               w_faglflext-zzsareaim
                                               w_faglflext-zzsarea.
    Determine the strategic segment channel.
        PERFORM derive_strat_seg_chnl USING w_faglflext-rassc
                                            w_faglflext-prctr
                                   CHANGING w_faglflext-strat_seg_chnl.
    Determine the all item ID and all products.
        PERFORM derive_all_item_id USING w_t001-waers
                                CHANGING w_faglflext-all_item_id
                                         w_faglflext-all_products.
    Determine the all customers and all customers channel.
       PERFORM derive_all_customers_fields USING w_faglflext-strat_seg
    *w_faglflext-strat_seg_chnl
                                        CHANGING w_faglflext-all_cust
    *w_faglflext-all_cust_chnl.
    Determine the sub account using the company ID of the trading partner.
       PERFORM derive_sub_account USING w_faglflext-rassc
                               CHANGING w_faglflext-sub_acct.
        PERFORM derive_sub_account USING w_t001-rcomp
                                         w_faglflext-rassc
                           CHANGING w_faglflext-sub_acct.
    ****Begin Basil changes to include hyperion acct in selection (10/03/2007).
        READ TABLE i_zall_gl INTO w_zall_gl
                     WITH KEY bukrs = w_faglflext-rbukrs
                              saknr = w_faglflext-racct
                          BINARY SEARCH.
        IF sy-subrc = 0.
    ****End Basil changes to include hyperion acct in selection (10/03/2007).
    Determine the Hyperion account number from G/L account long text.
          PERFORM derive_hyperion_account USING w_faglflext-racct
                                                w_faglflext-rfarea
                                                "KMK5/22/06 ITR: 20592
                                                w_faglflext-sub_acct
                                                w_faglflext-rassc
                                                w_faglflext-prctr
                         CHANGING w_faglflext-hyperion_acct
                                  w_faglflext-reverse_sign "NEM8/21/06 ITR: 24286
                                  w_faglflext-balance_sheet "NEM8/21/06 ITR: 24286
                                  w_faglflext-zzsarea
                                  w_faglflext-zzsareaim
                                  w_faglflext-strat_seg.
        ENDIF.
    Determine the all customers and all customers channel.
        PERFORM derive_all_customers_fields USING w_faglflext-strat_seg
                                                  w_faglflext-strat_seg_chnl
                                         CHANGING w_faglflext-all_cust
                                                  w_faglflext-all_cust_chnl.
    Update i_FAGLFLEXT with the newly derive fields.
        MODIFY i_faglflext FROM w_faglflext
          TRANSPORTING entity
                       strat_seg
                       strat_seg_chnl
                       all_item_id
                       all_products
                       all_cust
                       all_cust_chnl
                       hyperion_acct
                       sub_acct
                       fiscal_period
                       zzsarea
                       zzsareaim
                       reverse_sign        "NEM8/21/06 ITR: 24286
                       balance_sheet.      "NEM8/21/06 ITR: 24286
      ENDLOOP.
      CHECK s_rhype IS NOT INITIAL.
      SORT s_rhype BY low.
      LOOP AT i_faglflext INTO w_faglflext.
        READ TABLE s_rhype WITH KEY low = w_faglflext-hyperion_acct.
        IF sy-subrc NE 0.
          CLEAR w_faglflext-hyperion_acct.
          MODIFY i_faglflext FROM w_faglflext.
        ENDIF.
      ENDLOOP.
      DELETE i_faglflext WHERE hyperion_acct IS INITIAL.
    ENDFORM.                    " derive_add_fields_faglflext
    *&      Form  derive_entity
    Derive the entity using the company code.
         -->RCOMP  - Company code.
         <--ENTITY - Entity
    FORM derive_entity USING rcomp  TYPE t_t001-rcomp
                    CHANGING entity TYPE t_faglflext-entity.
      CLEAR:
        entity.
    Get necessary global company code data.
      READ TABLE i_t880 INTO w_t880
        WITH KEY rcomp = rcomp
                 BINARY SEARCH.
      IF sy-subrc = 0.
        entity  = w_t880-name2+0(3).
        TRANSLATE entity TO UPPER CASE.
      ELSE.
        MESSAGE e060
          WITH w_t001-rcomp.
    Company code & not found on table T880
      ENDIF.
    ENDFORM.                    " derive_entity
    *&      Form  get_t001_data
    Get T001 (Company Codes) data from the database.
    FORM get_t001_data.
      SELECT bukrs waers rcomp
        INTO TABLE i_t001
        FROM t001
        CLIENT SPECIFIED
        WHERE mandt = sy-mandt.
      SORT i_t001 BY bukrs.
    ENDFORM.                    " get_t001_data
    *&      Form  get_t880_data
    Get T880 (Global Company Data (for KONS Ledger)) data from the
    database.
    FORM get_t880_data.
      SELECT rcomp name2
        INTO TABLE i_t880
        FROM t880
        CLIENT SPECIFIED
        WHERE mandt = sy-mandt.
      SORT i_t880 BY rcomp.
    ENDFORM.                    " get_t880_data
    *&      Form  derive_all_item_id
    Derive the all item ID from the company code currency key.
         -->WAERS       - Currency key.
         <--ALL_ITEM_ID - All item ID.
         <--ALL_ITEM_ID - All item ID.
    FORM derive_all_item_id USING waers        TYPE t_t001-waers
                         CHANGING all_item_id  TYPE t_faglflext-all_item_id
                                  all_products TYPE t_faglflext-all_products
      CLEAR:
        all_item_id.
    Populate all item ID.
      all_item_id = c_all_item_id.
      IF waers = c_us_dollars.
        REPLACE '*' WITH c_united_states INTO all_item_id.
      ELSE.
        REPLACE '*' WITH c_local         INTO all_item_id.
      ENDIF.
    Populate all products.
      all_products   = c_all_products.
      TRANSLATE all_products TO UPPER CASE.
    ENDFORM.                    " derive_all_item_id
    *&      Form  derive_all_customers_fields
    Derive the all customers and all customer channel fields from
    the strategic segment and strategic segment channel respectively.
         -->STRAT_SEG      - Strategic segment.
         -->STRAT_SEG_CHNL - Strategic segment channel.
         <--ALL_CUST       - All customers.
         <--ALL_CUST_CHNL  - All customers channel.
    FORM derive_all_customers_fields USING strat_seg      TYPE
    t_faglflext-strat_seg
                                           strat_seg_chnl TYPE
                                           t_faglflext-strat_seg_chnl
                                  CHANGING all_cust       TYPE
                                  t_faglflext-all_cust
                                           all_cust_chnl  TYPE
                                           t_faglflext-all_cust_chnl.
      CLEAR:
        all_cust,
        all_cust_chnl.
      all_cust        = strat_seg.
      all_cust+2(1)   = c_all_customers.
      TRANSLATE all_cust TO UPPER CASE.
      all_cust_chnl   = strat_seg_chnl.
      TRANSLATE all_cust_chnl TO UPPER CASE.
    ENDFORM.                    " derive_all_customers_fields
    *&      Form  derive_hyperion_account
    Read G/L account long text to get the Hyperion account number.
         -->RACCT         - SAP G/L account number.
         <--HYPERION_ACCT - Hyperion account number.
    FORM derive_hyperion_account USING racct         TYPE t_faglflext-racct
                                       farea         TYPE t_faglflext-rfarea
                                       "KMK5/22/06 ITR 20592
                                       sub_account   TYPE
                                       t_faglflext-sub_acct
                                       rassc         TYPE t_faglflext-rassc
                                       prctr         TYPE t_faglflext-prctr
                          CHANGING hyperion_acct TYPE t_faglflext-hyperion_acct
                                   reverse_sign  TYPE t_faglflext-reverse_sign "NEM8/21/06 ITR: 24286
                                   balance_sheet TYPE t_faglflext-balance_sheet "NEM8/21/06 ITR: 24286
                                   zzsarea       TYPE t_faglflext-zzsarea
                                   zzsareaim     TYPE t_faglflext-zzsareaim
                                   strat_seg     TYPE t_faglflext-strat_seg.
      DATA:
        lv_text_name          TYPE thead-tdname,
        l_strl                TYPE i VALUE 0,
        l_hyperion_acct(10),                       "KMK5/20/06 ITR 20527
        l_farea(10)           VALUE '0000000000',  "KMK5/22/06 ITR 20592
        l_balance_sheet(1),                        "NEM8/17/06 ITR 25792
        l_string              TYPE tline-tdline.   "NEM8/17/06 ITR 25792
      DATA: l_hyp_account_1 TYPE tline-tdline,
            l_hyp_account_2 TYPE tline-tdline,
            l_hyp_account_3 TYPE tline-tdline.
      reverse_sign = '1'.
      SELECT SINGLE bilkt xbilk
        FROM ska1
        INTO (l_hyperion_acct,l_balance_sheet)
        WHERE ktopl = c_global_tcoa
          AND   saknr = racct.
      balance_sheet = l_balance_sheet.
      l_string = w_zall_gl-hyper.
      SEARCH l_string FOR '-'.
      IF sy-subrc = '0'.
        reverse_sign = -1.
      ELSE.
        reverse_sign = 1.
      ENDIF.
      CHECK w_zall_gl-hyper IS NOT INITIAL.
      CLEAR: l_hyp_account_1, l_hyp_account_2, l_hyp_account_3.
      SPLIT w_zall_gl-hyper
        AT ';'
        INTO l_hyp_account_1 l_hyp_account_2 l_hyp_account_3.
      IF l_hyp_account_2 IS INITIAL.      " Only one hyperion account
        hyperion_acct = l_hyp_account_1+0(7).
        l_strl = STRLEN( hyperion_acct ) - 1.
        IF hyperion_acct+l_strl(1) EQ '1'.
          CLEAR sub_account.
          PERFORM repopulate_strategic_segment
            USING rassc prctr
            CHANGING strat_seg.
          zzsareaim = g_hold_sales_type.
          zzsarea = g_hold_sales_area.
        ENDIF.
      ELSE.                                " Two or more hyperion accounts
        IF sub_account > ''.
          hyperion_acct = l_hyp_account_2+0(7).
        ELSE.
          hyperion_acct = l_hyp_account_1+0(7).
        ENDIF.
      ENDIF.
      CLEAR: w_hyperion.
      w_hyperion-racct           = racct.
      w_hyperion-hyperion_acct   = hyperion_acct.
      w_hyperion-reverse_sign    = reverse_sign.
    ENDFORM.                    " derive_hyperion_account
    *&      Form  derive_sub_account
    Determine the sub account based on the company ID of the trading
    partner.
         -->RASSC    - Company ID of trading partner.
         <--SUB_ACCT - Sub account.
    *FORM derive_sub_account USING rassc    TYPE t_faglflext-rassc
                        CHANGING sub_acct TYPE t_faglflext-sub_acct.
    IF rassc IS INITIAL.
       CLEAR: sub_acct.
    ELSE.
       sub_acct  = rassc.
       TRANSLATE sub_acct TO UPPER CASE.
    ENDIF.
    *ENDFORM.                    " derive_sub_account
    FORM derive_sub_account USING rcomp  TYPE t_t001-rcomp
                                  rassc  TYPE t_faglflext-rassc
                    CHANGING sub_acct TYPE t_faglflext-sub_acct.
      IF rassc IS INITIAL.
        CLEAR: sub_acct.
      ELSE.
        READ TABLE i_t880 INTO w_t880
          WITH KEY rcomp = rassc
                   BINARY SEARCH.
        IF sy-subrc = 0.
          sub_acct  = w_t880-name2.
          TRANSLATE sub_acct TO UPPER CASE.
        ELSE.
       MESSAGE e060
         WITH w_t001-rcomp.
    Company code & not found on table T880
        ENDIF.
      ENDIF.
    ENDFORM.                    " derive_sub_account
    *&      Form  repopulate_strategic_segment
    Derive the strategic segment based on the company ID of the trading
    partner or the profit center.
         -->RASSC     - Company ID of trading partner.
         -->PRCTR     - Profit center.
         <--STRAT_SEG - Strategic segment.
    FORM repopulate_strategic_segment USING rassc     TYPE t_faglflext-rassc
                                        prctr     TYPE t_faglflext-prctr
                               CHANGING strat_seg TYPE t_faglflext-strat_seg
      DATA:
        lv_segment              TYPE cepc-segment.
      CLEAR:
        strat_seg.
    Find the valid profit center record.
      LOOP AT i_cepc INTO w_cepc
        WHERE prctr =  prctr    AND
              datab <= sy-datum AND
              datbi >= sy-datum.
    Pad segment with leading zeros if necessary.
        lv_segment      = w_cepc-segment.
        SHIFT lv_segment RIGHT DELETING TRAILING ' '.
        TRANSLATE lv_segment USING ' 0'.
    Get the segment name from FAGL_SEGMT (Master Data for Segments).
        SELECT SINGLE *
          FROM fagl_segmt
          WHERE langu   = sy-langu AND
                segment = lv_segment.
        IF sy-subrc = 0.
          strat_seg      = fagl_segmt-name+0(3).
          TRANSLATE strat_seg TO UPPER CASE.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "repopulate_strategic_segment
    " repopulate_strategic_segment&----
    *&      Form  derive_strategic_segment
    Derive the strategic segment based on the company ID of the trading
    partner or the profit center.
         -->RASSC     - Company ID of trading partner.
         -->PRCTR     - Profit center.
         <--STRAT_SEG - Strategic segment.
    FORM derive_strategic_segment USING rassc     TYPE t_faglflext-rassc
                                        prctr     TYPE t_faglflext-prctr
                               CHANGING strat_seg TYPE t_faglflext-strat_seg
                                        sales_type TYPE t_faglflext-zzsareaim
                                        sales_area TYPE t_faglflext-zzsarea.
      DATA:
        lv_segment              TYPE cepc-segment.
      CLEAR:
        strat_seg.
    *Hold values in Sales Type and Sales area before setting to default
    *values
    In case need to use them later
      g_hold_sales_type = sales_type.
      g_hold_sales_area = sales_area.
    If the company ID of the trading partner is populated, then set the
    strategic segment to a default value.
    And set Sales Type and Sales area to default values     **NEM 07/13/06
      IF NOT rassc IS INITIAL.
        strat_seg   = c_def_strat_seg.
        sales_type  = c_sales_type.
        sales_area  = c_sales_area.
        TRANSLATE strat_seg TO UPPER CASE.
        TRANSLATE sales_type TO UPPER CASE.
        TRANSLATE sales_area TO UPPER CASE.
        EXIT.
      ENDIF.
    Find the valid profit center record.
      LOOP AT i_cepc INTO w_cepc
        WHERE prctr =  prctr    AND
              datab <= sy-datum AND
              datbi >= sy-datum.
    Pad segment with leading zeros if necessary.
        lv_segment      = w_cepc-segment.
        SHIFT lv_segment RIGHT DELETING TRAILING ' '.
        TRANSLATE lv_segment USING ' 0'.
    Get the segment name from FAGL_SEGMT (Master Data for Segments).
        SELECT SINGLE *
          FROM fagl_segmt
          WHERE langu   = sy-langu AND
                segment = lv_segment.
        IF sy-subrc = 0.
          strat_seg      = fagl_segmt-name+0(3).
          TRANSLATE strat_seg TO UPPER CASE.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " derive_strategic_segment
    *&      Form  get_cepc_data
    Get CEPC (Profit Center Master Data Table) data from the database.
    FORM get_cepc_data.
      SELECT prctr datbi kokrs datab khinr segment
        INTO TABLE i_cepc
        FROM cepc
        FOR ALL ENTRIES IN i_faglflext
        WHERE prctr = i_faglflext-prctr.
      SORT i_cepc BY prctr datab.
    ENDFORM.                    " get_cepc_data
    *&      Form  derive_strat_seg_chnl
    Derive the strategic segment channel based on the company ID of the
    trading partner or the profit center area.
         -->RASSC          - Company ID of trading partner.
         -->PRCTR          - Profit center.
         <--STRAT_SEG_CHNL - Strategic segment channel.
    FORM derive_strat_seg_chnl USING rassc          TYPE t_faglflext-rassc
                                     prctr          TYPE t_faglflext-prctr
                            CHANGING strat_seg_chnl TYPE
                            t_faglflext-strat_seg_chnl.
      CLEAR:
        g_setclass,
        g_subclass,
        g_setname,
        strat_seg_chnl.
    If the company ID of the trading partner is populated, then set the
    strategic segment to a default value.
      IF NOT rassc IS INITIAL.
        strat_seg_chnl  = c_def_strat_seg_chnl.
        TRANSLATE strat_seg_chnl TO UPPER CASE.
        EXIT.
      ENDIF.
    Check for SETNAME = 2*** in setleaf table.
      PERFORM get_setleaf_data USING c_prctr_group
                                       prctr
                              CHANGING g_subrc.
      IF g_subrc NE c_no_record.
        PERFORM find_setleaf_record CHANGING g_subrc.
        SELECT SINGLE *
        FROM setheadert
        WHERE  setclass = g_setclass AND
               subclass = g_subclass AND
               setname  = g_setname  AND
               langu    = sy-langu.
        IF sy-subrc = 0.
          strat_seg_chnl    = setheadert-descript+0(2).
          TRANSLATE strat_seg_chnl TO UPPER CASE.
        ENDIF.
      ELSE.
    Find the valid profit center record.
        LOOP AT i_cepc INTO w_cepc
          WHERE prctr =  prctr    AND
                datab <= sy-datum AND
                datbi >= sy-datum.
    Get the correct SETNODE (Lower-level sets in sets) record.
          PERFORM get_setnode_data USING c_prctr_group
                                         w_cepc-khinr
                                CHANGING g_subrc.
          PERFORM find_setnode_record CHANGING g_subrc.
          IF g_subrc = c_no_record.
            EXIT.
          ENDIF.
    If an appropriate SETNODE record still has not been found, then
    keep looking.
          IF g_subrc = c_wrong_record.
            DO.
              PERFORM get_setnode_data USING c_prctr_group
                                             w_setnode-setname
                                    CHANGING g_subrc.
              PERFORM find_setnode_record CHANGING g_subrc.
              IF g_subrc = c_no_record OR
                 g_subrc = c_correct_record.
                EXIT.
              ENDIF.
            ENDDO.
          ENDIF.
    In the end, there was no SETNODE record to find.
          IF g_subrc = c_no_record.
            EXIT.
          ENDIF.
          SELECT SINGLE *
            FROM setheadert
            WHERE  setclass = g_setclass AND
                   subclass = g_subclass AND
                   setname  = g_setname  AND
                   langu    = sy-langu.
          IF sy-subrc = 0.
            strat_seg_chnl    = setheadert-descript+0(2).
            TRANSLATE strat_seg_chnl TO UPPER CASE.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " derive_strat_seg_chnl
    *&      Form  get_setnode_data
    Get SETNODE (Lower-level sets in sets) data from the database.
         -->SETCLASS   - Set class.
         -->SUBSETNAME - Subordinate set ID.
         <--SUBRC      - Return code.
    FORM get_setnode_data USING setclass   TYPE c
                                subsetname TYPE c
                       CHANGING subrc      TYPE sy-subrc.
      SELECT setclass subclass setname
        INTO TABLE i_setnode
        FROM setnode
        WHERE setclass   = c_prctr_group AND
              subsetname = subsetname.
      subrc  = sy-subrc.
    ENDFORM.                    " get_setnode_data
    *&      Form  get_setleaf_data
    Get SETLEAF (Values in Sets) data from the database.
         -->SETCLASS   - Set class.
         -->VALFROM    - Subordinate set ID.
         <--SUBRC      - Return code.
    FORM get_setleaf_data USING setclass   TYPE c
                                valfrom    TYPE c
                       CHANGING subrc      TYPE sy-subrc.
      subrc = c_correct_record.
      SELECT setclass setname valfrom subclass
        INTO TABLE i_setleaf
        FROM setleaf
        WHERE setclass   = c_prctr_group AND
              valfrom = valfrom AND
              setname GE '2000' AND
              setname LE '2999'.
      IF sy-subrc <> 0.
        subrc  = c_no_record.
        EXIT.
      ENDIF.
    ENDFORM.                    " get_setleaf_data
    *&      Form  find_setleaf_record
    Find the appropriate SETLEAF record.
         <--SUBRC      - Return code.
    FORM find_setleaf_record CHANGING subrc TYPE sy-subrc.
      subrc  = c_wrong_record.
    If no records were found during selection, then exit the routine.
      READ TABLE i_setleaf INDEX 1 TRANSPORTING NO FIELDS.
      IF sy-subrc <> 0.
        subrc  = c_no_record.
        EXIT.
      ENDIF.
    Check to see if one of the records has a setname in the 2000 series of
    numbers.
      LOOP AT i_setleaf INTO w_setleaf.
        g_setclass = w_setleaf-setclass.
        g_subclass = w_setleaf-subclass.
        g_setname  = w_setleaf-setname.
        subrc  = c_correct_record.
      ENDLOOP.
    ENDFORM.                    " find_setleaf_record
    *&      Form  find_setnode_record
    Find the appropriate SETNODE record.
         <--SUBRC      - Return code.
    FORM find_setnode_record CHANGING subrc TYPE sy-subrc.
      subrc  = c_wrong_record.
    If no records were found during selection, then exit the routine.
      READ TABLE i_setnode INDEX 1 TRANSPORTING NO FIELDS.
      IF sy-subrc <> 0.
        subrc  = c_no_record.
        EXIT.
      ENDIF.
    Check to see if one of the records has a setname in the 2000 series of
    numbers.
      LOOP AT i_setnode INTO w_setnode.
        IF w_setnode-setname+0(1) = c_valid_number.
          g_setclass = w_setnode-setclass.
          g_subclass = w_setnode-subclass.
          g_setname  = w_setnode-setname.
          subrc  = c_correct_record.
          EXIT.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " find_setnode_record
    *&      Form  split_records_by_period
    Split the i_FAGLFLEXT records by fiscal period.  This is necessary
    because all (16) fiscal periods are on one record.
    FORM split_records_by_period .
      REFRESH:
        i_output_detail.
      LOOP AT i_faglflext INTO w_faglflext.
    START OF CHANGES BY BAYAPV on 07/07/2007**********************
    *SELECT SINGLE BUKRS
          SAKNR
          XOPVW
          into w_skb1
          from skb1
          FOR ALL ENTRIES IN I_FAGLFLEXT
          where bukrs = w_faglflext-rbukrs
            and SAKNR = w_faglflext-racct.
    *IF w_skb1-XOPVW = 'X'.
    *SELECT BUKRS
          HKONT

  • Where to write the code when the push button is clicked in the screen

    I have designed a screen with a push button and a text box
    If i click on the push button it should display a value 'hello' in the text box. How to do

    When you are using module pool programming,
    handle the push button function code in the PAI module and make sure the text field is updated whenever that function code for push button gets executed.
    And one more thing is that make sure you set the next screen to the same screen number because after executing the function code then again it has to go back to the PBO of that screen for displaying  the text field.
    For inital display, the text field is displayed blank and it is filled when that function code is executed.
    Regards,
    Balaji Reddy G
    Note:Please reward if the answers are helpful

Maybe you are looking for

  • How do I swap admin privileges between two accounts?

    The original, first account on my computer is, naturally, an admin account. I normally operate in this account. How do I create a new account that becomes the sole admin, and change the original, first account to an ordinary user account? The reason

  • XP to imac migration

    I ran the windows migration assistant from my old lap top and transferred everything to my new imac and it said it has completed successfully. I was hoping to open itunes and find all my files in there but no such luck : ( Does anyone know how I brin

  • Assigning two alignment rules to a table

    Is it possible to create a table where each columnn is left justified, and yet centered with in it's column? I know I can use tabs to accomplish this, but my company is creating a large product catalog where we would like to avoid manually changing t

  • Messed up my library IPhoto 2.0.1

    I completely messed up my library after reinstalling the operating system a while back. I neglected to read the instructions for restoring the library and everything was in a mess. Today I decided to reinstall IPhoto 2 and its upgrade to 2.01. I clea

  • Possible solution for not being able to receive emails

    I had a problem that's plagued me since Leopard was released a week ago. I couldn't receive all my emails on any POP boxes, and kept getting duplicates showing up of those emails it had managed to download. I had 45 emails waiting to download, and it