Skip to Content
0
Former Member
Dec 20, 2006 at 06:33 AM

ALV Interactive

18 Views

Hey guys,

See this code:

TYPE-POOLS: SLIS.

TABLES: EKKO,EKPO.

select-options: P_EBELN for EKKO-EBELN no-display.

DATA: BEGIN OF IT_PURCHASE OCCURS 0,

EBELN LIKE EKKO-EBELN,

BUKRS LIKE EKKO-BUKRS,

BSART LIKE EKKO-BSART,

AEDAT LIKE EKKO-AEDAT,

CHEC(1),

END OF IT_PURCHASE.

DATA: BEGIN OF IT_ITEM OCCURS 0,

ebeln like ekpo-ebeln,

MATNR LIKE EKPO-MATNR,

TXZ01 LIKE EKPO-TXZ01,

MATKL LIKE EKPO-MATKL,

MEINS LIKE EKPO-MEINS,

WERKS LIKE EKPO-WERKS,

END OF IT_ITEM.

DATA:V_CALLBACK_UCOMM TYPE SLIS_FORMNAME.

DATA: V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

GT_LAYOUT TYPE SLIS_LAYOUT_ALV.

  • gt_sort type slis_sortinfo_alv,

  • fieldcat like line of gt_fieldcat.

DATA: V1_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

GT1_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: PGM TYPE SY-REPID.

PGM = SY-REPID.

DATA: T_HEADER TYPE SLIS_T_LISTHEADER,

WA_HEADER TYPE SLIS_LISTHEADER.

START-OF-SELECTION.

PERFORM GET_EKKO_DATA.

PERFORM ITEM_DATA.

PERFORM FILL_FIELDCATALOG.

PERFORM DISPLAY_DATA.

*

*TOP-OF-PAGE.

*PERFORM DISPLAY_LOGO.

*

*&----


*

*& Form get_ekko_data

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM GET_EKKO_DATA .

SELECT EBELN BUKRS BSART AEDAT FROM EKKO INTO TABLE

IT_PURCHASE WHERE EBELN in P_EBELN.

ENDFORM. " get_ekko_data

*&----


*

FORM ITEM_DATA .

IF NOT IT_PURCHASE[] IS INITIAL.

SELECT ebeln MATNR TXZ01 MATKL MEINS WERKS INTO TABLE IT_ITEM FROM EKPO

FOR ALL ENTRIES IN IT_PURCHASE WHERE EBELN = IT_PURCHASE-EBELN AND

BUKRS = IT_PURCHASE-BUKRS .

ENDIF.

*clear it_purchase.

ENDFORM. " item_data

&----


*& Form fill_fieldcatalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FILL_FIELDCATALOG .

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = PGM

I_INTERNAL_TABNAME = 'IT_PURCHASE'

I_STRUCTURE_NAME = 'ZSTR'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = GT_FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

GT_LAYOUT-BOX_FIELDNAME = 'IT_PURCHASE-CHEC'.

LOOP AT GT_FIELDCAT INTO WA_FIELDCAT WHERE FIELDNAME = 'CHEC'.

WA_FIELDCAT-FIELDNAME = 'CHEC'.

WA_FIELDCAT-CHECKBOX = 'X'.

WA_FIELDCAT-EDIT = 'X'.

MODIFY GT_FIELDCAT FROM WA_FIELDCAT .

CLEAR WA_FIELDCAT.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = PGM

I_INTERNAL_TABNAME = 'IT_ITEM'

I_STRUCTURE_NAME = 'ZSTR11'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = GT1_FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

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. " fill_fieldcatalog

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = PGM

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'

IS_LAYOUT = GT_LAYOUT

IT_FIELDCAT = GT_FIELDCAT

TABLES

T_OUTTAB = IT_PURCHASE

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 USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

*clear T_HEADER.

CASE R_UCOMM.

WHEN '&IC1'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = PGM

IT_FIELDCAT = GT1_FIELDCAT

TABLES

T_OUTTAB = 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.

ENDCASE.

ENDFORM.

IWhen i display the o/p, when iselect a perticular line in alv grid..it should show details of that line only..but it is showing all line item details...

what is the problem? and it showing some duplicate records also in the detailed list...