Monday, April 18, 2011

ABAP ALV Hirarchical Report Sample Code in sap Programming

ABAP programming report for alv hierarchical report in sample code gives you a real time report that tells you in detail with example coding how to write the abap programming report.

&---------------------------------------------------------------------
*& Report Z_HIERARCHIAL_ALV *
*& *
&---------------------------------------------------------------------
*& *
*& *
&---------------------------------------------------------------------

REPORT ZGDEMO_HIERARCHIAL_ALV_9AM .
TYPE-POOLS SLIS.
DATA : IT_EKKO TYPE TABLE OF EKKO,
IT_EKPO TYPE TABLE OF EKPO.

DATA WA_KEYINFO TYPE SLIS_KEYINFO_ALV.

****************************************
  • START-OF-SELECTION. *
****************************************
START-OF-SELECTION.
PERFORM READ_DATA.

PERFORM FILL_KEYINFO.

PERFORM DISPLAY_DATA.

&---------------------------------------------------------------------
*& Form READ_DATA
&---------------------------------------------------------------------
form READ_DATA .

SELECT * INTO TABLE IT_EKKO FROM EKKO UP TO 20 ROWS.

IF NOT IT_EKKO IS INITIAL.
SELECT * INTO TABLE IT_EKPO FROM EKPO
FOR ALL ENTRIES
IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
ENDIF.

endform. " READ_DATA

&---------------------------------------------------------------------
*& Form FILL_KEYINFO
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
form FILL_KEYINFO .
WA_KEYINFO-HEADER01 = 'EBELN'.
WA_KEYINFO-ITEM01 = 'EBELN'.
WA_KEYINFO-ITEM02 = 'EBELP'.

endform. " FILL_KEYINFO
&---------------------------------------------------------------------
*& Form DISPLAY_DATA
&---------------------------------------------------------------------

  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- p2 text
----------------------------------------------------------------------
form DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
  • I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-REPID
  • I_CALLBACK_PF_STATUS_SET = ' '
  • I_CALLBACK_USER_COMMAND = ' '
  • IS_LAYOUT =
  • IT_FIELDCAT =
  • 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_EVENT_EXIT =
i_tabname_header = 'IT_EKKO'
i_tabname_item = 'IT_EKPO'
I_STRUCTURE_NAME_HEADER = 'EKKO'
I_STRUCTURE_NAME_ITEM = 'EKPO'
is_keyinfo = WA_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_EKKO
t_outtab_item = IT_EKPO
  • 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

No comments:

Post a Comment