Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Interactive ALV Heirarchial report!!!

Hi all,

In the below program the user command is not working as an error saying 'type conflict with actual and formal parameters' is getting occured.

&----


*& Report ZALV_HIERARCHIAL_REPORT *

*& *

&----


*& *

*& *

&----


REPORT ZALV_HIERARCHIAL_REPORT .

*----


TABLES

TABLES : VBAK.

*----


TYPE POOLS

TYPE-POOLS : SLIS.

*----


STRUCTURES

TYPES : BEGIN OF TY_HEADER,

KUNNR TYPE VBAK-KUNNR,

VBELN TYPE VBAK-VBELN,

ERDAT TYPE VBAK-ERDAT,

ERNAM TYPE VBAK-ERNAM,

NETWR TYPE VBAK-NETWR,

WAERK TYPE VBAK-WAERK,

END OF TY_HEADER.

TYPES : BEGIN OF TY_ITEM,

VBELN TYPE VBAP-VBELN,

POSNR TYPE VBAP-POSNR,

MATNR TYPE VBAP-MATNR,

KWMENG TYPE VBAP-KWMENG,

ARKTX TYPE VBAP-ARKTX,

END OF TY_ITEM.

*----


INTERNAL TABLES

DATA : IT_HEADER TYPE STANDARD TABLE OF TY_HEADER WITH HEADER LINE,

IT_ITEM TYPE STANDARD TABLE OF TY_ITEM WITH HEADER LINE.

DATA : IT_FCAT TYPE slis_t_fieldcat_alv,

W_FCAT TYPE SLIS_FIELDCAT_ALV.

DATA : IT_EVENTS TYPE SLIS_T_EVENT,

W_EVENTS TYPE SLIS_ALV_EVENT.

DATA : IT_LISTHEADER TYPE slis_t_listheader.

data : repid type sy-repid.

DATA : COL TYPE I.

DATA : KEYINFO TYPE SLIS_KEYINFO_ALV .

data : form_name type slis_formname.

DATA : G_TABNAME_HEADER TYPE SLIS_TABNAME,

G_TABNAME_ITEM TYPE SLIS_TABNAME.

*----


CONSTANTS

CONSTANTS:

GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

DATA : G_REPID TYPE SY-REPID.

SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.

*----


INITIALIZATION

INITIALIZATION.

G_REPID = SY-REPID.

G_TABNAME_HEADER = 'IT_HEADER'.

G_TABNAME_ITEM = 'IT_ITEM'.

  • CLEAR W_EVENTS.

  • W_EVENTS-NAME = 'USER_COMMAND'.

  • W_EVENTS-FORM = 'USERCOMMAND'.

  • APPEND W_EVENTS TO IT_EVENTS.

*----


FIELD CATALOG

PERFORM BUILD_CATALOG.

*----


BUILD EVENTS TABLE

PERFORM BUILD_EVENTS USING IT_EVENTS[].

*----


TOP OF THE PAGE

PERFORM COOMENT_BUILD USING IT_LISTHEADER[].

*----


START-OF-SELECTION

START-OF-SELECTION.

*----


FETCH DATA INTO INTERNAL TABLES

PERFORM FETCH_DATA.

*----


BUILDING KEY BETWEEN TABLES

PERFORM BUILD_KEY.

*----


END OF SELECTION

end-of-selection.

*----


DISPLAY DATA

PERFORM DISPLAY_DATA.

*&----


**& Form USER_COMMAND

*&----


    • text

*----


    • -->RS_SELFIELDtext

    • -->R_UCOMM text

*----


*FORM USER_COMMAND USING RS_SELFIELD TYPE SLIS_SELFIELD

  • R_UCOMM TYPE SY-UCOMM.

*

**READ TABLE IT_header with key = rs_selfield-value.

*

  • SET PARAMETER ID 'AUN' FIELD rs_selfield-value.

  • call transaction 'VA03' and skip first screen.

*

*endform. "USER_COMMAND

*ADD 1 TO COL.

FORM BUILD_CATALOG.

W_FCAT-COL_POS = 1.

W_FCAT-FIELDNAME = 'VBELN'.

W_FCAT-SELTEXT_L = 'ORDER_NO'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_HEADER'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

*ADD 1 TO COL.

W_FCAT-COL_POS = 2.

W_FCAT-FIELDNAME = 'ERDAT'.

W_FCAT-SELTEXT_L = 'ORDER_DATE'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_HEADER'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

*ADD 1 TO COL.

W_FCAT-COL_POS = 3.

W_FCAT-FIELDNAME = 'ERNAM'.

W_FCAT-SELTEXT_L = 'CREATED_BY'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_HEADER'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

*ADD 1 TO COL.

W_FCAT-COL_POS = 4.

W_FCAT-FIELDNAME = 'NETWR'.

W_FCAT-SELTEXT_L = 'ORDER_VALUE'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_HEADER'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

*ADD 1 TO COL.

W_FCAT-COL_POS = 5.

W_FCAT-FIELDNAME = 'WAERK'.

W_FCAT-SELTEXT_L = 'ORDER_CURRENCY'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_HEADER'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

W_FCAT-COL_POS = 6.

W_FCAT-FIELDNAME = 'POSNR'.

W_FCAT-SELTEXT_L = 'ITEM_NO'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_ITEM'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

W_FCAT-COL_POS = 7.

W_FCAT-FIELDNAME = 'MATNR'.

W_FCAT-SELTEXT_L = 'MATERIAL_NO'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_ITEM'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

W_FCAT-COL_POS = 8.

W_FCAT-FIELDNAME = 'KWMENG'.

W_FCAT-SELTEXT_L = 'ORDER_QUANTITY'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_ITEM'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

W_FCAT-COL_POS = 9.

W_FCAT-FIELDNAME = 'ARKTX'.

W_FCAT-SELTEXT_L = 'ITEM_DESCRIPTION'.

W_FCAT-ref_tabname = VBAK.

W_FCAT-TABNAME = 'IT_ITEM'.

APPEND W_FCAT TO IT_FCAT.

CLEAR W_FCAT.

*

ENDFORM. "BUILD_CATALOG

&----


*& Form FETCH_DATA

&----


  • text

----


FORM FETCH_DATA.

SELECT VBELN ERDAT ERNAM NETWR WAERK FROM VBAK INTO CORRESPONDING FIELDS

OF TABLE IT_HEADER WHERE VBELN IN S_VBELN.

IF IT_HEADER[] IS NOT INITIAL.

SELECT VBELN POSNR MATNR KWMENG ARKTX FROM VBAP INTO CORRESPONDING

FIELDS OF TABLE IT_ITEM FOR ALL ENTRIES IN IT_HEADER WHERE VBELN EQ

IT_HEADER-VBELN.

ENDIF.

ENDFORM. "FETCH_DATA

&----


*& Form BUILD_KEY

&----


  • text

----


FORM BUILD_KEY.

CLEAR KEYINFO.

KEYINFO-HEADER01 = 'VBELN'.

KEYINFO-ITEM01 = 'VBELN'.

ENDFORM. "BUILD_KEY

&----


*& Form DISPLAY_DATA

&----


  • text

----


FORM DISPLAY_DATA.

form_name = 'SUB_USER_COMMAND'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_CALLBACK_PROGRAM = G_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = FORM_NAME

  • IS_LAYOUT =

IT_FIELDCAT = it_fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = IT_EVENTS[]

  • IT_EVENT_EXIT =

I_TABNAME_HEADER = G_TABNAME_HEADER

I_TABNAME_ITEM = G_TABNAME_ITEM

  • I_STRUCTURE_NAME_HEADER =

  • I_STRUCTURE_NAME_ITEM =

IS_KEYINFO = KEYINFO

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB_HEADER = IT_HEADER[]

T_OUTTAB_ITEM = IT_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. "DISPLAY_DATA

&----


*& Form BUILD_EVENTS

&----


  • text

----


  • -->P_IT_EVENTS[] text

----


FORM BUILD_EVENTS USING P_IT_EVENTS TYPE SLIS_T_EVENT.

DATA : W_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = P_IT_EVENTS

  • 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.

*----


TOP OF PAGE

READ TABLE P_IT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

INTO W_EVENT.

IF SY-SUBRC = 0.

MOVE GC_FORMNAME_TOP_OF_PAGE TO W_EVENT-FORM.

APPEND W_EVENT TO P_IT_EVENTS.

ENDIF.

**----


USER COMMAND

CLEAR W_EVENT.

  • READ TABLE P_IT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND

  • INTO W_EVENT.

*

  • IF SY-SUBRC = 0.

  • MOVE GC_FORMNAME_USER_COMMAND TO W_EVENT-FORM.

  • APPEND W_EVENT TO P_IT_EVENTS.

  • ENDIF.

  • W_EVENT-FORM = 'SUB_USER_COMMAND'.

  • MODIFY IT_EVENTS FROM W_EVENT TRANSPORTING FORM WHERE NAME =

  • 'USER_COMMAND'.

ENDFORM. " BUILD_EVENTS

&----


*& Form COOMENT_BUILD

&----


  • text

----


  • -->P_IT_LISTHEADER[] text

----


FORM COOMENT_BUILD USING P_IT_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA: LS_LINE TYPE SLIS_LISTHEADER.

CLEAR LS_LINE.

LS_LINE-TYP = 'H'.

  • LS_LINE-KEY: not used for this type

LS_LINE-INFO = 'LIST OF SALES ORDERS AND ITEMS'.

APPEND LS_LINE TO P_IT_LISTHEADER.

ENDFORM. " COOMENT_BUILD

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEADER

  • I_LOGO =

  • I_END_OF_LIST_GRID =

.

ENDFORM. "TOP_OF_PAGE

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->RS_SELFIELDtext

  • -->R_UCOMM text

----


FORM SUB_USER_COMMAND USING RS_SELFIELD TYPE SLIS_SELFIELD

R_UCOMM TYPE SY-UCOMM.

CASE R_UCOMM.

WHEN '&IC1'.

READ TABLE IT_HEADER INDEX RS_SELFIELD-TABINDEX .

IF SY-SUBRC = 0.

SET PARAMETER ID 'AUN' field IT_HEADER-VBELN.

call transaction 'VA03' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM. "USER_COMMAND

Thanks & Regards

Jerry

Tags:
Former Member
Former Member replied

Hello Jerry

First of all I would recommend to use the pretty printing function (brackets button above textedit control) of your coding in the SDN thread.

The problem and its solution are quite simple:

SAP include LKKBLF90 where the sub-routine in your z-report is called (lines 790ff):

...
*   callback
    if rs_stack-i_callback_user_command ne space and l_subrc ne 0.
      stop_here con_bp-euc.
      if rs_stack-i_callback_user_command eq 'SALV_USER_COMMAND'.
        perform (rs_stack-i_callback_user_command)
          in program (rs_stack-i_callback_program) using  l_ucomm_old
                                                          lflg_refresh
                                                          ls_selfield
                                                          if found.
      else.
        " This external call causes the dump.
        perform (rs_stack-i_callback_user_command)
          in program (rs_stack-i_callback_program) using  l_ucomm_old
                                                          ls_selfield
                                                          if found.
      endif.
...

Erroneous coding of sub-routine in your z-report:

FORM SUB_USER_COMMAND USING RS_SELFIELD TYPE SLIS_SELFIELD
R_UCOMM TYPE SY-UCOMM.  " order of formal parameters is wrong

Simply change it to:
FORM sub_user_command
                  USING  r_ucomm TYPE sy-ucomm
                         rs_selfield TYPE slis_selfield.
...

Regards

Uwe

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question