2007 Jun 29 11:41 AM
Hi everyone
I want to learn ALV-Reports. Even i donot know the transaction code for this. So please suggest me the way , material etc.
Thanks.
2007 Jun 29 11:50 AM
HI.
Check this std prog.
BCALV_edit_01
BCALV_edit_02
BCALV_edit_03
BCALV_edit_04
BCALV_edit_05
BCALV_edit_06
BCALV_edit_07
BCALV_edit_08
refer this code.
REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .
************************************************************************
*Simple example to use ALV and to define the ALV data in an internal
*table
************************************************************************
Martin Schlegel, BearingPoint, December 2004
*
Thanks to Madhusudhan Sonee and Rama Krishna Kommineni for testing
and feedback
*
************************************************************************
************************************************************************
*For a very long time, people gave me the feeling that ALV is a
*complicated tool that is difficult to understand and to use.
*Lately I had to use it and I discovered that ALV is easy to use and
*saves a lot of work:
*ALV will generate the column headings on its own, so one does not need
*to work on headlines and transalation.
*ALV allows the user to select the columns he wants to see, so the user
*does not need to contact a developer for every change he likes to have.
*ALV allows the user to create his own sums, so
*ALV has a simple way to work with internal tables.
*If you really want to save time, use ALV instead of write!
************************************************************************
*
*Please take 30 minutes to explore the following example and see how
*easy it is to use ALV!
*
************************************************************************
*data definition
tables:
marav. "Table MARA and table MAKT
----
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
----
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
----
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
----
select-options:
s_matnr for marav-matnr matchcode object MAT1.
----
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
----
*
Now, we start with ALV
*
----
*
*
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
*
*
----
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
I_PROGRAM_NAME is the program which calls this function
*
I_INTERNAL_TABNAME is the name of the internal table which you want
to display in ALV
*
I_INCLNAME is the ABAP-source where the internal table is defined
(DATA....)
CT_FIELDCAT contains the Fieldcatalouge that we need later for
ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
----
*
And now, we are ready to display our list
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
*explanations:
I_CALLBACK_PROGRAM is the program which calls this function
*
IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
now the data definition needed for display
*
I_SAVE allows the user to save his own layouts
*
T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
Reward all helpfull answers.
Regards.
Jay
Hi everyone
I want to learn ALV-Reports. Even i donot know the transaction code for this. So please suggest me the way , material etc.
Thanks.
2007 Jun 29 11:48 AM
Hi Ravi,
Check this demo program: BALVSD01.
It shows how to use ALV reports.
Basically there is two type of ALV:
-ALV List
-ALV Grid
The newer one is ALV Grid. It has more functionality.
The principle is to build a "field category" ( a table describing your table fields), and call the displaying FM such as REUSE_ALV_LIST_DISPLAY (if you use ALV list), and pass the report table as well.
2007 Jun 29 11:49 AM
hi
there is no t-code for alv reports.
go to se38.
coding is like normal report program except write statements use ALV_* funcxtion modules.
learn it in ABAP DOCU -TCODE .
and also explore help.sap.com.
reward if useful..
2007 Jun 29 11:59 AM
hi
there is no transaction code for alv.
1) Just go to se38 write a programme
Just go through the code:
&----
*& Report ZGAU_ALV
*&
&----
*&
*&
&----
REPORT zgau_alv.
TABLES: ekko,ekpo.
TYPE-POOLS: slis.
*&----
*declaring structure referencing EKPO able
*&----
TYPES: BEGIN OF t_ekpo,
*MANDT type MANDT,
ebelp TYPE ekpo-ebelp,
ebeln TYPE ekpo-ebeln,
statu TYPE ekpo-statu,
aedat TYPE paedt,
*line_color(4) TYPE c, "Used to store row color
END OF t_ekpo.
*&----
*declaring structure referencing EKKO able
*&----
TYPES: BEGIN OF t_ekko,
*ebeln TYPE ebeln,
*MANDT type MANDT,
LPONR type LPONR,
ernam TYPE ernam,
lifnr TYPE elifn,
bukrs TYPE bukrs,
*line_color(4) TYPE c, "Used to store row color
END OF t_ekko.
*&----
*declaring structure FINAL able
*&----
TYPES: BEGIN OF t_out,
*ebeln TYPE ebeln,
*MANDT type MANDT,
ebelp TYPE ekpo-ebelp,
ebeln TYPE ekpo-ebeln,
statu TYPE ekpo-statu,
aedat TYPE paedt,
LPONR type LPONR,
ernam TYPE ernam,
lifnr TYPE elifn,
bukrs TYPE bukrs,
line_color(4) TYPE c, "Used to store row color
END OF t_out.
*&----
*Declaring internal table and work area for simple processing
*&----
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo ,
wa_ekpo LIKE LINE OF it_ekpo,
it_ekko type standard table of t_ekko ,
wa_ekko like line of it_ekko,
it_out type standard table of t_out,
wa_out like line of it_out.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group type slis_t_sp_group_alv,"wat is the use of this function.
gd_layout type slis_layout_alv,
gd_repid LIKE sy-repid.
*START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
perform build_layout.
PERFORM display_alv_report.
END-OF-SELECTION.
*&----
*& Form data_retrieval
*&----
text
*----
--> p1 text
<-- p2 text
*----
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT MANDT ebelp statu aedat INTO TABLE it_ekpo FROM ekpo UP TO 100 ROWS.
SELECT ebelp ebeln statu aedat INTO TABLE it_ekpo FROM ekpo UP TO 100 ROWS.
SELECT MANDT ernam lifnr bukrs INTO TABLE it_ekko FROM ekko UP TO 100 ROWS.
SELECT LPONR ernam lifnr bukrs INTO TABLE it_ekko FROM ekko UP TO 100 ROWS.
LOOP AT it_ekpo INTO wa_ekpo.
READ TABLE it_ekko INTO wa_ekko WITH KEY MANDT = wa_ekpo-MANDT.
READ TABLE it_ekko INTO wa_ekko WITH KEY LPONR = wa_ekpo-ebelp.
if sy-subrc = 0.
wa_out-MANDT = wa_ekpo-MANDT.
wa_out-ebelp = wa_ekpo-ebelp.
wa_out-ebeln = wa_ekpo-ebeln.
wa_out-statu = wa_ekpo-statu.
wa_out-aedat = wa_ekpo-aedat.
wa_out-LPONR = wa_ekko-LPONR.
wa_out-ernam = wa_ekko-ernam.
wa_out-lifnr = wa_ekko-lifnr.
wa_out-bukrs = wa_ekko-bukrs.
APPEND wa_out to it_out.
endif.
ENDLOOP.
ENDFORM. " data_retrieval
*&----
*& Form build_fieldcatalog
*&----
text
*----
--> p1 text
<-- p2 text
*----
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'purch no'.
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 = 'LPONR'.
fieldcatalog-seltext_m = 'LAST ITEM NO'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ERNAM'.
fieldcatalog-seltext_m = 'Person name'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'LIFNR'.
fieldcatalog-seltext_m = 'Vendor account'.
fieldcatalog-col_pos = 6.
fieldcatalog-do_sum = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'BUKRS'.
fieldcatalog-seltext_m = 'company code'.
fieldcatalog-col_pos = 7.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
fieldcatalog-do_sum = 'X'.
*
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
*
*
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " build_fieldcatalog
*&----
*& Form build_layout
*&----
text
*----
--> p1 text
<-- p2 text
*----
form build_layout.
endform. " build_layout
*&----
*& Form display_alv_report
*&----
text
*----
--> p1 text
<-- p2 text
*----
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
it_fieldcat = fieldcatalog[]
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. " DISPLAY_ALV_REPORT
2007 Jun 29 11:50 AM
HI.
Check this std prog.
BCALV_edit_01
BCALV_edit_02
BCALV_edit_03
BCALV_edit_04
BCALV_edit_05
BCALV_edit_06
BCALV_edit_07
BCALV_edit_08
refer this code.
REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .
************************************************************************
*Simple example to use ALV and to define the ALV data in an internal
*table
************************************************************************
Martin Schlegel, BearingPoint, December 2004
*
Thanks to Madhusudhan Sonee and Rama Krishna Kommineni for testing
and feedback
*
************************************************************************
************************************************************************
*For a very long time, people gave me the feeling that ALV is a
*complicated tool that is difficult to understand and to use.
*Lately I had to use it and I discovered that ALV is easy to use and
*saves a lot of work:
*ALV will generate the column headings on its own, so one does not need
*to work on headlines and transalation.
*ALV allows the user to select the columns he wants to see, so the user
*does not need to contact a developer for every change he likes to have.
*ALV allows the user to create his own sums, so
*ALV has a simple way to work with internal tables.
*If you really want to save time, use ALV instead of write!
************************************************************************
*
*Please take 30 minutes to explore the following example and see how
*easy it is to use ALV!
*
************************************************************************
*data definition
tables:
marav. "Table MARA and table MAKT
----
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
----
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
----
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
----
select-options:
s_matnr for marav-matnr matchcode object MAT1.
----
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
----
*
Now, we start with ALV
*
----
*
*
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
*
*
----
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
I_PROGRAM_NAME is the program which calls this function
*
I_INTERNAL_TABNAME is the name of the internal table which you want
to display in ALV
*
I_INCLNAME is the ABAP-source where the internal table is defined
(DATA....)
CT_FIELDCAT contains the Fieldcatalouge that we need later for
ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
----
*
And now, we are ready to display our list
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
*explanations:
I_CALLBACK_PROGRAM is the program which calls this function
*
IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
now the data definition needed for display
*
I_SAVE allows the user to save his own layouts
*
T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
Reward all helpfull answers.
Regards.
Jay
2007 Jun 29 11:52 AM
hi,
you will get the required healp in tcode abapdocu
or saphelp
2007 Jun 29 11:55 AM
Hi,
Check the following links:
http://www.sap-img.com/abap-function.htm
http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
http://www.sapmaterial.com/alv.html
Regards,
Bhaskar
2007 Jun 29 11:55 AM
Hi Ravi
There is no need to to go for any tcodes for alv
Goto the Tcode <b>LIBS</b> where you can find more number of programs regarding alv
and go for Tcode <b>BIBS</b> you can get some more detailed programs of alv
check this link
http://www.sap-img.com/abap/what-is-alv-programming.htm
http://www.sap-img.com/fu002.htm
http://help.sap.com/saphelp_erp2004/helpdata/en/22/a3f5fbd2fe11d2b467006094192fe3/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/66/bc7aab43c211d182b30000e829fbfe/frameset.htm
If u want any more documents to study about alv then give me your mail id i'll post you some nice documents
reward all helpfull answers
Regards
Pavan
2007 Jun 29 11:59 AM
check these links
http://www.sap-img.com/abap-function.htm
ALVGRID with refresh
http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
ALV Group Heading
http://www.sap-img.com/fu037.htm
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm
ALV all Imp
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sap-img.com/fu002.htm
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_events.htm
ALV Documentation for Field
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
OOPS ALV
OOPS - Events.
Editable ALV
Tree
TabStrip
Multigrid
Check this for basic concepts of OOPS
Tabstrip
Editable ALV
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
Classical ALV
http://www.geocities.com/mpioud/Abap_programs.html
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
Reward all helpfull answers
Regards
Pavan
2009 May 31 5:28 PM