2008 Nov 01 10:20 AM
Hi experts,
I have a requirement in which i have to display invoice number and date at one time for their respective each and every product item in alv . how to achieve this ?
2008 Nov 01 10:39 AM
use control break statement for ur final i.tab...
loop at i.tab.
on change i.tab-vbeln.
ifinal-vbeln = i.tab-vbeln.
ifnal-erdat= i.tab-erdat.
endon.
ifinal-other fileds
append ifinal.
endloop.
pass this ifinal i.tab to grid display....
Hi experts,
I have a requirement in which i have to display invoice number and date at one time for their respective each and every product item in alv . how to achieve this ?
2008 Nov 01 10:37 AM
Check out this tables
TVKO Sales organization / company code
TVKOV Distribution channel / sales organization
TVKOS Division to sales organization
TVTA Sales aria
TVKBZ Sales office to sales area
TVBVK Sales group to sales office
TVKWZ Plants to sales organization
2008 Nov 01 10:38 AM
use this example
&----
*& Report ZDEMO_ALVGRID *
*& *
&----
*& *
*& Example of a simple ALV Grid Report with grand total *
*& ................................... *
*& *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
&----
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
*----
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
************************************************************************
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
&----
*& Form BUILD_FIELDCATALOG
&----
Build Fieldcatalog for ALV Report
----
form build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
to make editable field
fieldcatalog-edit = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
&----
*& Form BUILD_LAYOUT
&----
Build layout for ALV grid report
----
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
endform. " BUILD_LAYOUT
&----
*& Form DISPLAY_ALV_REPORT
&----
Display report using ALV grid
----
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
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. " DISPLAY_ALV_REPORT
&----
*& Form DATA_RETRIEVAL
&----
Retrieve data form EKPO table and populate itab it_ekko
----
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
2008 Nov 01 10:39 AM
use control break statement for ur final i.tab...
loop at i.tab.
on change i.tab-vbeln.
ifinal-vbeln = i.tab-vbeln.
ifnal-erdat= i.tab-erdat.
endon.
ifinal-other fileds
append ifinal.
endloop.
pass this ifinal i.tab to grid display....
2008 Nov 01 10:47 AM
Hi,
For achieving your requirement do have to sort the two fields....invoice number and date...
DATA : it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
FORM do_sort .
it_sort-spos = <position>.
it_sort-fieldname = <field name>.
it_sort-tabname = <internal table name>.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
* it_sort-group = '*'.
* it_sort-expa = 'X'.
APPEND it_sort.
it_sort-spos = <position>.
it_sort-fieldname = <field name>.
it_sort-tabname = <internal table name>.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
* it_sort-group = '*'.
* it_sort-expa = 'X'.
APPEND it_sort.
ENDFORM. " DO_SORT
and pass it_sort[] to
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 = '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 = it_layout
it_fieldcat = it_fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = it_sort[]----------------- > sorted format
2008 Nov 01 11:20 AM