‎2008 Mar 18 7:00 AM
DEVELOP A REPORT USING ALV GRID CONTROL TO DISPLAY THE SALES ORDER DETAILS MEANS? PLS GIVE CODING FOR THIS
‎2008 Mar 18 7:11 AM
Hi
in the below program instead of kna1 table..u can use vbak...and the feilds which u want from the table
type-pools : slis.
----
STRUCTURE DECLARATION
----
types : begin of st_kna1 ,
kunnr type kna1-kunnr,
name1 type kna1-name1,
ort01 type kna1-ort01,
land1 type kna1-land1,
end of st_kna1.
----
INTERNAL TABLE DECLARATION
----
data:it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
v_kunnr type kna1-kunnr,
w_repid type sy-repid,
wa_layout type slis_layout_alv,
it_kna1 type standard table of st_kna1 with header line.
select-options s_kunnr for v_kunnr.
----
START-OF-SELECTION
----
start-of-selection.
select kunnr name1 ort01 land1
from kna1
into table it_kna1
where kunnr in s_kunnr.
perform populate_feildcat.
perform display_data.
&----
*& Form populate_feildcat
&----
form populate_feildcat .
wa_fieldcat-fieldname = 'KUNNR'.
wa_fieldcat-seltext_l = 'CUSTOMER NO'.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_l = 'NAME'.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_l = 'CITY'.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'LAND1'.
wa_fieldcat-seltext_l = 'COUNTRY'.
append wa_fieldcat to it_fieldcat.
wa_layout-colwidth_optimize = 'X'.
endform. " populate_feildcat
&----
*& Form display_data
&----
form display_data .
if s_kunnr is initial.
message 'NO DATA FOUND' type 'I'.
else.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = it_fieldcat
tables
t_outtab = it_kna1
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.
endif.
‎2008 Mar 18 7:03 AM
Use in the below BAPI
BAPISDORDER_GETDETAILEDLIST
BAPI_SALESORDER_GETDETAILBOS
BAPI_ALM_ORDER_GET_DETAIL
Reward points if it is helpful..
‎2008 Mar 18 7:06 AM
These are the lists of bapi FM's used for Sales
BAPI_SALESGROUP_GET_DETAIL Sales Group: Display Name
BAPI_SALESOFFICE_GET_DETAIL Sales Office: Display Name
BAPI_SALESOFFICE_GRP_EXIST Sales Office / Sales Group: Existence Check
BAPI_SALESORG_EXIST Sales Organization: Existence Check
BAPI_SALESORG_GET_DETAIL Sales Organization: Display Data
BAPI_SALESORG_OFFICE_EXIST Sales Organization / Sales Office: Existence Check
For sales order
BAPI_SALESGROUP_GET_DETAIL Sales Group: Display Name
BAPI_SALESOFFICE_GET_DETAIL Sales Office: Display Name
BAPI_SALESOFFICE_GRP_EXIST Sales Office / Sales Group: Existence Check
BAPI_SALESORG_EXIST Sales Organization: Existence Check
BAPI_SALESORG_GET_DETAIL Sales Organization: Display Data
BAPI_SALESORG_OFFICE_EXIST Sales Organization / Sales Office: Existence Check
Reward points..
‎2008 Mar 18 7:04 AM
HI,
simply u can do like this.
DATA:i_vbak like vbak OCCURS 0 WITH HEADER LINE.
SELECT * from vbak into CORRESPONDING FIELDS OF TABLE i_vbak.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_STRUCTURE_NAME = 'VBAK'
TABLES
T_OUTTAB = i_vbak[].
rgds,
bharat.
‎2008 Mar 18 7:11 AM
Hi
in the below program instead of kna1 table..u can use vbak...and the feilds which u want from the table
type-pools : slis.
----
STRUCTURE DECLARATION
----
types : begin of st_kna1 ,
kunnr type kna1-kunnr,
name1 type kna1-name1,
ort01 type kna1-ort01,
land1 type kna1-land1,
end of st_kna1.
----
INTERNAL TABLE DECLARATION
----
data:it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
v_kunnr type kna1-kunnr,
w_repid type sy-repid,
wa_layout type slis_layout_alv,
it_kna1 type standard table of st_kna1 with header line.
select-options s_kunnr for v_kunnr.
----
START-OF-SELECTION
----
start-of-selection.
select kunnr name1 ort01 land1
from kna1
into table it_kna1
where kunnr in s_kunnr.
perform populate_feildcat.
perform display_data.
&----
*& Form populate_feildcat
&----
form populate_feildcat .
wa_fieldcat-fieldname = 'KUNNR'.
wa_fieldcat-seltext_l = 'CUSTOMER NO'.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_l = 'NAME'.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_l = 'CITY'.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'LAND1'.
wa_fieldcat-seltext_l = 'COUNTRY'.
append wa_fieldcat to it_fieldcat.
wa_layout-colwidth_optimize = 'X'.
endform. " populate_feildcat
&----
*& Form display_data
&----
form display_data .
if s_kunnr is initial.
message 'NO DATA FOUND' type 'I'.
else.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = it_fieldcat
tables
t_outtab = it_kna1
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.
endif.
‎2008 Mar 18 7:11 AM
hi,
this is my code please check it
here i used ekpo instead use simply vbak. thats it.
type-pools : slis.
&----
*& structure declaration
&----
types : begin of st_ekpo,
ebeln type ekko-ebeln,
ebelp type ekpo-ebelp, "Item Number of Purchasing Document
ematn type ekpo-ematn, "Material number
matkl type ekpo-matkl, "Material group
netpr type ekpo-netpr, "Net price in purchasing document
line_color(4) type c,
end of st_ekpo.
&----
*& internal table and work area declaration
&----
data : it_ekpo type standard table of st_ekpo,
wa_ekpo type st_ekpo,
it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
wa_layout type slis_layout_alv.
&----
*& internal table and work area declaration
&----
data : v_ebeln type ekko-ebeln.
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line type slis_listheader-info,
nl_lines type i,
nl_linesc(10) type c,
ld_color(1) type c.
&----
*& start-of-selection
&----
start-of-selection.
selection-screen begin of block a with frame title text-000.
select-options : so_ebeln for v_ebeln.
selection-screen end of block a.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform griddisplay_alv.
perform top-of-page.
&----
*& Form build_fieldcatalog
&----
form build_fieldcatalog.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_l = 'PURCHASE ORDER'.
wa_fieldcat-col_pos = 0.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-seltext_l = 'ITEM NUMBER'.
wa_fieldcat-col_pos = 1.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'EMATN'.
wa_fieldcat-seltext_l = 'MATERIAL TYPE'.
wa_fieldcat-col_pos = 2.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'MATKL'.
wa_fieldcat-seltext_l = 'MATERIAL GROUP'.
wa_fieldcat-col_pos = 3.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'NETPR'.
wa_fieldcat-seltext_l = 'NET PRICE'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-do_sum = 'X'.
append wa_fieldcat to it_fieldcat.
endform. "build_fieldcatalog
&----
*& Form data_retrieval
&----
form data_retrieval.
select ebeln ebelp ematn matkl netpr
from ekpo
into table it_ekpo
where ebeln in so_ebeln.
loop at it_ekpo into wa_ekpo.
wa_ekpo-line_color = 'C410'.
modify it_ekpo from wa_ekpo.
endloop.
endform.
&----
*& form build_layout.
&----
form build_layout.
wa_layout-zebra ='X'.
wa_layout-no_vline = 'X'.
wa_layout-no_hline = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-info_fieldname = 'line_color'.
endform. "build_layout
&----
*& form top-of-page
&----
form top-of-page.
Title
wa_header-typ = 'H'.
wa_header-info = 'PURCHASE ORDER TABLE REPORT'.
append wa_header to t_header.
clear wa_header.
Total No. of Records Selected
describe table it_ekpo lines nl_lines.
nl_linesc = nl_lines.
concatenate 'Total No. of Records Selected: ' nl_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
refresh t_header.
endform. "top-of-page
&----
*& form set_pf_status
&----
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'MYMENU'.
"Copy of 'STANDARD' pf_status from fgroup SALV
endform.
&----
*& form griddisplay_alv.
&----
form griddisplay_alv.
if it_ekpo[] is initial.
message text-001 type 'I'.
else.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_pf_status_set = 'SET_PF_STATUS'
is_layout = wa_layout
it_fieldcat = it_fieldcat
tables
t_outtab = it_ekpo
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.
endif.