Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Alv Program 1

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

REPORT zking1.

TYPE-POOLS: slis, zfun.


DATA : wa_ekko TYPE zfun_ekko,
it_ekko TYPE STANDARD TABLE OF zfun_ekko,
wa_ekpo TYPE zfun_ekpo,
wa_t001 TYPE zfun_t001,
it_ekpo TYPE STANDARD TABLE OF zfun_ekpo,
it_t001 TYPE STANDARD TABLE OF zfun_t001,
wa_slis TYPE slis_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv,
it_slis TYPE slis_t_fieldcat_alv,
it_fcat TYPE slis_t_fieldcat_alv,
wa_layout TYPE slis_layout_alv,
wa_head TYPE slis_listheader,
it_head TYPE slis_t_listheader,
lv_head1 TYPE c LENGTH 40,
lv_count TYPE c LENGTH 5,
lv_layout TYPE c LENGTH 30,
lv_count1 TYPE c LENGTH 5.
SELECTION-SCREEN BEGIN OF BLOCK navi WITH FRAME .
SELECT-OPTIONS s_ebeln FOR wa_ekko-ebeln MODIF ID a.
PARAMETER disable TYPE i MODIF ID b.
SELECTION-SCREEN END OF BLOCK navi.
PARAMETER : a_ebeln TYPE c RADIOBUTTON GROUP m USER-COMMAND u,
b_off TYPE c RADIOBUTTON GROUP m DEFAULT 'X'.

INITIALIZATION.
s_ebeln-sign = 'I'.
s_ebeln-option = 'BT'.
s_ebeln-low = '3000000006'.
s_ebeln-high = '3000000014'.
APPEND s_ebeln.
CLEAR s_ebeln.

AT SELECTION-SCREEN OUTPUT.
IF a_ebeln = 'X'.
LOOP AT SCREEN .
IF screen-group1 = 'A'.
screen-active = '1'.
screen-invisible = '0'.
MODIFY SCREEN .
CLEAR screen.
ELSEIF screen-group1 = 'B'.
screen-active = '0'.
screen-invisible = '1'.
MODIFY SCREEN.
CLEAR screen.
ENDIF.
ENDLOOP.
ELSEIF b_off = 'X'.
LOOP AT SCREEN .
IF screen-group1 = 'A'.
screen-invisible = '1'.
MODIFY SCREEN .
CLEAR screen.
ELSEIF screen-group1 = 'B'.
screen-invisible = '0'.
MODIFY SCREEN.
CLEAR screen.
ENDIF.
ENDLOOP.
ENDIF.
***********************************************************************************
***************
START-OF-SELECTION.
SELECT ebeln
bukrs
aedat
lifnr FROM ekko INTO TABLE it_ekko
WHERE ebeln IN s_ebeln.
***********************************************************************************
*************
PERFORM fill USING 'EBELN' 'Purchasing Document Number'.
PERFORM fill USING 'BUKRS' 'Company Code'.
PERFORM fill USING 'AEDAT' 'Date on Which Record Was Created'.
PERFORM fill USING 'LIFNR' 'Vendor Account Number'.
wa_layout-colwidth_optimize = 'X'.

***********************************************************************************
********
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USE'
i_callback_top_of_page = 'TOP'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_slis
* 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_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.

*&---------------------------------------------------------------------*
*& Form FILL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0206 text
* -->P_0207 text
*----------------------------------------------------------------------*
FORM fill USING VALUE(f_name)
VALUE(heading).

lv_count = lv_count + 1.
wa_slis-fieldname = f_name.
wa_slis-col_pos = lv_count.
wa_slis-tabname = 'EKKO'.
wa_slis-seltext_m = heading.
wa_slis-hotspot = 'X'.
APPEND wa_slis TO it_slis.
CLEAR wa_slis.

ENDFORM.
***********************************************************************************
*********************************
FORM use USING m TYPE sy-ucomm n TYPE slis_selfield.
IF n-fieldname = 'EBELN'.
SELECT ebeln
ebelp
matnr
matkl FROM ekpo INTO TABLE it_ekpo
WHERE ebeln = N-VALUE.

******************************************
CLEAR lv_count.
PERFORM s1 USING 'EBELN' 'Purchasing Document Number'.
PERFORM s1 USING 'EBELP' 'Item Number of Purchasing Document'.
PERFORM s1 USING 'MATNR' 'Material Number'.
PERFORM s1 USING 'MATKL' 'MATERIAL GROUP'.

clear wa_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_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_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.

ENDIF.
ENDFORM.
FORM top.
CLEAR : it_head.
wa_head-typ = 'H'.
wa_head-info = 'ALV INTRACTIVE REPORT'.
APPEND wa_head TO it_head.
CLEAR wa_head .
wa_head-typ = 'S'.
wa_head-info = 'PURCHASE DOCUMENT'.
APPEND wa_head TO it_head.
CLEAR wa_head .
CONCATENATE ' GENERATED ON:-' sy-datum+6(2) ' '
sy-datum+4(2) ' '
sy-datum+0(4) ' . ' INTO lv_head1 .

wa_head-typ = 'A'.
wa_head-info = lv_head1.
APPEND wa_head TO it_head.
CLEAR wa_head .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'


EXPORTING
it_list_commentary = it_head
i_logo = 'NAVI'.
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form S1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0335 text
* -->P_0336 text
*----------------------------------------------------------------------*
FORM s1 USING VALUE(f_name1)
VALUE(heading1).

lv_count = lv_count + 1.
wa_fcat-fieldname = f_name1.
wa_fcat-col_pos = lv_count.
wa_fcat-tabname = 'EKPO'.
wa_fcat-seltext_m = heading1.
wa_fcat-hotspot = 'X'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

ENDFORM.

You might also like