Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

example/help for CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' editable

Former Member
0 Likes
1,913

hello experts,

are there any example using function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' with editable columns.

Or, have somebody an idea to resolve my problem.

I can edit the fields in the alv-grid, but I don't see the changes in the internal table using 'LVC_TRANSFER_FROM_SLIS' function.

thanks and regards.

K. WErner

.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,763

You need to trigger an input event in order to refresh the internal table data with the newly updated fields when you are using the hierarchical list (eg. a button).

In order to do this, first make sure you pass to the FM the parameters for i_callback_program (sy-repid) and i_callback_user_command (name of the subroutine to be called)

eg. if the name of my routine for the user command was 'MY_USER_COMMAND' and my update was triggered by the function code 'UPDATE', I could have routine similar to the following.


FORM my_user_command  USING pv_ucomm LIKE sy-ucomm
                                                    ps_selfield TYPE slis_selfield.

  case pv_ucomm.
     when 'UPDATE'.
        ps_selfield-refresh = 'X'.  " update alv
  endcase.
ENDFORM.

11 REPLIES 11
Read only

SantoshKallem
Active Contributor
0 Likes
1,763

check the sample programs in SLIS Package

Cheers.

santhosh reddy

Read only

Former Member
0 Likes
1,763

Hello,

there is no exampte in package slis, which handle

editable REUSE_ALV_HIERSEQ_LIST_DISPLAY function.

regards,

K. Werner

Read only

Former Member
0 Likes
1,764

You need to trigger an input event in order to refresh the internal table data with the newly updated fields when you are using the hierarchical list (eg. a button).

In order to do this, first make sure you pass to the FM the parameters for i_callback_program (sy-repid) and i_callback_user_command (name of the subroutine to be called)

eg. if the name of my routine for the user command was 'MY_USER_COMMAND' and my update was triggered by the function code 'UPDATE', I could have routine similar to the following.


FORM my_user_command  USING pv_ucomm LIKE sy-ucomm
                                                    ps_selfield TYPE slis_selfield.

  case pv_ucomm.
     when 'UPDATE'.
        ps_selfield-refresh = 'X'.  " update alv
  endcase.
ENDFORM.

Read only

Former Member
0 Likes
1,763

Hello,

i have a fm.

FORM USER_COMMAND

USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

MOVE SY-XCODE TO OK_CODE. "<==break-point

CASE OK_CODE.

WHEN '&UMB'.

CALL FUNCTION 'REUSE_ALV_HS_TABLES_GET'

TABLES

ET_OUTTAB_MASTER = IT_UMBNR

ET_OUTTAB_DETAIL = IT_UMPOS

EXCEPTIONS

NO_INFOS = 1

OTHERS = 2.

CLEAR F_FEHLER.

  • WHEN '&UMB' runs correctly

.....

if i edit the field and then push enter, nothing happens.

Do I need an ICON in the pf-status therefor?

Read only

0 Likes
1,763

Hi Kim,

Yes, you can use a button in the pf-status to trigger the function code. I haven't found a way to use the enter event in a hier alv (it does work in regular ALV). I don't believe it is possible simply because there is no event to hook on to once the cursor is in the editable field.

Read only

0 Likes
1,763

Hi Werner,

Its simple. after entering on edited fields, just press ENTER then automatically all table which are being displayed are updated.

Double click on output and see the below one.

FORM my_user_command USING pv_ucomm LIKE sy-ucomm

ps_selfield TYPE slis_selfield.

case pv_ucomm.

when '&IC1'.

ps_selfield-refresh = 'X'. " update alv

endcase.

ENDFORM.

put break point on CASE Statement and check those tables.

I Can see changed values in the tables.

Thanks,

Venkat.O

Read only

Former Member
0 Likes
1,763

Hello,

when I edit the field and make a doubleklick, the programm passes the FORM USER_COMMAND. I only can see the edit value in RS_SELFIELD-VALUE, when I doubleclick the edit field. In the internal table isn't a change.

After RS_SELFIELD-REFRESH = 'X'. the edit field is initial.

See example BCALV_EDIT_03. The changes keep.

regards

K. Werner

Read only

Former Member
1,763

hi,

here is the code for editable Hieararchical ALV


TYPE-POOLS : slis.

TABLES : mseg.

DATA : BEGIN OF itab_head OCCURS 0,
        mat LIKE mseg-matnr,
*        matnr LIKE mseg-matnr,
        werks LIKE mseg-werks,
       END OF itab_head.

DATA : BEGIN OF itab_item OCCURS 0,
*        mat LIKE mseg-matnr,
        matnr LIKE mseg-matnr,
        werks LIKE mseg-werks,
        mblnr LIKE mseg-mblnr,
        menge LIKE mseg-menge,
       END OF itab_item.

DATA : t_fcat TYPE slis_t_fieldcat_alv,
       key_info TYPE slis_keyinfo_alv,
       t_eve TYPE slis_t_event,
       gt_subtot TYPE slis_t_sortinfo_alv,
       subtot LIKE LINE OF gt_subtot,
       t_listhead TYPE slis_t_listheader,
       st_line TYPE slis_listheader.

DATA : lin_no TYPE i.

DATA : t_mtdoc LIKE mseg-mblnr.

SELECT-OPTIONS : mat FOR mseg-matnr.

INITIALIZATION.
  PERFORM build_cat USING t_fcat.
  PERFORM build_eve.

START-OF-SELECTION.
  PERFORM get_data.
  PERFORM dis_data.


*&---------------------------------------------------------------------*
*&      Form  build_cat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->TEMP_FCAT  text
*----------------------------------------------------------------------*
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.

  DATA : wa_fcat TYPE slis_fieldcat_alv.

  wa_fcat-tabname = 'ITAB_HEAD'.
  wa_fcat-fieldname = 'MAT'.
  wa_fcat-seltext_m = 'Material'.
  APPEND wa_fcat TO temp_fcat.
  CLEAR wa_fcat.

  wa_fcat-tabname = 'ITAB_HEAD'.
  wa_fcat-fieldname = 'WERKS'.
  wa_fcat-seltext_m = 'Plant'.
  wa_fcat-edit = 'X'.
  wa_fcat-input = 'X'.
  APPEND wa_fcat TO temp_fcat.
  CLEAR wa_fcat.

  wa_fcat-tabname = 'ITAB_ITEM'.
  wa_fcat-fieldname = 'MBLNR'.
  wa_fcat-seltext_m = 'Material Doc.'.
  APPEND wa_fcat TO temp_fcat.
  CLEAR wa_fcat.

  wa_fcat-tabname = 'ITAB_ITEM'.
  wa_fcat-fieldname = 'MENGE'.
  wa_fcat-seltext_m = 'Quantity'.
  wa_fcat-edit = 'X'.
  wa_fcat-input = 'X'.
  wa_fcat-do_sum = 'Y'.
  APPEND wa_fcat TO temp_fcat.
  CLEAR wa_fcat.

  subtot-spos = 1.
  subtot-fieldname = 'MAT'.
  subtot-tabname = 'ITAB_HEAD'.
  subtot-up = 'X'.
  subtot-group = 'X'.
  subtot-subtot = 'X'.
  subtot-expa = 'X'.
  APPEND subtot TO gt_subtot.

ENDFORM.                    "build_cat

*&---------------------------------------------------------------------*
*&      Form  build_eve
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM build_eve.

  DATA : wa_eve TYPE slis_alv_event.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
   EXPORTING
     i_list_type           = 0
   IMPORTING
     et_events             = t_eve
*   EXCEPTIONS
*     LIST_TYPE_WRONG       = 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.

  READ TABLE t_eve INTO wa_eve WITH KEY name = 'TOP_OF_PAGE'.
  IF sy-subrc = 0.
    wa_eve-form = 'TOP_OF_PAGE'.
    MODIFY t_eve FROM wa_eve INDEX sy-tabix.
  ENDIF.


ENDFORM.                    "build_eve
*&---------------------------------------------------------------------*
*&      Form  get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_data.

  SELECT matnr werks mblnr menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab_item
  WHERE matnr IN mat.

ENDFORM.                    "get_data

*&---------------------------------------------------------------------*
*&      Form  dis_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM dis_data.

  key_info-header01 = 'MAT'.
  key_info-item01 = 'MATNR'.
  key_info-header02 = 'WERKS'.
  key_info-item02 = 'WERKS'.

  REFRESH itab_head.
  LOOP AT itab_item.
    ON CHANGE OF itab_item-matnr OR itab_item-werks.
      MOVE-CORRESPONDING itab_item TO itab_head.
      itab_head-mat = itab_item-matnr.
      APPEND itab_head.
    ENDON.
  ENDLOOP.

  CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
      i_callback_program             = 'ZALV_PRDS'
      it_fieldcat                    = t_fcat
      it_sort                        = gt_subtot
      it_events                      = t_eve[]
      i_tabname_header               = 'ITAB_HEAD'
      i_tabname_item                 = 'ITAB_ITEM'
      is_keyinfo                     = key_info
    TABLES
      t_outtab_header                = itab_head
      t_outtab_item                  = itab_item
* 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.                    "dis_data


*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top_of_page.

  CLEAR st_line.
  st_line-typ = 'H'.
  st_line-info = 'Dhwani Shah'.
  APPEND st_line TO t_listhead.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       = t_listhead
*   I_LOGO                   =
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .


ENDFORM.                    "top_of_page

reward if usefull.....

Read only

Former Member
0 Likes
1,763

Hello Dhwani shah,

it is nearly the same program. I do not edit the event table

(see below) and I use the user_command form.

I don't change anything in the program, but now it runs correctly - don't know why ?!?.


 READ TABLE t_eve INTO wa_eve WITH KEY name = 'TOP_OF_PAGE'.
  IF sy-subrc = 0.
    wa_eve-form = 'TOP_OF_PAGE'.
    MODIFY t_eve FROM wa_eve INDEX sy-tabix.
  ENDIF.

Thanks

K. Werner

Read only

Former Member
0 Likes
1,763

Hello,

fyi

it's a problem of the field type.

data: booking_date like sy-datum ==> malfunction

data: booking_date(10) type c ==> function.

regards.

K. Werner

Read only

0 Likes
1,763

hi,

what u want i cant understand....