You are on page 1of 5

report zpurchase_order. tables : ekko, ekpo, ekbe, mkpf, mseg, rbkp, rseg, lqua, makt. type-pools: slis.

*********TABLE DECLARATION ************ types: begin of tab_out, ebeln type ekko-ebeln, ebelp type ekpo-ebelp, bedat type ekko-bedat, lifnr type ekko-lifnr, name1 type lfa1-name1, wenum type lqua-wenum, wdatu type lqua-wdatu, matnr type ekpo-matnr, maktx type makt-maktx, menge type mseg-menge, dmbtr type mseg-dmbtr, reewr type ekbe-reewr, wrbtr type ekbe-wrbtr, end of tab_out.

"PO DOC NO "PO ITEM "PO DATE "VENDOR NO "VENDOR NAME "GOODS RECIEPT NO "GOODS RECIEPT DATE "MAT NO "MAT DESC "QUANTITY "AMOUNT

data: it_out type standard table of tab_out, wa_out like it_out. * ************************************************ * FOR ALV DISPLAY * ************************************************ data: it_layout type slis_layout_alv, wa_layout type slis_layout_alv, "wa_event TYPE slis_alv_event, "it_sort TYPE slis_t_sortinfo_alv, "wa_sort LIKE LINE OF it_sort, it_fcat type slis_t_fieldcat_alv, wa_fcat type slis_fieldcat_alv, wa_header type slis_listheader, bo_header type slis_t_listheader. * PERFORM layout.

****************************************************** * SELECTION SCREEN DECLARATION * ****************************************************** selection-screen : begin of block b with frame. parameters: p_order type ekko-ebeln. "PURCHASE DOCUMENT NUMBER select-options: p_date for ekko-bedat, "PURCHASE DOCUMENT DATE p_plant for ekpo-werks."PLANT selection-screen: end of block b.

initialization. perform f_cat. start-of-selection. perform read_data. *perform layout. end-of-selection. perform disp_list. *&---------------------------------------------------------------------* *& Form build_fcat *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form f_cat . FORMAT HOTSPOT ON. wa_fcat-fieldname = 'EBELN'. wa_fcat-seltext_m = 'Po Doc'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'EBELP'. wa_fcat-seltext_m = 'PO Item'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'BEDAT'. wa_fcat-seltext_m = 'PO Date'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'LIFNR'. wa_fcat-seltext_m = 'Vendor No'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'NAME1'. wa_fcat-seltext_m = 'Vendor Name'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy.

wa_fcat-fieldname = 'WENUM'. wa_fcat-seltext_m = 'GR No'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname wa_fcat-seltext_m wa_fcat-outputlen * APPEND wa_fcat TO * CLEAR wa_fcat. perform copy. = 'WDATU'. = 'GR Date'. = 5. it_fcat.

wa_fcat-fieldname = 'MATNR'. wa_fcat-seltext_m = 'Material no'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'MAKTX'. wa_fcat-seltext_m = 'Material Desc'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'MENGE'. wa_fcat-seltext_m = 'Qty'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'DMBTR'. wa_fcat-seltext_m = 'Amount'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname = 'REEWR'. wa_fcat-seltext_m = 'GR'. * APPEND wa_fcat TO it_fcat. * CLEAR wa_fcat. perform copy. wa_fcat-fieldname wa_fcat-seltext_m *wa_fcat-seltext_m = * APPEND wa_fcat TO * CLEAR wa_fcat. perform copy. = 'WRBTR'. = 'IR'. 'IR'. it_fcat.

endform. " build_fcat *&---------------------------------------------------------------------* *& Form disp_list *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form disp_list .

call function 'REUSE_ALV_GRID_DISPLAY' exporting * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' * I_CALLBACK_PROGRAM = ' ' * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * i_callback_top_of_page = 'HEADER' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = 'ZMMR001' * I_GRID_SETTINGS = * is_layout = wa_layout it_fieldcat = it_fcat * 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 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = tables t_outtab = it_out * 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. " disp_list *&---------------------------------------------------------------------*

*& Form read_data *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form read_data . if p_order is not initial or p_date is not initial or p_plant is not initial.

select ekko~ebeln ekpo~ebelp ekko~bedat lfa1~lifnr lfa1~name1 lqua~wenum lqua~wdatu ekpo~matnr makt~maktx mseg~menge mseg~dmbtr ekbe~reewr ekbe~wrbtr into corresponding fields of table it_out from ekko join ekpo on ekko~mandt = ekpo~mandt and ekko~ebeln = ekpo~ebeln join lfa1 on ekko~mandt = lfa1~mandt and ekko~lifnr = lfa1~lifnr join lqua on ekpo~mandt = lqua~mandt and ekpo~matnr = lqua~matnr join mseg on ekko~mandt = mseg~mandt and ekko~ebeln = mseg~ebeln and ekpo~mandt = mseg~mandt and ekpo~ebeln = mseg~ebeln and lfa1~mandt = mseg~mandt and lfa1~lifnr = mseg~lifnr join makt on ekpo~mandt = makt~mandt and ekpo~matnr = makt~matnr join ekbe on ekpo~mandt = ekbe~mandt and ekpo~ebeln = ekbe~ebeln and ekko~mandt = ekbe~mandt and ekko~ebeln = ekbe~ebeln where ekko~ebeln = p_order or ekko~bedat in p_date or ekpo~werks in p_plant or ekbe~reewr = 0 and ekbe~wrbtr <> 0. endif. endform. *form layout. * wa_layout-zebra = 'X'. * wa_layout-edit = 'X'. * endform. form copy. append wa_fcat to it_fcat. clear wa_fcat. endform.

You might also like