Need help in alv append in one row

I need to append in one row in alv and I’m using 'REUSE_ALV_FIELDCATALOG_MERGE'.
Here’s my code:
DATA: lv_spras LIKE sy-langu,
        lv_datbi LIKE a005-datbi.
  CLEAR t_final.
  SELECT t~vtext
         a~kschl
         a~kunnr
         k~name1
         a~matnr
         a~knumh
         m~maktx
         m~spras
         a~datab
         a~datbi
        INTO TABLE t_final
        FROM a005 AS a
        INNER JOIN t685t AS t ON akschl EQ tkschl
        INNER JOIN kna1  AS k ON akunnr EQ kkunnr
        INNER JOIN makt AS m ON amatnr EQ mmatnr
                    WHERE  a~vkorg IN s_vkorg
                    AND    a~vtweg IN s_vtweg
                    AND    a~matnr IN s_matnr
                    AND  ( a~kschl EQ p_cond1
                    OR     a~kschl EQ p_cond2
                    OR     a~kschl EQ p_cond3
                    OR     a~kschl EQ p_cond4 )
                    AND    a~kunnr IN s_kunnr
                    AND    a~datab LE sy-datum
                    AND    a~datbi GE sy-datum
                    AND    m~spras EQ sy-langu.
  IF sy-subrc EQ 0.
    DELETE ADJACENT DUPLICATES FROM t_final
       COMPARING kschl.
  ENDIF.
    LOOP AT t_final FROM sy-tabix.
    move-corresponding t_a005 to t_final.
      CASE t_final-kschl.
        WHEN p_cond1.
          t_final1-kschl1 = t_final-kschl.
          t_final1-vtext1 = t_final-vtext.
          t_final1-datab  = t_final-datab.
          t_final1-datbi  = t_final-datbi.
        WHEN p_cond2.
          t_final1-kschl2 = t_final-kschl.
          t_final1-vtext2 = t_final-vtext.
          t_final1-datab2  = t_final-datab.
          t_final1-datbi2  = t_final-datbi.
      Endcase.
        Endloop.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_program_name     = l_repid
            i_internal_tabname = 'T_FINAL1'
            i_inclname         = l_repid
            i_bypassing_buffer = 'X'
       CHANGING
            ct_fieldcat        = t_fieldcat[]
       EXCEPTIONS
            OTHERS             = 0.
  LOOP AT t_fieldcat.
    CASE t_fieldcat-fieldname.
  condition 1
      WHEN lc_vtext1.
        IF p_cond1 IS INITIAL.
          t_fieldcat-no_out        = c_x.
        ELSE.
          CONCATENATE text-001 p_cond1 INTO lv_buf
          SEPARATED BY space.
          t_fieldcat-seltext_l    = lv_buf.
          t_fieldcat-seltext_s    = lv_buf.
          t_fieldcat-seltext_m    = lv_buf.
          t_fieldcat-ddictxt      = lc_l.
          t_fieldcat-no_zero      = c_x.
          t_fieldcat-just         = lc_r.
          t_fieldcat-reptext_ddic = lv_buf.
          t_fieldcat-outputlen    = 27.
        ENDIF.
        CLEAR t_fieldcat-key.
        MODIFY t_fieldcat INDEX sy-tabix.
      WHEN lc_kschl1.                              "CONDITION TYPE
        IF p_cond1 IS INITIAL.                    "DESCRIPTION
          t_fieldcat-no_out        = c_x.
        ELSE.
          CONCATENATE text-002 p_cond1 INTO lv_buf
          SEPARATED BY space.
          t_fieldcat-seltext_l    = lv_buf.
          t_fieldcat-seltext_s    = lv_buf.
          t_fieldcat-seltext_m    = lv_buf.
          t_fieldcat-ddictxt      = lc_l.
          t_fieldcat-no_zero      = c_x.
          t_fieldcat-just         = lc_r.
          t_fieldcat-reptext_ddic = lv_buf.
          t_fieldcat-outputlen    = 20.
        ENDIF.
        CLEAR t_fieldcat-key.
        MODIFY t_fieldcat INDEX sy-tabix.
WHEN lc_vtext2.
        IF p_cond1 IS INITIAL.
          t_fieldcat-no_out        = c_x.
        ELSE.
          CONCATENATE text-001 p_cond2 INTO lv_buf
          SEPARATED BY space.
          t_fieldcat-seltext_l    = lv_buf.
          t_fieldcat-seltext_s    = lv_buf.
          t_fieldcat-seltext_m    = lv_buf.
          t_fieldcat-ddictxt      = lc_l.
          t_fieldcat-no_zero      = c_x.
          t_fieldcat-just         = lc_r.
          t_fieldcat-reptext_ddic = lv_buf.
          t_fieldcat-outputlen    = 27.
        ENDIF.
        CLEAR t_fieldcat-key.
        MODIFY t_fieldcat INDEX sy-tabix.
      WHEN lc_kschl2.
        IF p_cond1 IS INITIAL.
          t_fieldcat-no_out        = c_x.
        ELSE.
          CONCATENATE text-002 p_cond2 INTO lv_buf
          SEPARATED BY space.
          t_fieldcat-seltext_l    = lv_buf.
          t_fieldcat-seltext_s    = lv_buf.
          t_fieldcat-seltext_m    = lv_buf.
          t_fieldcat-ddictxt      = lc_l.
          t_fieldcat-no_zero      = c_x.
          t_fieldcat-just         = lc_r.
          t_fieldcat-reptext_ddic = lv_buf.
          t_fieldcat-outputlen    = 20.
        ENDIF.
        CLEAR t_fieldcat-key.
        MODIFY t_fieldcat INDEX sy-tabix.
Endcase.
Endloop.
The output is:
VTEXT1               KSCHL1    VTEXT2                       KSCHL2
Special Discount   |ZDD3     |                                      |     
        |                 |Tender/Special Price|ZR03 
I want the output:
VTEXT1               KSCHL1    VTEXT2                       KSCHL2
Special Discount   |ZDD3     ||Tender/Special Price|ZR03 
How can I do these.

DATA: BEGIN OF wa,
        col1(1) TYPE c,
        col2 TYPE i,
      END OF wa.
DATA itab LIKE TABLE OF wa.
DO 3 TIMES.
  APPEND INITIAL LINE TO itab.
  wa-col1 = sy-index. wa-col2 = sy-index ** 2.
  APPEND wa TO itab.
ENDDO.
LOOP AT itab INTO wa.
  WRITE: / wa-col1, wa-col2.
ENDLOOP.
The list output is:
          0
1         1
          0
2         4
          0
3         9

Similar Messages

  • Need help in ALV

    Hi folks,
    I have a requirement in ALV format where the workcenters should be displayed in the first row..
    and the corresponding Procurement & setup should be displayed under that corresponding workcenter.
                           WOrk Center             Work Center    
                                   wc1                     wc2        
    Material no.     Procurement  setup       Procurement  setup   
    1000                       pc1          s1                 pc2         s2      
    2000                       pc3          s3                 pc4         s4     
    3000                       pc5          s5                 pc6         s6     
    and so on..
    can anyone of u tell me the desired approach for this reqt.
    Points will be rewarded if needful.
    Thanks in advance,

    Hi,
    one possible solution is to use a "Hieraquical Sequential list".
    Here´s an example:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0f03986-046c-2910-a5aa-e5364e96ea2c
    Best regards.

  • Need help in ALV web dynpro

    Hi all,
    I need help in the web dynpro ALV.
    I have an ALV generated dynamically. On the ALV, there is filter and settings link on the extreme right of the alv header.
    How is it possible to get them left align after the export button ?
    I want to maitain some gap between the export button, filter and settings.
    Please give me inputs.
    Thanks in Advance.

    Hi Jatra,
    I am working on an ALV table in a standard Web Dynpro ABAP application.
    The business requirement is to hide the header for the ALV table.
    The header has a dropdown to choose u201CStandard Viewu201D and 2 options: Filter and Settings.
    The footer for the ALV table containing the Row and Column numbering also needs to be hidden.
    I am looking at the IF_SALV_WD_TABLE_SETTINGS to find the relevant methods to hide the header and footer.
    Please let me know if I am on the right track and if there is an alternate way to do this through changing the layout of the ALV table. I tried to hide the header and footer manually via the layout but am unable to do so, as the ALV table is just displayed as ViewContainerUI Element.
    Please help me as to how to hide the header and footer as I am new to ALV in WDA.
    Thanks and Regards.

  • Need help In ALV report

    Hi All,
    I am working on ALV report.I need one logic.
    When Ever I executed report, The output should looks 'Selected Total data' like Yellow color. How can i do that.
    The report out should show sthe ' All the data is selected'. Just like Ctrl+A.
    regards,
    Ajay

    Hi
    if you wants to see the totals in separate color , you develop the I_SORT table with the respective fields and pass to the fun module
    then that total field will be always displayed with yelloe color
    or
    See this sample code to color the ALV fields
    and accordingly assign the color for your field
    REPORT zsharad_test1.
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    line_color(4) TYPE c, "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype = 'CURR'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
    gd_layout-info_fieldname = 'LINE_COLOR'.
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    is_variant = z_template
    TABLES
    t_outtab = it_ekko
    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. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    DATA: ld_color(1) TYPE c.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekko.
    *Populate field with color attributes
    LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
    i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
    IF ld_color = 8.
    ld_color = 1.
    ENDIF.
    CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
    MODIFY it_ekko FROM wa_ekko.
    ENDLOOP.
    ENDFORM. " DATA_RETRIEVAL
    Regards
    Anji

  • Need help in passing data from one page to other page in oaf

    Dear All,
    I have a requirement as below.
    I am doing some selection in one page and populating the data in another page table region, next time when i am selecting another row and pressing the button i need to display the previous row as well as new row, how can i achieve this, currently i am able to see only the first row what i selected first.
    Ex: 1 st scenario: after passing the selected data from one page to base page the data looks like below in base page.
    1 test desc
    2nd scenarios: when i am again selcting data and passing to the base page it should be like that
    1 test desc
    2 test desc
    but currently it is showing
    1 test desc only for the 2nd case, can any one please help me on thsi , its little bit urgent
    Thnaks

    How are you passing the values to the base page? Are you using setting the retainAM parameter to true while doing a forward.

  • Need help with inner join and distinct rows

    Hey Guys,
    i have
    1) BaseEnv Table 
    2) Link Table
    3) BaseData Table
    Link table has three columns Id,BaseEnvId,BaseDataId 
    the BaseEnvID is unique in the table where as BaseDataId can be repeated i.e multile rows of BaseEnv Table can point to same BaseData  table row
    Now i want to do  BaseEnvTable inner join Link Table inner join BaseData Table and select 5 columsn ; Name,SyncName,Version,PPO,DOM  from the BaseData table.. the problem is that after i do the inner join I get duplciate records..
    i want to eliminate the duplicate records , can any one help me here

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Now we have to guess and type, guess and type, etc. because of your bad manners. 
    CREATE TABLE Base_Env
    (base_env_id CHAR(10) NOT NULL PRIMARY KEY,
    Think about the name Base_Data; do you have lots of tables without data? Silly, unh? 
    CREATE TABLE Base_Data
    (base_data_id CHAR(10) NOT NULL PRIMARY KEY,
    Your Links table is wrong in concept and implementation. The term “link” refers to a pointer chain structure used in network databases and makes no sense in RDBMS. There is no generic, magic, universal “id” in RDBMS! People that do this are called “id-iots”
    in SQL slang. 
    We can model a particular relationship in a table by referencing the keys in other tables. But we need to know if the relationship is 1:1, 1:m, or n:m. This is the membership of the relationship. Your narrative implies this: 
    CREATE TABLE Links
    (base_env_id CHAR(10) NOT NULL UNIQUE
       REFERENCES Base_Env (base_env_id),
     base_data_id CHAR(10) NOT NULL
       REFERENCES Base_Data (base_data_id));
    >> The base_env_id is unique in the table where as base_data_id can be repeated I.e multiple rows of Base_Env Table can point [sic] to same Base_Data table row. <<
    Again, RDBMS has no pointers! We have referenced an referencing tables. This is a fundamental concept. 
    That narrative you posted has no ON clauses! And the narrative is also wrong. There is no generic “name”, etc. What tables were used in your non-query? Replace the ?? in this skeleton: 
    SELECT ??.something_name, ??.sync_name, ??.something_version, 
           ??.ppo, ??.dom
    FROM Base_Env AS E, Links AS L, Base_Data AS D
    WHERE ?????????;
    >> I want to eliminate the duplicate records [sic], can any one help me here?<<
    Where is the sample data? Where is the results? Please read a book on RDBMS so you can post correct SQL and try again. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Help req : alv grid with multiple row selection

    Hi all sap gurus,
    i have a alv list display program , in which i can select the o/p rows(multiple rows)
    and perform some actiom based on some icons .
    now i have to convert this in to grid display
    this is initial code i.e for list
    DATA :  BEGIN OF itab OCCURS 0.
            INCLUDE STRUCTURE ztest.
    DATA :  checkbox type c.
    DATA : END OF itab.
    s_layout-box_fieldname = 'CHECKBOX'.
      ty_events-name = slis_ev_top_of_page.
      ty_events-form =  'TOP_OF_PAGE'.
      APPEND ty_events TO it_events.
    ALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name     = v_repid
                i_internal_tabname = 'ITAB'
                i_inclname         = v_repid
           CHANGING
                ct_fieldcat        = build_fieldcatalog.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
       I_INTERFACE_CHECK              = ' '
       I_BUFFER_ACTIVE                = ' '
         i_callback_program             = v_repid
         i_callback_pf_status_set       = 'SET_PF_STATUS'
         i_callback_user_command        = 'USER_COMMAND'
         i_structure_name               = 'ITAB'
         is_layout                      = s_layout
         it_fieldcat                    = build_fieldcatalog[]
       IT_EXCLUDING                   =
       IT_SPECIAL_GROUPS              =
       IT_SORT                        =
       IT_FILTER                      =
       IS_SEL_HIDE                    =
       I_DEFAULT                      = 'X'
       I_SAVE                         = ' '
       IS_VARIANT                     =
         it_events                      = it_events
       IT_EVENT_EXIT                  =
       IS_PRINT                       =
       IS_REPREP_ID                   =
       I_SCREEN_START_COLUMN          = 0
       I_SCREEN_START_LINE            = 0
       I_SCREEN_END_COLUMN            = 0
       I_SCREEN_END_LINE              = 0
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER        =
       ES_EXIT_CAUSED_BY_USER         =
          TABLES
            t_outtab                    = itab
         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.
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
      IF ucomm = 'DELE'.
        LOOP AT iTAB WHERE CHECKbox = 'X' .
        ENDLOOP.
        MODIFY  ztEST FROM TABLE itAB.
      ENDIF.
      selfield-refresh = 'X'.
    ENDFORM.
    NOW I HAVE A LIST O/P WHERE I CAN SELECT THE BOX AND CLICK DELETE ICON.
    NOW I WANT TO CHANGE TO GRID, SO I KEPT EVERYTHING SAMRE AND I CHANGED  " LIST" TO "GRID"
    NOW TWO THINGS HAPPEND
    1) I SEE A EMPTY COLUMN IN THE O/P , I GUESS THATS BECAUSE CHECKBOSX IN INTERNAL TABLE , SO I REMOVED IT
    SO THIS MADE ME TO REMOVE
    IF ucomm = 'DELE'.
        LOOP AT iTAB." WHERE CHECKbox = 'X' .------PROBLEM
        ENDLOOP.
        MODIFY  ztEST FROM TABLE itAB.
      ENDIF.
      selfield-refresh = 'X'.
    NOW I DON'T SEE THE EMPTY COLUMN , BUT NOW PROBLEM  IS I CANNNOT DISTINGUISH AS TO WHICH IS SELECTED AND AT ANY POINT OF TIME I CANSELECT ONLY ROW.
    ALL I WANT IS
    1) I WANT TO SELECT MULTIPLE ROWS AND SHOULD BE ABLE TO KNOW WHICH ROWS WERE SELECTED IN THE O/P SCREEN.
    IN THE LIST DISPLAY I HAD CHECKBOX = 'X' FOR ALL THE ROWS THAT WERE SELECTED , I WANT THE SIMILAR THING in grid display
    LET ME KNOW whether this can be done without USING 00 LANG.
    thanks

    Hi Swati,
    Below code might help full for you. Description: is It selects multiple rows from ALV and display it on the next ALV.
    *************************Reward Point If help full********************************************
    *& Report   z7cc_alv_oops_show_next_alv                                *
    *&          DEVELOPERS NAME : CHIDANAND CHAUHAN
    *&          DATE: SATURDAY 08-07-2006
    *&          DESCRIPTION: TO CREATE AN OBJECT ORIENTED ALV
    REPORT      z7cc_alv_oops_show_next_alv MESSAGE-ID  z5hs .
    DATA : BEGIN OF it_mara OCCURS 0,
      mark  TYPE flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF it_mara.
    DATA : BEGIN OF it_mara1 OCCURS 0,
    *  mark  type flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF it_mara1.
    DATA : BEGIN OF it_mara2 OCCURS 0,
    *  mark  type flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF it_mara2.
    DATA : t_fieldcat TYPE lvc_t_fcat,
             t_fieldcat1 TYPE lvc_t_fcat,
          s_fieldcat LIKE LINE OF t_fieldcat.
    DATA : s_layout TYPE lvc_s_layo.
    DATA : control TYPE REF TO cl_gui_custom_container,
           grid  TYPE REF TO cl_gui_alv_grid.
    DATA: BEGIN OF wa ,
      mark  TYPE flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF wa.
    *       CLASS lcl_events_box DEFINITION
    CLASS lcl_events_box DEFINITION.
      PUBLIC SECTION.
        METHODS :
    *Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
    *imporTing er_data_changed,
        handler_user_command FOR EVENT user_command OF cl_gui_alv_grid
        IMPORTING e_ucomm,
        handler_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
        IMPORTING e_object e_interactive.
    ENDCLASS.                    "lcl_events_box DEFINITION
    *       CLASS lcl_events_box IMPLEMENTATION
    CLASS lcl_events_box IMPLEMENTATION.
    * method to handle the user command.
      METHOD handler_user_command.
        PERFORM form_usercommand CHANGING e_ucomm.
      ENDMETHOD.                    "Handler_user_command
    *& Mehod to handle the toolbar.
      METHOD handler_toolbar.
        PERFORM form_toolbar CHANGING e_object e_interactive
        e_object->mt_toolbar.
      ENDMETHOD.                    "Handler_ToolBar
    ENDCLASS.                    "lcl_events_box IMPLEMENTATION
    START-OF-SELECTION.
      DATA : w_events TYPE REF TO lcl_events_box.
      SELECT matnr mtart meins FROM mara INTO CORRESPONDING FIELDS OF TABLE
      it_mara.
      CALL SCREEN 100.
    *&      Module  pbo_module  OUTPUT
    *       text
    MODULE pbo_module OUTPUT.
      IF grid IS INITIAL.
        CREATE OBJECT control
          EXPORTING
            container_name     = 'CUST_CTRL'.
        CREATE OBJECT grid
          EXPORTING
            i_parent          = control.
        PERFORM build_catalog.
        PERFORM build_catalog1.
        PERFORM build_layout.
        CALL METHOD grid->set_table_for_first_display
          EXPORTING
            is_layout       = s_layout
          CHANGING
            it_outtab       = it_mara[]
            it_fieldcatalog = t_fieldcat.
        CREATE OBJECT w_events.
        SET HANDLER : w_events->handler_toolbar FOR grid,
                      w_events->handler_user_command FOR grid.
        CALL METHOD grid->set_toolbar_interactive.
      ELSE.
        CALL METHOD grid->refresh_table_display.
      ENDIF.
    ENDMODULE.                 " pbo_module  OUTPUT
    *&      Form  BUILD_CATALOG
    FORM build_catalog .
      s_fieldcat-col_pos = '1'.
      s_fieldcat-fieldname = 'MARK'.
      s_fieldcat-checkbox = 'X'.
      s_fieldcat-edit = 'X'.
      APPEND s_fieldcat TO t_fieldcat.
      CLEAR s_fieldcat.
      s_fieldcat-col_pos = '2'.
      s_fieldcat-fieldname = 'MATNR'.
      s_fieldcat-scrtext_m = 'MATERIAL'.
      APPEND s_fieldcat TO t_fieldcat.
      s_fieldcat-col_pos = '3'.
      s_fieldcat-fieldname = 'MTART'.
      s_fieldcat-scrtext_m = 'MATERL TYPE'.
      APPEND s_fieldcat TO t_fieldcat.
      s_fieldcat-col_pos = '4'.
      s_fieldcat-fieldname = 'MEINS'.
      s_fieldcat-scrtext_m = 'UOM'.
      APPEND s_fieldcat TO t_fieldcat.
    ENDFORM.                    " BUILD_CATALOG
    *&      Form  BUILD_LAYOUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_layout .
      s_layout-zebra = 'X'.
    * S_LAYOUT-CWIDTH_OPT = 'X'.
      s_layout-grid_title = 'Material Details'.
    ENDFORM.                    "BUILD_LAYOUT
    " BUILD_LAYOUT////////////////////////////////////
    " USER_COMMAND_0100  INPUT
    *&      Form  FORM_USERCOMMAND
    *       text
    *      <--P_E_UCOMM  text
    FORM form_usercommand  CHANGING p_e_ucomm.
      CASE p_e_ucomm.
        WHEN 'INT1'.
          DO.
            READ TABLE it_mara INDEX sy-index TRANSPORTING mark matnr.
            IF sy-subrc <> 0.
              EXIT.
            ENDIF.
            IF it_mara-mark = 'X'.
              READ TABLE it_mara INTO wa TRANSPORTING matnr mtart meins .
              MOVE-CORRESPONDING wa TO it_mara1.
              READ TABLE it_mara1 TRANSPORTING matnr mtart meins .
              MOVE-CORRESPONDING it_mara1  TO it_mara2.
              APPEND it_mara2.
              CALL METHOD grid->set_table_for_first_display
                EXPORTING
                  is_layout       = s_layout
                CHANGING
                  it_outtab       = it_mara2[]
                  it_fieldcatalog = t_fieldcat1.
    *       SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
    *       CALL TRANSACTION 'MM02'.
            ENDIF.
    *      ENDIF.
          ENDDO.
      ENDCASE.
    ENDFORM.                    " FORM_USERCOMMAND
    *&      Form  FORM_TOOLBAR
    *       text
    *      <--P_E_OBJECT  text
    *      <--P_E_INTERACTIVE  text
    *      <--P_E_OBJECT_>MT_TOOLBAR  text
    FORM form_toolbar  CHANGING p_e_object TYPE REF TO
    cl_alv_event_toolbar_set
    p_e_interactive
    mt_toolbar TYPE ttb_button.
      DATA wal_button TYPE stb_button.
    *WAL_BUTTON-ICON = ICON_status_reverse.
      wal_button-text = 'GO'.
      wal_button-quickinfo = 'PROCEED'.
      wal_button-function = 'INT1'.
      wal_button-butn_type = 0.
      wal_button-disabled = space.
      INSERT wal_button  INTO p_e_object->mt_toolbar INDEX 1.
    ENDFORM.                    " FORM_TOOLBAR
    *&      Module  PF-STATUS  OUTPUT
    *       text
    MODULE pf-status OUTPUT.
      SET PF-STATUS 'Z7CCSTAT'.
    ENDMODULE.                 " PF-STATUS  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_CATALOG1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_catalog1 .
      s_fieldcat-col_pos = '1'.
      s_fieldcat-fieldname = 'MATNR'.
      s_fieldcat-scrtext_m = 'MATERIAL'.
      APPEND s_fieldcat TO t_fieldcat1.
      s_fieldcat-col_pos = '2'.
      s_fieldcat-fieldname = 'MTART'.
      s_fieldcat-scrtext_m = 'MATERL TYPE'.
      APPEND s_fieldcat TO t_fieldcat1.
      s_fieldcat-col_pos = '3'.
      s_fieldcat-fieldname = 'MEINS'.
      s_fieldcat-scrtext_m = 'UOM'.
      APPEND s_fieldcat TO t_fieldcat1.
    ENDFORM.                    " BUILD_CATALOG1

  • Hello Friends need help in ALV oops

    Hello,
    My requirement is that in my ALV ouptut i will edit one cell when i am editing i.e if its is 200,00 i will change it to 300,00 before changing it should ask me wheather to change it or not i need to dispaly a dialog box with yes or no option if i click yes then it should accept the value 300,00.
    I am using ALV OOPS.

    Hi,
    You can achieve this as below,
    DATA: w_result TYPE c.
      METHOD handle_user_command.
    *   Handle own functions defined in the toolbar
        CASE e_ucomm.
          WHEN 'CHANGE'.
    CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
      EXPORTING
       defaultoption       = 'N'
        textline1           = 'Do you want to change the value?'
    *   TEXTLINE2           = ' '
        titel               = 'Confirmation for change'
    *   START_COLUMN        = 25
    *   START_ROW           = 6
    IMPORTING
       answer              = w_result.
    IF w_result = 'J'. "J is for yes.
    "Write your logic for saving the changes
    ENDIF.
      ENDCASE.
      ENDMETHOD.                    "handle_user_command
    Hope thi helps you.
    Regards,
    Manoj Kumar P

  • Need help on ALV report

    hi,
    i am new to ALV programming,i awant to generate the report with three teable mseg,mkpf,mard.
    i need selection screen also.
    in the selection screen following is the field names.
    Matdoc number-mseg-mblnr
    mat number - mseg-matnr
    plant - mseg-werks
    sloc mseg-lgort
    movtype- mseg-bwart.
    batch number- mseg-charg.
    ordernumber -mseg-aufnr.
    costcenter- mseg-kostl.
    reservation number- mseg-rsnum.
    storage bin - mard-lgpbe.
    i want to fetch the data from three tables
    mseg,mard,mkpf.
    after featch report should disply in alv grid following items.
    Matdoc number-mseg-mblnr
    mat number - mseg-matnr
    plant - mseg-werks
    sloc mseg-lgort
    movtype- mseg-bwart.
    batch number- mseg-charg.
    ordernumber -mseg-aufnr.
    costcenter- mseg-kostl.
    reservation number- mseg-rsnum.
    storage bin - mard-lgpbe.
    posting date - mkpf-budat.
    if any body have the code kindly send it as early as posible.
    Thanks,
    Rammohan.

    here is a sample program i think almost containing the same tables and fields
    *& Report  ZSD_R_ENHANCEMENT2                                           *
    *& REPORT PROGRAMMING FOR THE FURTHER ENHANCEMENT OF THE PRE-GENERATED
    *& MB51. REQUIREMENT IS TO ADD FIVE MORE FIELDS.
    *& OLD MATERIAL ON THE TOP LEFT CORNER OF THE HEADER AND
    *& Batch number the right of material document.
    *& Serial number if found should be placed to the right of the batch number.
    *& Handling unit/ storage unit to the right of serial number.
    *& Transaction description at the last of the report.
    REPORT  ZSD_R_ENHANCEMENT2 MESSAGE-ID ZB6T2                      .
    *& STRUCTURE CREATION FOR INTERNAL TABLES                              *
    *STRUCUTRE CREATION FOR HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
    TYPES: BEGIN OF TY_MKPF_MSEG,
           MBLNR TYPE MBLNR,   " NUMBER OF MATERIAL DOC
           MJAHR TYPE MJAHR,   " MATERIAL DOCUMENT YEAR
           VGART TYPE VGART,   " TRANSACTION EVENT TYPE
           BLART TYPE BLART,   " DOCUMENT TYPE
           BUDAT TYPE BUDAT,   " POSTING DATE INT THE DOC
           USNAM TYPE USNAM,   " USERNAME
           XBLNR TYPE XBLNR1,  " REFERENCE DOCUMENT NUMBER
           MATNR TYPE MATNR,   " MATERIAL NUMBER
           WERKS TYPE WERKS_D, " PLANT
           LGORT TYPE LGORT_D, " STORAGE LOCATION
           CHARG TYPE CHARG_D, " BATCH NUM
           LIFNR TYPE ELIFN,   " ACC OF VENDOR
           KUNNR TYPE EKUNN,   " CUSTOMER NUM
           SOBKZ TYPE SOBKZ,   " SPECIAL STOKING
           BWART TYPE BWART,   " MOVEMENT TYPE
           ZEILE TYPE MBLPO,   " ITEM IN MATERIAL DOCUMENT
           ERFMG TYPE ERFMG,   " QUANTITY IN UNIT OF ENTERY
           ERFME TYPE ERFME,   " UNIT OF ENTRY
           END OF TY_MKPF_MSEG,
    *STRUCTURE FOR MATERIAL MASTER DATA
           BEGIN OF TY_MARA,
           MATNR TYPE MATNR,   " MATERIAL TYPE
           BISMT TYPE BISMT,   " OLD MATERIAL NUMBER
           END OF TY_MARA,
    *STRUCTURE DECLARATION FOR MATERIAL DESCRIPTION
           BEGIN OF TY_MAKT,
           MATNR TYPE MATNR,   " MATERIAL NUM
           SPRAS TYPE SPRAS,    " LANGUAGE KEY
           MAKTX TYPE MAKTX,   " MATERIAL DESC
           END OF TY_MAKT,
    *STRUCTURE DECLARATION FOR MOVEMENT TYPE TEXT
           BEGIN OF TY_T156T,
           BWART TYPE BWART,   " MOVEMENT TYPE
           BTEXT TYPE BTEXT,   " MOVEMENT TYPE TEXT
           SPRAS TYPE SPRAS,   " LANGUAGE KEY
           END OF TY_T156T,
    *STRUCTURE CREATION FOR DOCUMENT HEADER FOR SERIALNUMBERS FOR GOOD MOVEMENTS
           BEGIN OF TY_SER03,
           MBLNR TYPE MBLNR,   " NUMBER OF MATERIAL DOC
           MJAHR TYPE MJAHR,   " MATERIAL DOCU YEAR
           ZEILE TYPE MBLPO,   " OUTPUT IN MATERIAL DOC
           OBKNR TYPE OBJKNR,  " OBJECT LIST NUMBER
           END OF TY_SER03,
    *STRUCUTRE DECLARATION FOR PLANTS MAINTANENCE OBKECT LIST
           BEGIN OF TY_OBJK,
           OBKNR TYPE OBJKNR,  " OBJECT LIST NUMBER
           OBZAE TYPE OBJZA,   " OBLECT LIST COUNTERS
           SERNR TYPE GERNR,   " SERIAL NUMBER
           END OF TY_OBJK,
    *STRUCUTRE DECLARATION FOR PLANTS/BRANCHES
           BEGIN OF TY_T001W,
           WERKS TYPE WERKS_D, " PLANT
           NAME1 TYPE NAME1,   " NAME
           END OF TY_T001W,
    *STRUCUTRE DECLARATION FOR OUTPUT TABLE
          BEGIN OF TY_OUTPUT,
           MATNR TYPE MATNR,   " MATERIAL NUMBER
           BISMT TYPE BISMT,   " OLD MATERIAL NUMBER
           MAKTX TYPE MAKTX,   " MATERIAL DESC
           WERKS TYPE WERKS_D, " PLANT
           NAME1 TYPE NAME1,   " NAME
           LGORT TYPE LGORT_D, " Storage Location
           BWART TYPE BWART,   " Movement Type
           MBLNR TYPE MBLNR,   " NUMBER OF MATERIAL DOC
           CHARG TYPE CHARG_D, " BATCH NUM
           SERNR TYPE GERNR,   " SERIAL NUMBER
           ZEILE TYPE MBLPO,   " OUTPUT IN MATERIAL DOC
           BUDAT TYPE BUDAT,   " POSTING DOCU DATE
           ERFMG TYPE ERFMG,   " QUANTITY IN UNIT OF ENTRY
           ERFME TYPE ERFME,   " UNINT OF ENTRY
           BTEXT TYPE BTEXT,   " MOVEMENT TYPE TEXT
           MJAHR TYPE MJAHR,   " MATEREIAL DOC YEAR
           VGART TYPE VGART,   " TRANSACTION EVENT TYPE
           BLART TYPE BLART,   " DOCUMENT TYPE
           USNAM TYPE USNAM,   " USERNAME
           XBLNR TYPE XBLNR1,  " REFERENCE DOCUMENT NUM
           SOBKZ TYPE SOBKZ,   " SPECIAL STOCKING
           LIFNR TYPE ELIFN,   " ACC OF VENDOR
           KUNNR TYPE EKUNN,   " CUSTOMER
           OBKNR TYPE OBJKNR,  " OBJECT LIST NUMBER
           END OF TY_OUTPUT.
    *&INTERNAL TABLE DECLARATION FOR STRUCUTRES                            *
    INTERNAL TABLE DECLARATION FOR HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
    DATA : T_MKPF_MSEG TYPE STANDARD TABLE OF TY_MKPF_MSEG INITIAL SIZE 0,
    *INTERNAL TABLE DECLARATION FOR MATERIAL MASTER DAT
           T_MARA TYPE STANDARD TABLE OF TY_MARA INITIAL SIZE 0,
    *INTERNAL TABLE DECLARATION FOR MATERIAL TYPE DESC
           T_MAKT TYPE STANDARD TABLE OF TY_MAKT INITIAL SIZE 0,
    *INTERNAL TABLE DECLARATION FOR MOVEMENT TYPE TEXT
           T_T156T TYPE STANDARD TABLE OF TY_T156T INITIAL SIZE 0,
    *INTERNAL TABLE DECLARATION FOR Document Header for Serial Numbers for Goods Movements
           T_SER03 TYPE STANDARD TABLE OF TY_SER03 INITIAL SIZE 0,
    *INTERNAL TABLE DECLARATION FOR Plant Maintenance Object List
           T_OBJK TYPE STANDARD TABLE OF TY_OBJK INITIAL SIZE 0,
    *INTERNAL TABLE DECLARATION FOR Plants/Branches
           T_T001W TYPE STANDARD TABLE OF TY_T001W INITIAL SIZE 0,
    *INTERNAL TABLE DECLARATION FOR OUTPUT
           T_OUTPUT TYPE STANDARD TABLE OF TY_OUTPUT INITIAL SIZE 0,
    *&WORK AREA DECLARATIONS FOR INTERNAL TABLES                           *
    *WORK AREA DECLARATION HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
           W_MKPF_MSEG TYPE TY_MKPF_MSEG,
    *WORK AREA DECLARATION MATERIAL MASTER DATA
           W_MARA TYPE TY_MARA,
    *WORK AREA DECLARATION MATERIAL TYPE DESC
           W_MAKT TYPE TY_MAKT,
    *WORK AREA DECLARATION MOVEMENT TYPE TEXT\
           W_T156T TYPE TY_T156T,
    *WORK AREA DECLARATION Document Header for Serial Numbers for Goods Movements
           W_SER03 TYPE TY_SER03,
    *WORK AREA DECLARATION PLANT MAINTENANCE OBJECT LIST
           W_OBJK TYPE TY_OBJK,
    *WORK AREA DECLARATION PLANTS AND BRANCHES
           W_T001W TYPE TY_T001W,
    *WORK AREA DECLARATION FOR OUTPUT TABLE.
          W_OUTPUT TYPE TY_OUTPUT,
    *& GLOBAL VARIABLE DECLARATIONS                                        *
           G_MATNR TYPE MSEG-MATNR,
           G_WERKS TYPE MSEG-WERKS,
           G_LGORT TYPE MSEG-LGORT,
           G_CHARG TYPE MSEG-CHARG,
           G_LIFNR TYPE MSEG-LIFNR,
           G_KUNNR TYPE MSEG-KUNNR,
           G_BWART TYPE MSEG-BWART,
           G_SOBKZ TYPE MSEG-SOBKZ,
           G_BUDAT TYPE MKPF-BUDAT,
           G_USNAM TYPE MKPF-USNAM,
           G_VGART TYPE MKPF-VGART,
           G_XBLNR TYPE MKPF-XBLNR.
    *& SELECTION SCREEN EVENT                                              *
    *SELECT OPTIONS EVENTS FOR ITEM DETAILS
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECT-OPTIONS: S_MATNR FOR G_MATNR,
                    S_WERKS FOR G_WERKS,
                    S_LGORT FOR G_LGORT,
                    S_CHARG FOR G_CHARG,
                    S_LIFNR FOR G_LIFNR,
                    S_KUNNR FOR G_KUNNR,
                    S_BWART FOR G_BWART,
                    S_SOBKZ FOR G_SOBKZ.
    SELECTION-SCREEN END OF BLOCK B1.
    *SELECT OPTIONS EVENTS FOR HEADER DETAILS
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
    SELECT-OPTIONS: S_BUDAT FOR G_BUDAT,
                    S_USNAM FOR G_USNAM,
                    S_VGART FOR G_VGART,
                    S_XBLNR FOR G_XBLNR.
    SELECTION-SCREEN END OF BLOCK B2.
    *&INITIALIZATION EVENTS                                                *
    INITIALIZATION.
      CLEAR: W_MKPF_MSEG,
             W_MARA,
             W_MAKT,
             W_T156T,
             W_SER03,
             W_OBJK,
             W_T001W,
             W_OUTPUT.
      REFRESH: T_MKPF_MSEG,
               T_MARA,
               T_MAKT,
               T_T156T,
               T_SER03,
               T_OBJK,
               T_T001W,
               T_OUTPUT.
    *&  At Selection screen Event
    AT SELECTION-SCREEN.
      PERFORM SUB_VALID_MATNR.
      PERFORM SUB_VALID_WERKS.
      PERFORM SUB_VALID_LGORT.
      PERFORM SUB_VALID_CHARG.
      PERFORM SUB_VALID_LIFNR.
      PERFORM SUB_VALID_KUNNR.
      PERFORM SUB_VALID_BWART.
      PERFORM SUB_VALID_SOBKZ.
      PERFORM SUB_VALID_BUDAT.
      PERFORM SUB_VALID_USNAM.
      PERFORM SUB_VALID_VGART.
      PERFORM SUB_VALID_XBLNR.
    *&  Start of selection event.
    START-OF-SELECTION.
      PERFORM SUB_GET_MKPF_MSEG.
      PERFORM SUB_GET_MARA.
      PERFORM SUB_GET_MAKT.
      PERFORM SUB_GET_T156T.
      PERFORM SUB_GET_SER03.
      PERFORM SUB_GET_T001W.
      PERFORM SUB_BSLIST_DISP.
    *&      Form  SUB_VALID_MATNR
    *VALIDATION FOR MATERIAL NUM
    FORM SUB_VALID_MATNR .
      DATA : L_MATNR TYPE MATNR.
      SELECT SINGLE MATNR
             FROM MARA
             INTO L_MATNR
             WHERE MATNR IN S_MATNR.
      IF SY-SUBRC <> 0.
       MESSAGE E001.
      ENDIF.
    ENDFORM.                    " SUB_VALID_MATNR
    *&      Form  SUB_VALID_WERKS
          text
    FORM SUB_VALID_WERKS .
      DATA L_WERKS TYPE WERKS_D.
      SELECT SINGLE WERKS
             FROM T001W
             INTO L_WERKS
             WHERE WERKS IN S_WERKS.
      IF SY-SUBRC <> 0.
        MESSAGE E002.
      ENDIF.
    ENDFORM.                    " SUB_VALID_WERKS
    *&      Form  SUB_VALID_LGORT
          text
    FORM SUB_VALID_LGORT .
      DATA L_LGORT TYPE LGORT_D.
      SELECT SINGLE LGORT
             FROM T001L
             INTO L_LGORT
             WHERE LGORT IN S_LGORT.
      IF SY-SUBRC <> 0.
       MESSAGE E003.
      ENDIF.
    ENDFORM.                    " SUB_VALID_LGORT
    *&      Form  SUB_VALID_CHARG
          text
    FORM SUB_VALID_CHARG .
      DATA L_CHARG TYPE CHARG_D.
      SELECT SINGLE CHARG
             FROM MCHA
             INTO L_CHARG
             WHERE CHARG IN S_CHARG.
      IF SY-SUBRC <> 0.
       MESSAGE E004.
      ENDIF.
    ENDFORM.                    " SUB_VALID_CHARG
    *&      Form  SUB_VALID_LIFNR
          text
    FORM SUB_VALID_LIFNR .
      DATA L_LIFNR TYPE LIFNR.
      SELECT SINGLE LIFNR
             FROM LFA1
             INTO L_LIFNR
             WHERE LIFNR IN S_LIFNR.
      IF SY-SUBRC <> 0.
       MESSAGE E005.
      ENDIF.
    ENDFORM.                    " SUB_VALID_LIFNR
    *&      Form  SUB_VALID_KUNNR
          text
    FORM SUB_VALID_KUNNR .
      DATA L_KUNNR TYPE KUNNR.
      SELECT SINGLE KUNNR
             FROM KNA1
             INTO L_KUNNR
             WHERE KUNNR IN S_KUNNR.
      IF SY-SUBRC <> 0.
       MESSAGE E006.
      ENDIF.
    ENDFORM.                    " SUB_VALID_KUNNR
    *&      Form  SUB_VALID_BWART
          text
    FORM SUB_VALID_BWART .
      DATA L_BWART TYPE BWART.
      SELECT SINGLE BWART
             FROM T156
             INTO L_BWART
             WHERE BWART IN S_BWART.
      IF SY-SUBRC <> 0.
       MESSAGE E007.
      ENDIF.
    ENDFORM.                    " SUB_VALID_BWART
    *&      Form  SUB_VALID_SOBKZ
          text
    FORM SUB_VALID_SOBKZ .
    DATA L_SOBKZ TYPE SOBKZ.
    SELECT SINGLE SOBKZ
           FROM T148
           INTO L_SOBKZ
           WHERE SOBKZ IN S_SOBKZ.
    IF SY-SUBRC <> 0.
    MESSAGE E008.
    ENDIF.
    ENDFORM.                    " SUB_VALID_SOBKZ
    *&      Form  SUB_VALID_BUDAT
          text
    FORM SUB_VALID_BUDAT .
      DATA L_BUDAT TYPE BUDAT.
      SELECT SINGLE BUDAT
             FROM MKPF
             INTO L_BUDAT
             WHERE BUDAT IN S_BUDAT.
      IF SY-SUBRC <> 0.
       MESSAGE E009.
      ENDIF.
    ENDFORM.                    " SUB_VALID_BUDAT
    *&      Form  SUB_VALID_USNAM
          text
    FORM SUB_VALID_USNAM .
      DATA L_USNAM TYPE USNAM.
      SELECT SINGLE USNAM
             FROM MKPF
             INTO L_USNAM
             WHERE USNAM IN S_USNAM.
      IF SY-SUBRC <> 0.
       MESSAGE E010.
      ENDIF.
    ENDFORM.                    " SUB_VALID_USNAM
    *&      Form  SUB_VALID_VGART
          text
    FORM SUB_VALID_VGART .
      DATA L_VGART TYPE VGART.
      SELECT SINGLE VGART
             FROM MKPF
             INTO L_VGART
             WHERE VGART IN S_VGART.
      IF SY-SUBRC <> 0.
       MESSAGE E011.
      ENDIF.
    ENDFORM.                    " SUB_VALID_VGART
    *&      Form  SUB_VALID_XBLNR
          text
    FORM SUB_VALID_XBLNR .
      DATA L_XBLNR TYPE XBLNR.
      SELECT SINGLE XBLNR
             FROM MKPF
             INTO L_XBLNR
             WHERE XBLNR IN S_XBLNR.
      IF SY-SUBRC <> 0.
        MESSAGE E012.
      ENDIF.
    ENDFORM.                    " SUB_VALID_XBLNR
    *&      Form  SUB_GET_MKPF_MSEG
          text
    FORM SUB_GET_MKPF_MSEG .
      REFRESH T_MKPF_MSEG.
      SELECT KMBLNR KMJAHR K~VGART
             KBLART KBUDAT K~USNAM
             K~XBLNR
             SMATNR SWERKS S~LGORT
             SCHARG SLIFNR S~KUNNR
             SSOBKZ SBWART S~ZEILE
             SERFMG SERFME
         INTO TABLE T_MKPF_MSEG
         FROM MKPF AS K INNER JOIN MSEG AS S
           ON KMBLNR = SMBLNR AND KMJAHR = SMJAHR
        WHERE    K~VGART IN S_VGART
             AND K~BUDAT IN S_BUDAT
             AND K~USNAM IN S_USNAM
             AND K~XBLNR IN S_XBLNR
             AND S~MATNR IN S_MATNR
             AND S~WERKS IN S_WERKS
             AND S~LGORT IN S_LGORT
             AND S~CHARG IN S_CHARG
             AND S~SOBKZ IN S_SOBKZ
             AND S~LIFNR IN S_LIFNR
             AND S~KUNNR IN S_KUNNR.
    ENDFORM.                    " SUB_GET_MKPF_MSEG
    *&      Form  SUB_GET_MARA
          text
    FORM SUB_GET_MARA .
      IF T_MKPF_MSEG IS NOT INITIAL.
        SORT T_MKPF_MSEG BY MATNR.
        REFRESH T_MARA.
      SELECT MATNR
             BISMT
             FROM MARA
             INTO TABLE T_MARA
             FOR ALL ENTRIES IN T_MKPF_MSEG
             WHERE MATNR = T_MKPF_MSEG-MATNR.
    ENDIF.
    ENDFORM.                    " SUB_GET_MARA
    *&      Form  SUB_GET_MAKT
          text
    FORM SUB_GET_MAKT .
    REFRESH T_MAKT.
      SELECT MATNR
             SPRAS
             MAKTX
             FROM MAKT
             INTO TABLE T_MAKT
             FOR ALL ENTRIES IN T_MKPF_MSEG
             WHERE SPRAS = SY-LANGU AND  MATNR = T_MKPF_MSEG-MATNR.
    ENDFORM.                    " SUB_GET_MAKT
    *&      Form  SUB_GET_T156T
          text
    FORM SUB_GET_T156T .
      SELECT BWART
             BTEXT
             SPRAS
             FROM T156T
             INTO TABLE T_T156T
             FOR ALL ENTRIES IN T_MKPF_MSEG
             WHERE SPRAS = SY-LANGU AND BWART = T_MKPF_MSEG-BWART.
    ENDFORM.                    " SUB_GET_T156T
    *&      Form  SUB_GET_SER03
          text
    FORM SUB_GET_SER03 .
      SELECT MBLNR
             MJAHR
             ZEILE
             OBKNR
             FROM SER03
             INTO TABLE T_SER03
             FOR ALL ENTRIES IN T_MKPF_MSEG
             WHERE MBLNR = T_MKPF_MSEG-MBLNR
             AND MJAHR = T_MKPF_MSEG-MJAHR
             AND ZEILE = T_MKPF_MSEG-ZEILE.
    IF T_SER03 IS NOT INITIAL.
      SELECT OBKNR
             OBZAE
             SERNR
             FROM OBJK
             INTO CORRESPONDING FIELDS OF TABLE T_OBJK
             FOR ALL ENTRIES IN T_SER03
             WHERE OBKNR = T_SER03-OBKNR.
    ENDIF.
    ENDFORM.                    " SUB_GET_SER03
    *&      Form  SUB_GET_T001W
          text
    FORM SUB_GET_T001W .
      SELECT WERKS
             NAME1
             FROM T001W
             INTO TABLE T_T001W
             FOR ALL ENTRIES IN T_MKPF_MSEG
             WHERE WERKS = T_MKPF_MSEG-WERKS.
    ENDFORM.                    " SUB_GET_T001W
    *&      Form  SUB_BSLIST_DISP
    FOR DISPLAY OUT
    FORM SUB_BSLIST_DISP .
    REFRESH T_OUTPUT.
      CLEAR W_MKPF_MSEG.
      SORT T_MKPF_MSEG BY MBLNR MJAHR ZEILE MATNR.
      LOOP AT T_MKPF_MSEG INTO W_MKPF_MSEG.
        W_OUTPUT-MBLNR = W_MKPF_MSEG-MBLNR .
        W_OUTPUT-MJAHR = W_MKPF_MSEG-MJAHR.
        W_OUTPUT-VGART = W_MKPF_MSEG-VGART.
        W_OUTPUT-BLART = W_MKPF_MSEG-BLART.
        W_OUTPUT-BUDAT = W_MKPF_MSEG-BUDAT.
        W_OUTPUT-USNAM = W_MKPF_MSEG-USNAM.
        W_OUTPUT-XBLNR = W_MKPF_MSEG-XBLNR.
        W_OUTPUT-ZEILE = W_MKPF_MSEG-ZEILE.
        W_OUTPUT-BWART = W_MKPF_MSEG-BWART.
        W_OUTPUT-MATNR = W_MKPF_MSEG-MATNR.
        W_OUTPUT-WERKS = W_MKPF_MSEG-WERKS.
        W_OUTPUT-LGORT = W_MKPF_MSEG-LGORT.
        W_OUTPUT-CHARG = W_MKPF_MSEG-CHARG.
        W_OUTPUT-SOBKZ = W_MKPF_MSEG-SOBKZ.
        W_OUTPUT-LIFNR = W_MKPF_MSEG-LIFNR.
        W_OUTPUT-KUNNR = W_MKPF_MSEG-KUNNR.
        W_OUTPUT-ERFMG = W_MKPF_MSEG-ERFMG.
        W_OUTPUT-ERFME = W_MKPF_MSEG-ERFME.
        CLEAR W_MARA.
        READ TABLE T_MARA INTO W_MARA WITH KEY MATNR = W_OUTPUT-MATNR.
        IF SY-SUBRC = 0.
          W_OUTPUT-BISMT = W_MARA-BISMT.
        ENDIF.
        CLEAR W_MAKT.
        READ TABLE T_MAKT INTO W_MAKT WITH KEY MATNR = W_OUTPUT-MATNR .
        IF SY-SUBRC = 0.
          W_OUTPUT-MAKTX = W_MAKT-MAKTX.
        ENDIF.
        CLEAR W_T156T.
        READ TABLE T_T156T INTO W_T156T WITH KEY  BWART = W_OUTPUT-BWART  .
        IF SY-SUBRC = 0.
          W_OUTPUT-BTEXT = W_T156T-BTEXT.
        ENDIF.
        CLEAR W_T001W.
        READ TABLE T_T001W INTO W_T001W WITH KEY WERKS = W_MKPF_MSEG-WERKS.
        IF SY-SUBRC = 0.
          W_OUTPUT-NAME1 = W_T001W-NAME1.
        ENDIF.
        CLEAR W_SER03.
        READ TABLE T_SER03 INTO W_SER03 WITH KEY MBLNR = W_OUTPUT-MBLNR
                                                  MJAHR = W_OUTPUT-MJAHR
                                                  ZEILE = W_OUTPUT-ZEILE.
        IF SY-SUBRC = 0.
          W_OUTPUT-OBKNR = W_SER03-OBKNR.
        ENDIF.
        CLEAR W_OBJK.
        READ TABLE T_OBJK INTO W_OBJK WITH KEY OBKNR = W_OUTPUT-OBKNR.
        IF SY-SUBRC = 0.
        W_OUTPUT-SERNR = W_OBJK-SERNR .
        ENDIF.
        APPEND W_OUTPUT TO T_OUTPUT.
        CLEAR W_OUTPUT.
        ENDLOOP.
        PERFORM SUB_DISPLAY.
    ENDFORM.
    *&      Form  SUB_DISPLAY
    HIERARICAL DISPLAY
    FORM SUB_DISPLAY .
    SORT T_OUTPUT BY MATNR BISMT MAKTX WERKS NAME1 LGORT BWART MBLNR CHARG SERNR ZEILE BUDAT ERFMG ERFME BTEXT.
    CLEAR W_OUTPUT.
    LOOP AT T_OUTPUT INTO W_OUTPUT.
    AT NEW NAME1.
    WRITE:/ W_OUTPUT-MATNR,
            W_OUTPUT-BISMT,
            W_OUTPUT-MAKTX,
            W_OUTPUT-WERKS,
            W_OUTPUT-NAME1.
    ENDAT.
    AT NEW BTEXT.
    WRITE:/ W_OUTPUT-LGORT,
            W_OUTPUT-BWART,
            W_OUTPUT-MBLNR,
            W_OUTPUT-CHARG,
            W_OUTPUT-SERNR,
            W_OUTPUT-ZEILE,
            W_OUTPUT-BUDAT,
            W_OUTPUT-ERFMG,
            W_OUTPUT-ERFME,
            W_OUTPUT-BTEXT.
    ENDAT.
    CLEAR W_OUTPUT.
    ENDLOOP.
    REFRESH T_OUTPUT.
    ENDFORM.                    " SUB_DISPLAY

  • Need help with many devices and one itunes account!!

    I recently purchased each of my kids an Ipod Touch.  They all three are now using my Itunes account which has become a little bit of a problem.  The biggest issue now is with iMessage.  When a friend send a text message or tries to Facetime one of the kids, we all get the message.  They are all using my itunes account user name and password, for apps, music, etc....
    What's the best way to seperate the three devices so they aren't all getting the same text messages?  Also, is it best to set up their own user accounts to sync their ipods with itunes? 
    Any help would be appreciated.

    If you want to use only one AppleID account for multiple devices but seperate imessage, you will have to use different email address to differentiate the device.
    I would assume all your devices' imessage are setup under your AppleID email address.
    First go to your kid Device's SETTINGS/MESSAGE/RECEIVE AT, Add another email address, type in email address of your kid(you will be asked to enter your Appleid password).  Once done, an email from Apple will be sent to this new email address to verify.  When your kid receive this email, click "Verify Now" link. The new email address now is ready for imessage.
    Now go back to the same Device SETTINGS/MESSAGE/RECEIVE AT, go into your original email(your AppleID email) and tap "remove this email".  This will prevent your own imessage to appear on this device.
    Do the same for all other devices for other kids.
    You don't need to change anything for your own device.
    That mean everyone will have an indepedent imessage based on their own email address.
    Hope this explains.

  • Need help with haivng more than one Ipod.....

    Ok, I have gone through these posts and am still having trouble. I already had my daughters shuffle on our computer from last year. My husband and I both got Ipods for Christmas this year. I registered mine under a different email and created a new account for mine so it would be different than my daughters. As soon as I plug mine into the computer, it loads ALL of her songs onto mine. I had to restore my Ipod to delete all the songs but if I plug it in again, it will start to load all of her songs onto mine again. What am I doing wrong? I purchased one song to test it and it adds it to her list. I have seen the posts on here about making the seperate playlists but I have no clue what I am doing. All I know is that as soon as I plug mine back in, I am getting all her songs. What steps do I need to take to fix this. Please help!! With 3 Ipods, What is the best way for me to set this up. Anyone that can help please feel free to also email me directly, I am deseperate. Thanks!
    HP   Windows XP  

    I have just posted a similiar question - my son got an iPod for Christmas and I can't make a seperate account either. Here is a link that someone sent me...maybe it will help you.
    The only thing that will help me is someone else coming over and doing this for me because I'm going out of my mind trying to fix it! Good luck.
    http://docs.info.apple.com/article.html?artnum=61148

  • I need help with something could some one help me with installing windows 7 on bootcamp 4.0 with iMac 2.8 ghz model

    could some one help me with something important i have a 2.8 ghz intel quad core Imac with 10.7 with bootcamp 4.0 but still getting that black screen while trying finish the install of windows 7 etc. or do i need a new mac for it to work properly

    This might help point you in the right direction.
    http://support.apple.com/kb/HT4818
    Hope it helps
    Also google it and lots of results come up including youtube clips....

  • Need help with disabling fields or hiding rows based on previous field

    Hi,
    I have a report in a region.
    The report has five columns:
    Animal type_ Health Issues* Angel Grant Requested?* Granted?* Grant Response Date*
    Dog Fleas Yes Yes 02/04/2009
    Cat Fleas No
    The first time the screen is displayed only the Animal type_ Health Issues* Angel Grant Requested?* columns will appear.
    The user will make a selection for 'Angel Grant Requested' from the LOV ('YES', 'NO') and then click on the 'Submit' button.
    When the screen returns 'Angel Grant Requested?' will be grayed out so the user cannot change the selection. The user will make a selection for 'Granted?' using LOV ('YES, 'NO') and for 'Grant Response Date' using the calendar.
    {color:#ff0000}{color:#0000ff}Here is what I want to do...
    If the user selects 'NO' for 'Angel Grant Requested?' then I would like to do one of the following (which ever one is easiest to do) when the screen returns:
    1. Disable (gray out) the 'Granted?' and 'Grant Response Date' fields on the screen for the rows that have 'NO' for 'Angel Grant Requested?'
    so that the user cannot make any selection, AND update the HEALTH_ISSUES table to
    set grant_granted = 'N/A'
    grant_response_date = sysdate
    WHERE animal_issue_type_id = AI_ID;
    2. Do not display the rows that have 'NO' for 'Angel Grant Requested?'
    {color}
    Can you please provide code samples to do this?
    {color:#ff0000}*I tried to use javascript to gray out the columns, the problem I have is with the hidden f02 column (Angel Grant Requested) that I created on the report so that javascript could read the value. columns are being disabled as desired but the database table is not updating properly...*
    {color:#ff0000}*For the rows where the user selected 'YES' for 'Angel Grant Requested?' we need to update the table with the 'Granted?' and 'Grant Response Date' values. These values are somehow being put on the row where the user selected 'NO' for 'Angel Grant Requested?'.*
    This happens in the UPDATE_ISSUES PL/SQL after When :P6_DSP_REQUESTED = 'DSPGRANTED'{color}
    Below is the Javascript function that is in HTML HEADER:_
    &lt;/script&gt;
    &lt;script language="JavaScript1.1" type="text/javascript"&gt;
    function checkAngelGrant()
    var col2=document.forms[0].f02; /* angel grant requested */
    var col3=document.forms[0].f03; /* angel grant granted */
    var col4=document.forms[0].f04; /* grant response date */
    for (i=0;i&lt;col2.length;i++)
    var col2Check = col2+.value; /* read the hidden angel grant requested field */+
    +/* checks the hidden angel grant requested field+
    if no then we need to disable the angel grant granted field and the angel response date field.
    if (col2Check == 'NO')
    +{+
    col3.disabled=true; /* angel grant granted (Yes No) */
    col4.disabled=true; /* angel response date
    Below is the UPDATEISSUES PL/SQL process that is run on After Submit:_*
    DECLARE
    ai_id NUMBER;
    vgrant_requested VARCHAR2(3);
    vgrant_grnted VARCHAR2(3);
    vgrant_respdate DATE;
    f01 = Animal Issue Type ID
    f02 = grant requested ('YES','NO')
    F03 = grant granted ('YES','NO')
    F04 = grant response date
    P6_DSP_REQUESTED = DSPGRANTED display region with grant_granted and grant_respdate
    P6_DSP_REQUESTED = DSPREQUESTED display region with grant_requested only
    P6_DSP_REQUESTED = BIFNOCHG cannot change any of the fields that have already been set
    BEGIN
    IF :P6_DSP_BEQUESTED = 'DSPREQUESTED' then -- Allow setting of grant_requested value only
    FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
    ai_id := HTMLDB_APPLICATION.G_F01(i); -- animal_issue_type_id This is hidden
    vgrant_requested := HTMLDB_APPLICATION.G_F02(i); -- grant_requested (YES or NO)
    UPDATE HEALTH_ISSUE_TYPES
    SET grant_requested = vgrant_requested
    WHERE animal_issue_type_id = AI_ID;
    COMMIT;
    END LOOP;
    elsif :P6_DSP_REQUESTED = 'DSPGRANTED' then -- grant_granted and grant_response_date
    FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
    ai_id := HTMLDB_APPLICATION.G_F01(i); -- animal_issue_type_id This is hidden
    vgrant_grnted := HTMLDB_APPLICATION.G_F02(i); -- grant_granted (YES or NO)
    vgrant_respdate := to_date(HTMLDB_APPLICATION.G_F03(i),'MM/DD/YYYY');
    UPDATE HEALTH_ISSUE_TYPES
    SET grant_granted = vgrant_grnted,
    grant_response_date = vgrant_respdate
    WHERE animal_issue_type_id = AI_ID;
    COMMIT;
    END LOOP;
    end if;
    END;

    It's actually three reports that get run during different stages of the screen.
    When the user first enters the screen the data is populated from the REQUESTED REPORT sql:
    SELECT hit.animal_issue_type_id, at.animal_type_desc, it.issue_type_desc, hit.grant_requested
    FROM health_issue_types hit, animal_types at,issue_types it
    WHERE hit.animal_type_id = at.animal_type_id
    AND hit.issue_type_id = it.issue_type_id
    AND hit.file_no = :P6_FILE_NO;
    The user will make a selection from the LOV select list (Yes, No) for the grant_requested field and then click on the Submit button.
    {color:#ff0000}*If the user selects 'NO' for this field then I want to disable the grant_granted and grant_response_date fields when the screen is populated from the ISSUES REPORT sql. If this cannot be easily done then I would like to hide the entire row when 'NO' has been selected for the grant_requested field.*{color}
    When the screen returns the data is populated from the ISSUES REPORT sql:
    ISSUES REPORT
    SELECT hit.animal_issue_type_id, at.animal_type_desc, it.issue_type_desc, hit.grant_requested,
    hit.grant_granted, hit.grant_response_date
    FROM health_issue_types hit, animal_types at,issue_types it
    WHERE hit.animal_type_id = at.animal_type_id
    AND hit.issue_type_id = it.issue_type_id
    AND hit.file_no = :P6_FILE_NO;
    At this point the grant_requested field will no longer be available for user modification. The user will make a selection from the LOV select list (Yes, No) for the grant_granted, and the grant_response_date fields and then click on the Submit button again.
    When the screen returns the data is populated from the ANIMAL DISPLAY ONLY REPORT sql:
    ANIMAL DISPLAY ONLY REPORT
    SELECT hit.animal_issue_type_id, at.animal_type_desc, it.issue_type_desc, hit.grant_requested,
    hit.grant_granted, hit.grant_response_date
    FROM health_issue_types hit, animal_types at, issue_types it
    WHERE hit.animal_type_id = at.animal_type_id
    AND hit.issue_type_id = it.issue_type_id
    AND hit.file_no = :P6_FILE_NO;
    At this point the grant_requested, grant_granted, and grant_response_date fields will no longer be available for user modification.
    {color:#0000ff}Thank you for taking the time to look at my problem.{color}

  • Urgent... need help in alv.

    hai all,
    in an alv report i want a pushbutton in the application tool bar .
    how can i get it.
    and also i want to select multiple rows from the list and the first column as a button to select the rows.
    please.. help me. its very urgent.
    thanks in advance.
    regards, selvi.

    Hi,
    Following steps to copy standard status to zstatus
    Goto T.Code  SE41 & give program name SAPLSLVC then select
    status as STANDARD then copy this status to zstatus in your program
    open zstatus in T.Code SE41 and  add push button and  save & activate it.
    then Call FM  PF_STATUS.
    see below,
    I_CALLBACK_PF_STATUS_SET- 'PF_STATUS'
    In module PF_STATUS
    set pf-status 'ZSTATUS'
    reward if useful.

  • Need help with ALV Grid

    Hi,
    I am displaying Header and Item details in an ALV Grid. The first row will be having Header info and the next rows contains Item Details. I want to hide some of the columns of the first record only. The titles and the Item Details should remain same.
    Can any body help me.
    Regards,
    Srinivas

    Hello,
    That cannot be done as you are displaying the header and item level data together. Let the fields you do not want to display be blank while you display.
    Hope it helps.
    Thanks,
    Jayant

Maybe you are looking for