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: 

Heirarchical editable ALV is possible?

Former Member
0 Kudos
1,812

Is hierarchical editable ALV possible.

Any sample code?

Not ALV grid.Hierarchical ALV.

Please let me know

10 REPLIES 10

Former Member
0 Kudos
1,297

Hiii,

Edit the Hierarchical ALV Report is not Possible.

Regards

Ajit

gouravkumar64
Active Contributor
0 Kudos
1,297

HI,

It is possible ,

Search in SE38 with BCALV* , u will get some programs..

Thanks

Gourav.

0 Kudos
1,297

I could see many grid editable option..nothing for hierarchial.ie y came up with this query in SDN

0 Kudos
1,297

Hi,

Try through OOPS-ALV.

Search u will get example.

"editable-alv-through-oops"

Gourav.

Former Member
0 Kudos
1,297

why u need to use..hierarichal alv.? that too  editable.

former_member189849
Contributor
0 Kudos
1,297

Hi ,

w_field TYPE slis_fieldcat_alv,

w_field-input = 'X'.

apply this code in fieldcatlog(just  try) .

Regards

Mahesh

Former Member
0 Kudos
1,297

Absolutely possible.

check this program code. i have just created similar to your requirement.

TYPE-POOLS: SLIS.

*&---------------------------------------------------------------------*

TYPES: BEGIN OF TY_VBRK,

           VBELN TYPE VBELN,

           KUNAG TYPE KUNAG,

      END OF TY_VBRK.

TYPES: BEGIN OF TY_VBRP,

           VBELN TYPE VBELN,

           MATNR TYPE MATNR,

           FKIMG TYPE FKIMG,

           NETWR TYPE NETWR,

      END OF TY_VBRP.

DATA: W_VBRK TYPE TY_VBRK.

DATA: T_VBRK TYPE STANDARD TABLE OF TY_VBRK.

DATA: W_VBRP TYPE TY_VBRP.

DATA: T_VBRP TYPE STANDARD TABLE OF TY_VBRP.

DATA: W_FCAT TYPE SLIS_FIELDCAT_ALV.

DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV.

CONSTANTS: C_VBRK TYPE SLIS_TABNAME VALUE 'W_VBRK'.

CONSTANTS: C_VBRP TYPE SLIS_TABNAME VALUE 'W_VBRP'.

*&---------------------------------------------------------------------*

DATA: W_KEYINFO TYPE SLIS_KEYINFO_ALV.

*&---------------------------------------------------------------------*

* START OF SELECTION

*&---------------------------------------------------------------------*

START-OF-SELECTION.

   PERFORM GET_DATA.

   PERFORM BUILD_FIELDCAT.

   PERFORM DISPLAY_ALV.

*&---------------------------------------------------------------------*

*&      Form  DISPLAY_ALV

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM DISPLAY_ALV .

   CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

     EXPORTING

       IT_FIELDCAT      = T_FCAT

       I_TABNAME_HEADER = C_VBRK

       I_TABNAME_ITEM   = C_VBRP

       IS_KEYINFO       = W_KEYINFO

     TABLES

       T_OUTTAB_HEADER  = T_VBRK

       T_OUTTAB_ITEM    = T_VBRP.

ENDFORM.                    " DISPLAY_ALV

*&---------------------------------------------------------------------*

*&      Form  GET_DATA

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM GET_DATA .

*&--------SELEC HEADER DATA AND SORT-------------------------------*

   REFRESH T_VBRK.

   SELECT  VBELN

           KUNAG

                 FROM VBRK

                 INTO CORRESPONDING FIELDS OF TABLE T_VBRK

                 UP TO 10 ROWS.

   SORT T_VBRK BY VBELN.

*&--------SELEC ITEM DATA AND SORT-------------------------------*

   CHECK NOT T_VBRK IS INITIAL.

   REFRESH T_VBRP.

   SELECT

           VBELN

           MATNR

           FKIMG

           NETWR

                 FROM VBRP

                 INTO CORRESPONDING FIELDS OF TABLE T_VBRP

                 FOR ALL ENTRIES IN T_VBRK

                 WHERE VBELN = T_VBRK-VBELN.

   SORT T_VBRP BY VBELN.

ENDFORM.                    " GET_DATA

*&---------------------------------------------------------------------*

*&      Form  BUILD_FIELDCAT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM BUILD_FIELDCAT .

   W_KEYINFO-HEADER01 = 'VBELN'.

   W_KEYINFO-ITEM01 = 'VBELN'.

*&---------------------------------------------------------------------*

   W_FCAT-COL_POS = 1.

   W_FCAT-FIELDNAME = 'VBELN'.

   W_FCAT-SELTEXT_M = 'ORDER NO'.

   W_FCAT-TABNAME = 'W_VBRK'.

  W_FCAT-EDIT = 'X'.

   W_FCAT-INPUT = 'X'. "must declare this statement --> will enable the field for input

   APPEND W_FCAT TO T_FCAT.

   W_FCAT-COL_POS = 2.

   W_FCAT-FIELDNAME = 'KUNAG'.

   W_FCAT-SELTEXT_M = 'CUSTOMER No'.

   W_FCAT-TABNAME = 'W_VBRK'.

   APPEND W_FCAT TO T_FCAT.

   W_FCAT-COL_POS = 3.

   W_FCAT-FIELDNAME = 'MATNR'.

   W_FCAT-SELTEXT_M = 'MATERIAL NO'.

   W_FCAT-TABNAME = 'W_VBRP'.

   APPEND W_FCAT TO T_FCAT.

   W_FCAT-COL_POS = 4.

   W_FCAT-FIELDNAME = 'FKIMG'.

   W_FCAT-SELTEXT_L = 'QUANTITY'.

   W_FCAT-TABNAME = 'W_VBRP'.

   APPEND W_FCAT TO T_FCAT.

   W_FCAT-COL_POS = 5.

   W_FCAT-FIELDNAME = 'NETWR'.

   W_FCAT-SELTEXT_M = 'ORDER VALUE'.

   W_FCAT-TABNAME = 'W_VBRP'.

   APPEND W_FCAT TO T_FCAT.

ENDFORM.                    " BUILD_FIELDCAT

here is the screenshot of the output.

field vbeln is editable.

nothing is impossible in ABAP.

Revert back if problem still not solved.

To add more in the comment:

u can also add USER_COMMAND

in the function modue -->> to pick the record entered/changed by user.

read documentation of function module for more information.

0 Kudos
1,297

Hi Abhishek,

thanks for the example above.

Based on your experience, could you please tell me if it is possible to make an explodable and editable hierarchical grid?

Thanks in advance!

Regards

Massimo

0 Kudos
1,197

yes it is working when we put input = 'X'. But how we can get the new value of updated column? 

Former Member
0 Kudos
1,297

Hello,

Please check standard ALV reports from SAP, one of them is BCALV_TREE_01. The rest you could find using BCALV* in SE38

award points if useful.

best regards,

swanand