11-20-2007 5:14 AM
Hi,
Could anybode explain the following functions in detail?
1. REUSE_ALV_VARIANT_DEFAULT_GET
2. REUSE_ALV_VARIANT_F4
3. REUSE_ALV_VARIANT_EXISTENCE
4. REUSE_ALV_EVENTS_GET
5. REUSE_ALV_COMMENTARY_WRITE
6. REUSE_ALV_FIELDCATALOG_MERGE
7. REUSE_ALV_LIST_DISPLAY
8. REUSE_ALV_GRID_DISPLAY
9. REUSE_ALV_POPUP_TO_SELECT
I would be very much thankful for your contribution.
Regards,
Mallika
11-20-2007 5:36 AM
Hi
<b>1. REUSE_ALV_VARIANT_DEFAULT_GET</b>
Read default display variant (description only, w/o field catalog)
Provides the default variant for the list specified in the structure parameter CS_VARIANT of a program
<b>2. REUSE_ALV_VARIANT_F4</b>
Display variant selection dialog box
Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.
<b>3. REUSE_ALV_VARIANT_EXISTENCE</b>
Checks whether a display variant exists
This function module checks the existence in the database of a display variant passed in the interface.
<b>4. REUSE_ALV_EVENTS_GET</b>
Returns table of possible events for a list type
This table can be passed to the ALV display module with the form name.
<b>5. REUSE_ALV_COMMENTARY_WRITE</b>
List body comment block output
List header information is output according to its type. The output information is put in an internal table. Output attributes are assigned to each line via the TYP field.
This module outputs formatted simple header information at TOP-OF-PAGE.
Example
List <-- Type 'H'
Currency DEM Controlling area currency <-- Type 'S'
Material FGS_TEST Test material <-- Type 'S'
Action info <-- Type 'A'
-
Column headers -
-
List -
<b>6. REUSE_ALV_FIELDCATALOG_MERGE</b>
Create field catalog from dictionary structure or internal table
Supports the creation of the field catalog for the ALV function modules based either on a structure or table defined in the ABAP Data Dictionary, or a program-internal table.
The program-internal table must either be in a TOP Include or its Include must be specified explicitly in the interface.
The variant based on a program-internal table should only be used for rapid prototyping since the following restrictions apply:
Performance is affected since the code of the table definition must always be read and interpreted at runtime.
Dictionary references are only considered if the keywords LIKE or INCLUDE STRUCTURE (not TYPE) are used.
If the field catalog contains more than 90 fields, the first 90 fields are output in the list by default whereas the remaining fields are only available in the field selection.
If the field catalog is passed with values, they are merged with the 'automatically' found information.
<b>7. REUSE_ALV_LIST_DISPLAY</b>
Output a simple list (single line or several lines)
This module outputs an internal table with any structure as a formatted one-line or multiple-line list.
<b>Principle:</b>Pass an internal table with the set of output information
Pass a structure with general list layout details
Pass a field catalog as an internal table
The field catalog describes the fields to be output in the list.
All actions on the list refer directly to the internal output table, e.g. sorting the list also sorts the passed internal output table (passed by reference).
An important consideration for the use of the tools and certain generic functions (totals, subtotals) is the expected amount of data to be displayed.
The application must take this consideration into account.
<b>8. REUSE_ALV_GRID_DISPLAY</b>
Output of a simple list (single-line)
The function module outputs an internal table with whatever structure in the form of a formatted single- oder multi-line list.
<b>Process:</b>
Passing an internal table with the set of information to be output
Passing a structure with general layout specifications for list layout
Passing a field catalog in the form of an internal table
The field catalog describes the fields to be output in the list.
All interactions performed on the list refer directly to the internal output table. Sorting the list, for example, also involves a resorting of the internal output table passed (since it was passed by reference).
An important factor determining the usability of the tool or of various generic functions (totals, subtotals) is the expected amount of data to be displayed.
The application is responsible for critically testing this aspect and consider
<b>9. REUSE_ALV_POPUP_TO_SELECT</b>
List in dialog box to choose one or more entries (or display only)
Module for displaying or selecting table entries in internal tables in a popup (single or multiple selection is possible).
<b>Principle:</b>
pass an internal table with the superset of information to be output
pass list layout detail flags
pass a field catalog in the form of an internal table
The field catalog describes the fields to be output in the list.
<b>Further information</b>
The module uses the function module 'REUSE_ALV_LIST_DISPLAY' internally. The documentation of this module contains further information about the field catalog.
<b>Reward if usefull</b>
11-20-2007 5:19 AM
Hi,
REUSE_ALV_COMMENTARY_WRITE --> To Display LOGO and Header
REUSE_ALV_FIELDCATALOG_MERGE --> to Build Field catalog ditrectly from structure maintainedin dictionary level.
REUSE_ALV_LIST_DISPLAY --> To display the ALV in list format
REUSE_ALV_GRID_DISPLAY --> To dipslay the list in Grid format
REUSE_ALV_POPUP_TO_SELECT --> whenever th euser double clicks on a particuylar record, we can display the detaisl of that record in another Pop up screen through this FM
Rvert back if any issues,
Regards,
Naveen
11-20-2007 5:21 AM
11-20-2007 5:27 AM
11-20-2007 5:29 AM
Hi,
Reprots
http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
ALV
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
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
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
http://www.sap-img.com/abap/what-is-alv-programming.htm
http://www.sap-img.com/abap-function.htm
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
11-20-2007 5:32 AM
11-20-2007 5:36 AM
Hi
<b>1. REUSE_ALV_VARIANT_DEFAULT_GET</b>
Read default display variant (description only, w/o field catalog)
Provides the default variant for the list specified in the structure parameter CS_VARIANT of a program
<b>2. REUSE_ALV_VARIANT_F4</b>
Display variant selection dialog box
Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.
<b>3. REUSE_ALV_VARIANT_EXISTENCE</b>
Checks whether a display variant exists
This function module checks the existence in the database of a display variant passed in the interface.
<b>4. REUSE_ALV_EVENTS_GET</b>
Returns table of possible events for a list type
This table can be passed to the ALV display module with the form name.
<b>5. REUSE_ALV_COMMENTARY_WRITE</b>
List body comment block output
List header information is output according to its type. The output information is put in an internal table. Output attributes are assigned to each line via the TYP field.
This module outputs formatted simple header information at TOP-OF-PAGE.
Example
List <-- Type 'H'
Currency DEM Controlling area currency <-- Type 'S'
Material FGS_TEST Test material <-- Type 'S'
Action info <-- Type 'A'
-
Column headers -
-
List -
<b>6. REUSE_ALV_FIELDCATALOG_MERGE</b>
Create field catalog from dictionary structure or internal table
Supports the creation of the field catalog for the ALV function modules based either on a structure or table defined in the ABAP Data Dictionary, or a program-internal table.
The program-internal table must either be in a TOP Include or its Include must be specified explicitly in the interface.
The variant based on a program-internal table should only be used for rapid prototyping since the following restrictions apply:
Performance is affected since the code of the table definition must always be read and interpreted at runtime.
Dictionary references are only considered if the keywords LIKE or INCLUDE STRUCTURE (not TYPE) are used.
If the field catalog contains more than 90 fields, the first 90 fields are output in the list by default whereas the remaining fields are only available in the field selection.
If the field catalog is passed with values, they are merged with the 'automatically' found information.
<b>7. REUSE_ALV_LIST_DISPLAY</b>
Output a simple list (single line or several lines)
This module outputs an internal table with any structure as a formatted one-line or multiple-line list.
<b>Principle:</b>Pass an internal table with the set of output information
Pass a structure with general list layout details
Pass a field catalog as an internal table
The field catalog describes the fields to be output in the list.
All actions on the list refer directly to the internal output table, e.g. sorting the list also sorts the passed internal output table (passed by reference).
An important consideration for the use of the tools and certain generic functions (totals, subtotals) is the expected amount of data to be displayed.
The application must take this consideration into account.
<b>8. REUSE_ALV_GRID_DISPLAY</b>
Output of a simple list (single-line)
The function module outputs an internal table with whatever structure in the form of a formatted single- oder multi-line list.
<b>Process:</b>
Passing an internal table with the set of information to be output
Passing a structure with general layout specifications for list layout
Passing a field catalog in the form of an internal table
The field catalog describes the fields to be output in the list.
All interactions performed on the list refer directly to the internal output table. Sorting the list, for example, also involves a resorting of the internal output table passed (since it was passed by reference).
An important factor determining the usability of the tool or of various generic functions (totals, subtotals) is the expected amount of data to be displayed.
The application is responsible for critically testing this aspect and consider
<b>9. REUSE_ALV_POPUP_TO_SELECT</b>
List in dialog box to choose one or more entries (or display only)
Module for displaying or selecting table entries in internal tables in a popup (single or multiple selection is possible).
<b>Principle:</b>
pass an internal table with the superset of information to be output
pass list layout detail flags
pass a field catalog in the form of an internal table
The field catalog describes the fields to be output in the list.
<b>Further information</b>
The module uses the function module 'REUSE_ALV_LIST_DISPLAY' internally. The documentation of this module contains further information about the field catalog.
<b>Reward if usefull</b>
11-20-2007 6:50 AM
1.REUSE_ALV_FIELDCATALOG_MERGE:Create field catalog from dictionary structure or internal table.Actually this function module
is used to create a output layout set(That means the Structure)
ex:
KUNNR | VBELN | POSNNR
-
parameters used are:
I_PROGRAM_NAME = SY-REPID " UR PROGRAM NAME
I_INTERNAL_TABNAME = 'ITAB' " UR INTERNAL TABLE NAME
I_INCLNAME = SY-REPID "UR PROGRAM NAME
ct_fieldcat =it_fieldcat "fieldcatalog table name
2.REUSE_ALV_COMMENTARY_WRITE: Used for placing a text in header and add logos to our ALV
parameters used are:
it_list_commentary = it_listhead " header table
i_logo = 'KIRAN529' "T.Code : OAER(Creating logos)
3.REUSE_ALV_LIST_DISPLAY :Display the output in List Format.
parameters used are:
I_CALLBACK_PROGRAM = SY-REPID "UR PROGRAM NAME
IT_FIELDCAT = it_fieldcat " fieldcat table name
t_outtab = itab " UR INTERNAL TABLE NAME.
4.REUSE_ALV_GRID_DISPLAY:Display the output in GRID Format.
parameters used are:
I_CALLBACK_PROGRAM = SY-REPID "UR PROGRAM NAME
IT_FIELDCAT = it_fieldcat " fieldcat table name
t_outtab = itab " UR INTERNAL TABLE NAME.
5.REUSE_ALV_POPUP_TO_SELECT: ur requirement is to display output in list or grid format
before display the output it will ask u whether u want to display the output in list or
grid format then u select any one of those by using this function module.
6.REUSE_ALV_EVENTS_GET: If we want place some events like top of page,at user command in ur
program we use this function module.
SMALL PROGRAM : IN THIS SOME FUNCTION MODULES CHECK IT ONCE
IF THIS PROGRAM IS NOT WORK THERE IS A LINE "SELECITON-SCREEN"
IN THAT DOUBLE CLICK TEXT-001 AND WRITE SOME TEXT AND SAVE IT AND
EXECUTE IT.IT WILL WORK PROPERLY..
&----
*& Report YSDNSALES *
*& *
&----
*& DEVELOPMENT : KIRAN KUMAR.G *
*& PURPOSE : SALES ORDER FOR A GIVEN CUSTOMER *
&----
REPORT ysdnsales .
----
Type-Pools
----
TYPE-POOLS:slis.
----
Tables
----
TABLES:vbak,vbap.
----
Internal table used to hold sales order information
----
DATA: BEGIN OF it_salesorder OCCURS 0,
kunnr LIKE vbak-kunnr, "Customer Number
vbeln LIKE vbak-vbeln, "Sales Doc Number
posnr LIKE vbap-posnr, "Sales Doc Item
bstdk LIKE vbak-bstdk, "Purchase Order Date
netwr LIKE vbap-netwr, "NetPrice
END OF it_salesorder.
----
Global Data For ALV Display
----
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_listhead TYPE slis_t_listheader,
wa_listhead TYPE slis_listheader.
----
Select-options
----
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_kunnr FOR vbak-kunnr, " Customer Number
s_vbeln FOR vbak-vbeln. " Sales Doc No
SELECTION-SCREEN: END OF BLOCK b1.
----
Initialization
----
initialization.
perform initial.
----
Fetch the data
----
start-of-selection.
perform list_head. " For Header Informatin
perform field_catalog. " Define Structure
perform fetch_data. " Get the data
----
Display data
----
end-of-selection.
perform display_data.
&----
*& Form initial
&----
text
----
--> p1 text
<-- p2 text
----
form initial .
s_kunnr-sign = 'I'.
s_kunnr-option = 'BT'.
s_kunnr-low = '1033'.
s_kunnr-high ='1390'.
append s_kunnr.
s_vbeln-sign = 'I'.
s_vbeln-option = 'BT'.
s_vbeln-low = '4969'.
s_vbeln-high = '5000'.
append s_vbeln.
endform. " initial
&----
*& Form list_head
&----
text
----
--> p1 text
<-- p2 text
----
form list_head .
wa_listhead-typ = 'H'. "Header data
wa_listhead-info = 'Sales Order Report'.
append wa_listhead to it_listhead.
endform. " list_head
&----
*& Form field_catalog
&----
text
----
--> p1 text
<-- p2 text
----
form field_catalog .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_SALESORDER'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*wa_fieldcat-col_pos = w_var. " Filed Position variable
*a_fieldcat-tabname = 'IT_SALESORDER'. "Internal Table name
*wa_fieldcat-fieldname = 'KUNNR'. "Field Name
*wa_fieldcat-key = 'X'. "Output is in Blue color
*wa_fieldcat-ref_tabname = 'VBAK'. "Table which the field is
*there
*wa_fieldcat-ref_fieldname = 'KUNNR'. "Field Name
*wa_fieldcat-seltext_m = 'Customer No'. "Header Text
*append wa_fieldcat to it_fieldcat.
endform. " field_catalog
&----
*& Form fetch_data
&----
text
----
--> p1 text
<-- p2 text
----
form fetch_data .
select kunnr
a~vbeln
posnr
bstdk
b~netwr
from vbak as a
inner join vbap as b on avbeln = bvbeln
into table it_salesorder
where a~kunnr in s_kunnr
and a~vbeln in s_vbeln.
endform. " fetch_data
&----
*& Form display_data
&----
text
----
--> p1 text
<-- p2 text
----
form display_data .
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 = '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_FIELDCAT = it_fieldcat
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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_salesorder
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_data
form top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listhead
I_LOGO =
I_END_OF_LIST_GRID =
.
endform.
11-20-2007 6:57 AM