You are on page 1of 4

c  c

c 


c
c  c
c
c
c  c

REPORT YENTRIES.

TABLES : LIPS , likp.

DATA : BEGIN OF I_TAB OCCURS 0,


VBELN LIKE LIPS-VBELN,
POSNR LIKE LIPS-POSNR,
MATNR LIKE LIPS-MATNR,
end of I_TAB.

DATA : BEGIN OF ITEST OCCURS 0,


vkorg like likp-vkorg,
lifnr like likp-lifnr,
bolnr like likp-bolnr,
END OF itest.

c
 
DATA: BDCDATA_WA TYPE BDCDATA,
BDCDATA_TAB TYPE TABLE OF BDCDATA.

c 
TYPE-POOLS SLIS.
DATA : G_REPID LIKE SY-REPID,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,


XFIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,


LS_LINE_HEADER TYPE SLIS_T_LISTHEADER,

GT_EVENTS TYPE SLIS_T_EVENT,


LS_EVENT TYPE SLIS_ALV_EVENT,

FIELD_GROUP TYPE SLIS_T_SP_GROUP_ALV,

LAYOUT TYPE SLIS_LAYOUT_ALV,


LS_LINE TYPE SLIS_LISTHEADER .

CONSTANTS :
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE' ,
GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND' .

SELECTION -SCREEN BEGIN OF BLOCK B1.


SELECT-OPTIONS : VBELN FOR LIPS-VBELN.
select-options : vkorg for likp-vkorg.
PARAMETERS : lifnr like likp-lifnr.
SELECTION -SCREEN END OF BLOCK B1.

PERFORM FIELD_CAT.
PERFORM GET_EVENT.

SELECT VBELN POSNR MATNR FROM LIPS


INTO CORRESPONDING FIELDS OF TABLE I_TAB
WHERE VBELN IN VBELN.
append i_tab.

select vkorg lifnr bolnr vbeln from likp


into itest for ALL ENTRIES in I_TAB
where vbeln = I_TAB-vbeln.

PERFORM FILL_TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = XFIELDCAT[]
I_SAVE = 'A'
IT_EVENTS = GT_EVENTS[]
TABLES
T_OUTTAB = I_TAB.

cc
c

cc
FORM FIELD_CAT .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'I_tab'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
CHANGING
CT_FIELDCAT = XFIELDCAT
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 4.
ENDIF.

LOOP AT XFIELDCAT INTO WA_FIELDCAT.


CASE WA_FIELDCAT -FIELDNAME.
WHEN 'VBELN'.
WA_FIELDCAT -SELTEXT_M = 'SALES NO'.
WA_FIELDCAT -DDICTXT = 'M'.
WA_FIELDCAT -HOTSPOT = 'X'.
WHEN 'POSNR'.
WA_FIELDCAT -SELTEXT_M = 'NO'.
WA_FIELDCAT -DDICTXT = 'M'.
c
    !
ENDCASE.
MODIFY XFIELDCAT FROM WA_FIELDCAT.
ENDLOOP.

c  "
  !
c     # "
 !
ENDFORM. $

cc
c %

c c
FORM TOP_OF_PAGE .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LS_LINE_HEADER.
c % 
& !
ENDFORM. $ %

c c
c%



cc
FORM GET_EVENT .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GT_EVENTS.

LS_EVENT-NAME = GC_FORMNAME_TOP_OF_PAGE.
LS_EVENT-FORM = GC_FORMNAME_TOP_OF_PAGE.
APPEND LS_EVENT TO GT_EVENTS.

LS_EVENT-NAME = GC_FORMNAME_USER_COMMAND.
LS_EVENT-FORM = GC_FORMNAME_USER_COMMAND.
APPEND LS_EVENT TO GT_EVENTS.
ENDFORM. $%



cc
c  %

cc
FORM FILL_TOP_OF_PAGE .
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'FIRST ALV'.
LS_LINE-INFO = vbeln.
APPEND LS_LINE TO LS_LINE_HEADER.
ENDFORM. $  %

cc
c
## 
cc
FORM USER_COMMAND USING PU_OKCODE TYPE SYUCOMM
PU_SELFIELD TYPE SLIS_SELFIELD.
CASE PU_OKCODE.
WHEN '&IC1'.
READ TABLE I_TAB INDEX PU_SELFIELD -TABINDEX.
CHECK SY-SUBRC = 0.

ENDCASE.
ENDFORM. $
##