Skip to Content
0
Feb 26, 2007 at 06:57 AM

Doubt in ALV

15 Views

Hi,

when i use the fm REUSE_ALV_LIST_DISPLAY, I can able to view the purchase order when i click on tat PO number. But when i use the FM REUSE_ALV_GRID_DISPLAY, I cant able to display the PO...can anyone tell me how to get the PO display..

And can anyone say the step for inserting LOGO in ALV..??

TYPE-POOLS: SLIS.

DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

FIELDCAT_LN TYPE SLIS_FIELDCAT_ALV.

DATA: PURNO LIKE EKPO-EBELN.

DATA: COL_POS TYPE I.

DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'LIST DISPLAYED'.

DATA: BEGIN OF ITAB OCCURS 0,

EBELN LIKE EKPO-EBELN,

MATNR LIKE EKPO-MATNR,

BUKRS LIKE EKPO-BUKRS,

END OF ITAB.

SELECT-OPTIONS PUR FOR PURNO.

SELECT EBELN MATNR BUKRS FROM EKPO INTO CORRESPONDING FIELDS OF TABLE

ITAB WHERE EBELN IN PUR.

PERFORM FIELDCAT1.

*PERFORM TOP_OF_PAGE.

PERFORM START_LIST_VIEWER.

FORM FIELDCAT1.

ADD 1 TO COL_POS.

FIELDCAT_LN-REF_TABNAME = 'EKPO'.

FIELDCAT_LN-FIELDNAME = 'EBELN'.

FIELDCAT_LN-KEY = 'X'.

FIELDCAT_LN-COL_POS = COL_POS.

FIELDCAT_LN-SELTEXT_M = 'PO NUMBER'.

FIELDCAT_LN-HOTSPOT = 'X'.

APPEND FIELDCAT_LN TO FIELDCAT.

FIELDCAT_LN-REF_TABNAME = 'EKPO'.

FIELDCAT_LN-FIELDNAME = 'MATNR'.

FIELDCAT_LN-KEY = ' '.

FIELDCAT_LN-COL_POS = COL_POS.

FIELDCAT_LN-SELTEXT_M = 'MATERIAL NUMBER'.

FIELDCAT_LN-HOTSPOT = 'X'.

APPEND FIELDCAT_LN TO FIELDCAT.

FIELDCAT_LN-REF_TABNAME = 'EKPO'.

FIELDCAT_LN-FIELDNAME = 'BUKRS'.

FIELDCAT_LN-KEY = ' '.

FIELDCAT_LN-COL_POS = COL_POS.

FIELDCAT_LN-SELTEXT_M = 'COMPANY CODE'.

FIELDCAT_LN-HOTSPOT = ' '.

APPEND FIELDCAT_LN TO FIELDCAT.

ENDFORM.

FORM START_LIST_VIEWER.

DATA: PGM LIKE SY-REPID.

PGM = SY-REPID.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = PGM

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

  • I_GRID_TITLE = I_TITLE_EKKO

IT_FIELDCAT = FIELDCAT

TABLES

T_OUTTAB = ITAB

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.

*FORM TOP_OF_PAGE.

*

  • CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

  • EXPORTING

  • I_LOGO = 'ATLINE1' .

  • IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.

*

*ENDFORM.

FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM

SELFIELD TYPE SLIS_SELFIELD.

CHECK SY-SUBRC = 0.

CASE UCOMM.

WHEN '&IC1'.

READ TABLE ITAB INDEX SELFIELD-TABINDEX.

CASE SELFIELD-SEL_TAB_FIELD.

WHEN 'ITAB-EBELN'.

SET PARAMETER ID 'BES' FIELD ITAB-EBELN.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

WHEN 'ITAB-MATNR'.

SET PARAMETER ID 'MAT' FIELD ITAB-MATNR.

CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDCASE.

ENDCASE.