REPORT ZFIELD_CAT_INTRACTIVE1.
type-pools:slis.
types: begin of ty_vbak,
vbeln type vbeln,
erdat type erdat,
ernam type ernam,
netwr type netwr,
waerk type waerk,
vkorg type vkorg,
end of ty_vbak,
begin of ty_vbap,
vbeln type vbeln,
posnr type posnr,
matnr type matnr,
matkl type matkl,
end of ty_vbap,
begin of ty_mara,
matnr type matnr,
matkl type matkl,
mbrsh type mbrsh,
bismt type bismt,
end of ty_mara.
data:it_vbak type table of ty_vbak,
wa_vbak type ty_vbak,
it_vbap type table of ty_vbap,
wa_vbap type ty_vbap,
it_mara type table of ty_mara,
wa_mara type ty_mara,
it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
it_fieldcat1 type slis_t_fieldcat_alv,
it_fieldcat2 type slis_t_fieldcat_alv,
it_sortinfo type slis_t_sortinfo_alv,
wa_sortinfo type slis_sortinfo_alv.
DATA: w_keyinfo TYPE slis_keyinfo_alv.
select-options:s_vbeln for wa_vbak-vbeln.
start-of-selection.
perform get_vbak.
perform disp_vbak.
*&---------------------------------------------------------------------*
*& Form get_vbak
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_vbak .
select vbeln
erdat
ernam
netwr
waerk
vkorg from vbak
into table it_vbak where vbeln in s_vbeln.
ENDFORM. " get_vbak
*&---------------------------------------------------------------------*
*& Form disp_vbak
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM disp_vbak .
wa_fieldcat-col_pos = '1'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbak'.
wa_fieldcat-fieldname = 'vbeln'.
wa_fieldcat-seltext_m = 'salesdoc'.
wa_fieldcat-hotspot = 'X'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbak'.
wa_fieldcat-fieldname = 'erdat'.
wa_fieldcat-seltext_m = 'date'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbak'.
wa_fieldcat-fieldname = 'ernam'.
wa_fieldcat-seltext_m = 'name'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbak'.
wa_fieldcat-fieldname = 'netwr'.
wa_fieldcat-seltext_m = 'currency'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '5'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbak'.
wa_fieldcat-fieldname = 'waerk'.
wa_fieldcat-seltext_m = 'currency unit'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '6'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbak'.
wa_fieldcat-fieldname = 'vkorg'.
wa_fieldcat-seltext_m = 'currency unit'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_sortinfo-fieldname = 'erdat'.
wa_sortinfo-subtot = 'X'.
append wa_sortinfo to it_sortinfo.
clear wa_sortinfo.
w_keyinfo-header01 = 'VBELN'.
w_keyinfo-item01 = 'VBELN'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'KANTESH'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = IT_VBAK
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
IT_SORT = IT_SORTINFO
* 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_VBAK
* 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.
refresh it_fieldcat.
ENDFORM. " disp_vbak
form kantesh using ucomm like sy-ucomm
selfield type slis_selfield.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = selfield-value
IMPORTING
OUTPUT = wa_vbak-vbeln
.
perform get_vbap.
perform disp_vbap.
endform.
*&---------------------------------------------------------------------*
*& Form get_vbap
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_vbap .
select vbeln posnr matnr matkl from vbap into table it_vbap where vbeln = wa_vbap-vbeln.
ENDFORM. " get_vbap
*&---------------------------------------------------------------------*
*& Form disp_vbap
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM disp_vbap .
wa_fieldcat-col_pos = '1'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbap'.
wa_fieldcat-fieldname = 'vbeln'.
wa_fieldcat-seltext_m = 'salesdoc'.
append wa_fieldcat to it_fieldcat1.
clear wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbap'.
wa_fieldcat-fieldname = 'posnr'.
wa_fieldcat-seltext_m = 'date'.
append wa_fieldcat to it_fieldcat1.
clear wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbap'.
wa_fieldcat-fieldname = 'matnr'.
wa_fieldcat-seltext_m = 'name'.
append wa_fieldcat to it_fieldcat1.
clear wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'vbap'.
wa_fieldcat-fieldname = 'matkl'.
wa_fieldcat-seltext_m = 'currency'.
append wa_fieldcat to it_fieldcat1.
clear wa_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-cprog
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'raju'
* 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_fieldcat1
* 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_vbap
* 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.
refresh it_fieldcat1.
ENDFORM. " disp_vbap
form raju using ucomm like sy-ucomm
selfield type slis_selfield.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = selfield-value
IMPORTING
OUTPUT = wa_vbap-matnr
.
perform get_mara.
perform disp_mara.
endform.
*&---------------------------------------------------------------------*
*& Form get_mara
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_mara .
select matnr matkl mbrsh bismt from mara into table it_mara where matnr = wa_vbap-matnr.
ENDFORM. " get_mara
*&---------------------------------------------------------------------*
*& Form disp_mara
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM disp_mara .
wa_fieldcat-col_pos = '1'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'mara'.
wa_fieldcat-fieldname = 'matnr'.
wa_fieldcat-seltext_m = 'salesdoc'.
append wa_fieldcat to it_fieldcat2.
clear wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'mara'.
wa_fieldcat-fieldname = 'matkl'.
wa_fieldcat-seltext_m = 'date'.
append wa_fieldcat to it_fieldcat2.
clear wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'mara'.
wa_fieldcat-fieldname = 'mbrsh'.
wa_fieldcat-seltext_m = 'name'.
append wa_fieldcat to it_fieldcat2.
clear wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-tabname = 'mara'.
wa_fieldcat-fieldname = 'bismt'.
wa_fieldcat-seltext_m = 'currency'.
append wa_fieldcat to it_fieldcat2.
clear wa_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-cprog
* 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_fieldcat2
* 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_mara
* 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.
refresh it_fieldcat2.
ENDFORM. " disp_mara