‎2005 Dec 07 9:12 AM
REPORT ZKB_ALV_TOPOFPAGE .
type-pools: slis.
tables: vbak , vbap, vbuk.
types: BEGIN OF t_content,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
audat TYPE vbak-audat,
netwr TYPE vbak-netwr,
waerk TYPE vbak-waerk,
vkorg TYPE vbak-vkorg,
END OF t_content.
types: BEGIN OF t_content1,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
matkl TYPE vbap-matkl,
ntgew TYPE vbap-ntgew,
END OF t_content1.
types: BEGIN OF t_content2,
vbeln TYPE vbuk-vbeln,
lfstk TYPE vbuk-lfstk,
END OF t_content2.
parameters: docno type vbak-vbeln.
*select-options docno for vbak-vbeln.
data: itab1 type standard table of t_content with header line initial size 10.
data: itab2 type standard table of t_content1 with header line initial size 10.
data: itab3 type standard table of t_content2 with header line initial size 10.
data: fcat1 type slis_t_fieldcat_alv with header line.
data: prgname like sy-repid.
data: com_wr type slis_t_listheader with header line.
data: it_layout type slis_layout_alv.
data: it_events type slis_t_event with header line.
data: it_header type slis_t_listheader.
*data: it_event type slis
data: begin of itab4 occurs 0,
vbeln type vbak-vbeln,
lfstk type vbuk-lfstk,
end of itab4.
prgname = sy-repid.
**************************************************Initialization************
Initialization.
it_layout-zebra = 'X'.
com_wr-typ = 'H'.
com_wr-info = 'Header'.
append com_wr.
*----
select * from vbak into corresponding fields of table itab1 where vbeln = docno.
select * from vbap into corresponding fields of table itab2 where vbeln = docno.
select * from vbuk into corresponding fields of table itab3 where vbeln = docno.
*IT_HEADER = 'HI'.
*loop at itab3.
*write: /10 itab3-vbeln,
20 itab3-lfstk.
*endloop.
fcat1-tabname = 'ITAB3'.
fcat1-fieldname = 'VBELN'.
fcat1-ref_tabname = 'VBAK'.
fcat1-ref_fieldname = 'VBELN'.
fcat1-col_pos = '1'.
append fcat1.
fcat1-tabname = 'ITAB3'.
fcat1-fieldname = 'LFSTK'.
fcat1-ref_tabname = 'VBUK'.
fcat1-ref_fieldname = 'VBELN'.
append fcat1.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = 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.
***********Adding events***************************
move 'TOPOFP' to it_events-form.
modify it_events transporting form where name = 'TOP_OF_PAGE'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = PRGNAME
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = it_layout
IT_FIELDCAT = fcat1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab3[]
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.
FORM TOPOFP.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = com_wr
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
.
ENDFORM.
‎2005 Dec 07 9:20 AM
Hi,
You posted your code ok.
But it is not good practise of posting the whole code and asking to view find mistake etc.
While posting the que... please specify the correct requirment and subject clearly.
Its ok...
In your code I found one issue...
**********
i_callback_top_of_page = 'TOPOFP'
it was not there in your 'FM'.
No need handle events in this.
In FM you can use the above code directly.
Check it out.
Thanks
If this helps you reward points.
Message was edited by: Deepak333 k
‎2005 Dec 07 9:20 AM
Hi,
You posted your code ok.
But it is not good practise of posting the whole code and asking to view find mistake etc.
While posting the que... please specify the correct requirment and subject clearly.
Its ok...
In your code I found one issue...
**********
i_callback_top_of_page = 'TOPOFP'
it was not there in your 'FM'.
No need handle events in this.
In FM you can use the above code directly.
Check it out.
Thanks
If this helps you reward points.
Message was edited by: Deepak333 k
‎2005 Dec 07 9:29 AM
Hi ,
*------------------------------------------------------------------------------
select * from vbak into corresponding fields of table itab1 where vbeln = docno.
select * from vbap into corresponding fields of table itab2 where vbeln = docno.
select * from vbuk into corresponding fields of table itab3 where vbeln = docno.select fields which you are using, why are you selecting all fields.
and don't use into corresponding fields..
use into table,
declare internal table fields order as it is in the Database.
check all these..