Comparing ALV using Function modules and OO ALV
Hi All,
Please provide me what are the advantages of developing ALV using Objects compared to creation using function modules. What are the disadvantages of creating using the conventional FM way.
I have not worked much on ALV using Function modules, have been developing using standard abap classes. I wanted to have an detailed understanding and differences between the two.
Please provide your views on the same.
I have searched SDN forum, but didnt find much information, so it will be of great help if you provide some inputs.
Thanks & Regards,
Navneeth K.
Hello,
Check this link
ALV FUNCTION MODULE AND OBJECT ORIENTED ?
Example programs
http://saplab.blogspot.com/2007/10/sample-abap-program-of-alv-grid-control.html
http://www.abapcode.info/2007/06/object-oriented-alv-using-two.html
Similar Messages
-
Comparing OO ALV and ALV using Function modules
Hi All,
Please provide me what are the advantages of developing ALV using Objects compared to creation using function modules. What are the disadvantages of creating using the conventional FM way.
I have not worked much on ALV using Function modules, have been developing using standard abap classes. I wanted to have an detailed understanding and differences between the two.
Please provide your views on the same.
I have searched SDN forum, but didnt find much information, so it will be of great help if you provide some inputs.
Thanks & Regards,
Navneeth K.Hi, Navneeth,
With ALV functions, you can everything that you would do otherwise with the OOPS ALV. However , I don't think you can possibily have more controls in case of alv function because it occupies the entire screen and the function only calls 2 screens internally ( screen numbers 500 and 700 (for popup alv)).
But with OOPS on the other hand, you can have many controls on one screen, for example, you can have 2 ALV lists, or a splitter control with one of them having a Tree control and the other alv grid/list, pictures etc.
So the sole motive of the function is if you want to display a list, but when developing a serious application, I would go for OOPs ALV.
regards,
Advait -
Please send me some sample codes of ALVS using function modules only
Hi,
i am new to alvs
Please send me some sample codes of alvs using function modules only.
My mail id is [email protected]
Thanks & regards,
hari priyahI
http://www.sapdev.co.uk/reporting/reportinghome.htm SPECIAL FOR ALL ALV PROGRAMS WITH EXAMPLE CODES
Check the below links :
http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
http://www.sap-img.com/abap-function.htm
http://www.sap-basis-abap.com/sapab034.htm
http://www.erpgenie.com/abap/example_code.htm
These all are very simple ALV programs ,good luck
<b>Reward if usefull</b> -
Examples for using function modules and BApis.
My Dear FRNDS,
I am very new to ABAP. And I have read the documentation for function modules but i am not that clear to practice them.So I would be very happy if u people share a little bit of ur experience with me.
Please provide me some examples of all the use cases in function modules and specially exception handling.
Frnds, i am going to work with bapis so i feel practicing function module will give me a edge.
and please tell me after calling a BAPI FM why we have to perform 'BAPI_TRANSACTION_COMMIT' and 'BAPI_TRANSACTION_ROLLBACK'.
.Ur efforts will be greatly rewarded.
thx,
reshaliHi,
Please check this sample codes.
DATA: BAPI_Z05DOGI_DELIVERY LIKE BAPIOBDLVHDRCON-DELIV_NUMB ,
BAPI_Z05DOGI_HEADER_DATA LIKE BAPIOBDLVHDRCON OCCURS 0 WITH HEADER LINE ,
BAPI_Z05DOGI_HEADER_CONTROL LIKE BAPIOBDLVHDRCTRLCON OCCURS 0 WITH HEADER LINE,
BAPI_Z05DOGI_ITEM_DATA LIKE BAPIOBDLVITEMCON OCCURS 0 WITH HEADER LINE,
BAPI_Z05DOGI_ITEM_CONTROL LIKE BAPIOBDLVITEMCTRLCON OCCURS 0 WITH HEADER LINE ,
BAPI_Z05DOGI_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE .
CLEAR: BAPI_Z05DOGI_DELIVERY , BAPI_Z05DOGI_HEADER_DATA , BAPI_Z05DOGI_HEADER_CONTROL , BAPI_Z05DOGI_ITEM_DATA ,BAPI_Z05DOGI_ITEM_CONTROL , BAPI_Z05DOGI_RETURN .
REFRESH: BAPI_Z05DOGI_HEADER_DATA , BAPI_Z05DOGI_HEADER_CONTROL , BAPI_Z05DOGI_ITEM_DATA , BAPI_Z05DOGI_ITEM_CONTROL , BAPI_Z05DOGI_RETURN .
BAPI_Z05DOGI_DELIVERY = ZMM_WB1-ISSUE .
BAPI_Z05DOGI_HEADER_DATA-DELIV_NUMB = ZMM_WB1-ISSUE.
APPEND BAPI_Z05DOGI_HEADER_DATA.
BAPI_Z05DOGI_HEADER_CONTROL-DELIV_NUMB = ZMM_WB1-ISSUE.
BAPI_Z05DOGI_HEADER_CONTROL-POST_GI_FLG = 'X'.
APPEND BAPI_Z05DOGI_HEADER_CONTROL.
BAPI_Z05DOGI_ITEM_DATA-DELIV_NUMB = ZMM_WB1-ISSUE.
BAPI_Z05DOGI_ITEM_DATA-DELIV_ITEM = 10.
BAPI_Z05DOGI_ITEM_DATA-DLV_QTY = LFIMGGIA.
BAPI_Z05DOGI_ITEM_DATA-SALES_UNIT = XTAB-MEINS.
BAPI_Z05DOGI_ITEM_DATA-DLV_QTY_IMUNIT = LFIMGGIA.
BAPI_Z05DOGI_ITEM_DATA-FACT_UNIT_NOM = UMVKZLIPS.
BAPI_Z05DOGI_ITEM_DATA-FACT_UNIT_DENOM = UMVKNLIPS.
APPEND BAPI_Z05DOGI_ITEM_DATA.
BAPI_Z05DOGI_ITEM_CONTROL-DELIV_NUMB = ZMM_WB1-ISSUE.
BAPI_Z05DOGI_ITEM_CONTROL-DELIV_ITEM = 10.
BAPI_Z05DOGI_ITEM_CONTROL-CHG_DELQTY = 'X'.
APPEND BAPI_Z05DOGI_ITEM_CONTROL.
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CONFIRM_DEC'
EXPORTING
DELIVERY = BAPI_Z05DOGI_DELIVERY
HEADER_DATA = BAPI_Z05DOGI_HEADER_DATA
HEADER_CONTROL = BAPI_Z05DOGI_HEADER_CONTROL
TABLES
ITEM_DATA = BAPI_Z05DOGI_ITEM_DATA
ITEM_CONTROL = BAPI_Z05DOGI_ITEM_CONTROL
RETURN = BAPI_Z05DOGI_RETURN.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPI_Z05DOGI_RETURN.
Go thru this link
http://www.planetsap.com/LIST_ALL_BAPIs.htm
BAPI_TRANSACTION_COMMIT
Execute external Commit when using BAPIs
This method executes a COMMIT WORK command. It is required for
transactions developed externally to the R/3 System that change data in
the R/3 System via BAPI calls.
When you call BAPIs in your program that change data in the R/3 System,
afterwards you must call this method to write the changes to the
database.
COMMIT WORK
The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the currenta SAP LUW in the process
there are some FM that we use for creating trasaction . for example FM : that use for creating production order . if you execut the FM , the system will not create any data in the system so you need to excute the FM : BAPI_TRANSACTION_COMMIT to commit that creating the production order .
in case of commit work, that is a syntax in abap program . if you use this syntax after you insert ,update or delete table in the sap ,system will do it immediately otherwise the system will do it after execution is complete.
ROLLBACK WORK.
for confirming or undoing database updates. COMMIT WORK always concludes a database LUW and starts a new one. ROLLBACK WORK always undoes all changes back to the start of the database LUW.
Regards,
Raj. -
Generic extraction using function module and view
hi every one ,
iam new to bw and can anyone plz tell me how to extract the data from R/3 to bw using generic extractor by creating function module and a view
thank u,
kishoreHi Kishore,
Check this blog:
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Also Check this doc:
http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/frameset.htm
Generic Extractors
Generic data sources
Generic DS
Bye
Dinesh -
Grouping and Page Break in ALV using Function Modules
Hi all,
I am trying to develop an ALV Report that will be grouped by vendor, some vendor information to be displayed on header. And, after each vendor;s records there should be a page break.
It should be something like this:
Vendor Number: 00012345454
Vendor Name: ABC Technologies, Inc
Vendor Country: USA
Item....Price...... Descriptopm
123....100,00......this is description
124....120.00......this is another description
PAGE BREAK
Vendor Number: 000123456545
Vendor Name: My Bank
Vendor Country: USA
Item....Price..... Descriptopm
223....32,00......this is my description
224....120.00......this is another description
Can anybody give some sample code for it ? I have tried a few codes from web, but they are not working.
Thanks.Hi,
Try the following:
1. Build your sorting criteria. Pass this to ALV FM.
gs_sort-fieldname = 'VENDOR'.
gs_sort-group = '*'. "new page
gs_sort-up = 'X'.
APPEND gs_sort TO gt_sort.
2. Add event group level change. Pass this to ALV FM
gs_event-name = 'GROUPLEVEL_CHANGE'.
gs_event-form = 'GROUPLEVEL_CHANGE'.
APPEND gs_event TO gt_event.
Inside the form, retrieve your vendor details.
FORM grouplevel_change USING gs_lineinfo
gs_groups TYPE kkblo_grouplevels.
DATA: l_index TYPE i.
IF gs_groups-level = 1.
l_index = gs_groups-index_to + 1.
READ TABLE gt_display INDEX l_index INTO gw_display.
ENDIF.
3. In the event top-of-page, display vendor details using write statements. For the first record, your structure (gw_display) will be blank, read from your data table first
FORM top_of_page.
IF gw_display IS INITIAL.
READ TABLE gt_display INDEX 1 INTO l_display.
IF sy-subrc = 0.
WRITE: / l_display-vendor
ENDIF.
ELSE.
WRITE: / gw_display-vendor.
CLEAR: gw_display.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fcat[]
it_sort = gt_sort[]
i_save = 'A'
it_events = gt_event
TABLES
t_outtab = gt_display[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hope this helps. -
How do I insert a logo in ALV using Function Modules?
hai !
i want to display the logo on the grid .
can any one suggest me which function i should use?
any help will be appreciated.Hi,
Look at the sample code to display LOGO.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND_PERNR'
it_fieldcat = header
is_layout = gt_layout
i_callback_top_of_page = 'TOP-OF-PAGE1'
i_grid_title = xyz
it_sort = gt_sort[]
i_default = 'X'
i_save = 'U'
is_variant = gt_variant
it_events = gt_events
tables
t_outtab = t_output.
clear t_output.
Form TOP-OF-PAGE1
form top-of-page1.
data: header type slis_t_listheader,
wa type slis_listheader. "infield like wa-info, nline type n.
TITLE AREA
wa-typ = 'S'.
wa-info = text-h04.
append wa to header.
wa-typ = 'S'.
write sy-datum to wa-info mm/dd/yyyy.
concatenate text-h03 wa-info into wa-info separated by space.
append wa to header.
wa-typ = 'S'.
concatenate text-h02 sy-uname into wa-info separated by space.
append wa to header.
wa-typ = 'S'.
concatenate text-h01 sy-repid into wa-info separated by space.
append wa to header.
********" LOGO
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = header
i_logo = 'ENJOYSAP_LOGO'.
*********" LOGO
endform.
Here in TOP-OF-PAGE form it will show you the Prog name,Date, User Name.
Just you need to give the text in it.
You can refer the below link also.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
Thanks.
If this helps you reward with points.
Message was edited by: KDeepak -
Hi,
We have a requirement to create a BI report based on plant maintenance report. The plant maintenance report is based on a ABAP program with complex logic. My question is i want create a Generic Datasource using Function module and can I include the logic(Abap Program) that is used for plant maintenance report in the function module? Please share your thoughts.
Thanks,
RaviHi,
Step1-Create a table structure which you need to create same as the fields you require in you data source.
Step 2-create a custom abap program and inside that call the Client abap program with the selections as required and save the result data in some table
Step 3-create infoset query.In the infoset query give your table structure name and program name which you developed.
Step4-create data source on top of that query -
In Generic Extraction why do we use FUNCTION MODULES over VIEWS
(when do we use Function modules and views).Views are ideal source of dat when you can join tables with ease and you can ensure uniqueness of records from the view.
On the other hand, if the extraction is too complex and to check more conditions and checks, then function module.
Also in FM, you can control the data to be extracted.
Ravi Thothadri -
Delta with Generic Extractor using function module
Hi,
I have created an extractor using function module and it work fine (mode FULL)
It's an extractor based on the FM RSAX_BIW_GET_DATA_SIMPLE.
In TCODE RSO2, I have specified a delta field (AEDAT).
In table ROOSOURCE, this extractor is defined by :
DELTA = AIE
EXMETHOD = F1
When I extract data in Init mode, there is no problem. But delta don't extract any entries.
When I trace with TCODE ST01, in Init mode the function module is executed but in delta mode, there is no trace of any use of this function module.
I don't know how to do to make this extractor work fine in delta mode.Hi Pascal,
The same function module i have used and succesffuly doing delta using it. So it works for both full & delta.
How ur testing it and where are you testing it for delta.
Do the delta testing through BI end. Set the
As u have already set the delta field., now Follow below steps:
1. First set the safety interval upper limit to -1, so that it will extract the delta data of 1 day back records also.
2. Please make sure wether the delta records are available or not in r/3, if there is no records to be fetched in for delta then u will not be able to track out wether delta is working or not.
3. Now do the init from BI end first. Delta initialization without data transfer. - It will give u green status with 1 dummmy record.
4. Now do the delta. It will extract the delta records.
Before that make sure that if any selection your giving in Infopackage should be met out by these delta records.
Thanks
Dipika -
Crystal Reports Based on SAP Function Module and Transperant Tables
Hi,
I need to develop reports based on SAP trasperant tables and to filter the records I require to use one of the function module in SAP.
I have created parameters in Crystal reports that are required for the function to execute and are included in the where clause of the query. This helped the fuction to get those parameters and execute it.
The thing is that the fuction works fine with one set of parameters and gives accurate results both in SAP and Crystal Reports.
But fails for other set of parameters.
It works fine when we directly execute function in SAP produces a record set. But, when we pass those parameters from Crystal Reports it fetches no data.
Can anybody tell me the exact procedure to use function module and transperent tables together in Crystal Reports ?
Thanks in Advance.
Niwas JoshiHi,
This is going to be hard to explain, however you need to recognize that the function has input and possibly output (export) parameters. Crystal Reports is able to work with these parameters. However it is up to you to figure out how these parameters are used effectively to give you the correct results when joining the function with other data sources such as transparent tables.
If you're using transparent tables and functions in a Crystal Report, then you need to link these objects in such a way so that a left outer join for example is using the function's output parameters to join to the transparent table equivalent fields. However if the table is the starting point then the joins from the table should join the Input parameters of your function.
you can set these joins in the Database menu | Database Expert | Links of Crystal Reports. -
Example of a Simple ALV Report using Function Modules (not OO)
Hi,
I am new to ABAP. Where can I get a proper Example of a Simple ALV Report using Function Modules? I searched the forum but did not find a proper solution. Kindly help.
Smruthi.
Edited by: Smruthi Acharya on Jan 29, 2009 7:13 PMHi,
Use this demo code:-
REPORT z_alv01 MESSAGE-ID zmsg.
* TABLES
TABLES : ekpo.
* TYPE POOLS
TYPE-POOLS : slis.
* TYPE DECLARATION
TYPES : BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
menge TYPE ekpo-menge,
END OF t_ekpo.
* PARAMETERS
PARAMETERS : s_var TYPE disvariant-variant.
* DATA DECLARATION
*VARIABLES
DATA : check(1),
rep_id TYPE sy-repid.
*INTERNAL TABLE TYPE OF ZEKPO
DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE.
*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv,
wa_field TYPE slis_fieldcat_alv.
*SORTING
DATA : it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
*FOR TOP OF THE PAGE
DATA : it_top TYPE slis_t_listheader,
wa_top TYPE slis_listheader.
*FOR END OF THE PAGE
DATA : it_end TYPE slis_t_listheader,
wa_end TYPE slis_listheader.
*TO CAPTURE EVENTS AND HANDLE
DATA : it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event.
*FOR GRID TITLE
DATA : wa_title TYPE lvc_title.
*FOR LAYOUT
DATA : wa_layout TYPE slis_layout_alv.
*FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
DATA : it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab.
*FOR VARIANT
DATA : wa_variant TYPE disvariant.
* INITIALIZATION
INITIALIZATION.
check = 'X'.
rep_id = sy-repid.
wa_variant-report = sy-repid.
*GET DEFUALT ON THE SELECTION SCREEN FOR DEFAULT DISPLAY
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = wa_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0. " IF DEFAULT VARIANT FOUND
s_var = wa_variant-variant. " PASS THE DEFAULT VARIANT TO THE SELECTION SCREEN FIELD
ENDIF.
* AT-SELECTION SCREEN ON VALUE REQUEST
* TO GET THE F4 HELP FOR VARIANT
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = wa_variant
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
i_save = 'A'
* I_DISPLAY_VIA_GRID = ' '
IMPORTING
* E_EXIT =
es_variant = wa_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
s_var = wa_variant-variant. " PASS THE SELECTED VARIANT TO THE SELECTION SCREEN FIELD
ENDIF.
* AT-SELECTION SCREEN
* TO CHECK THE EXISTENCE FOR VARIANT
AT SELECTION-SCREEN.
wa_variant-variant = s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = wa_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE w001.
ENDIF.
* START OF SELECTION
START-OF-SELECTION.
SELECT ebeln
ebelp
matnr
werks
menge
FROM ekpo
INTO TABLE it_ekpo.
* FIELD CATALOG
wa_field-fieldname = 'EBELN'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'PO #'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'EBELP'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Line Item'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MATNR'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 15.
wa_field-seltext_l = 'Material'.
* wa_field-input = check.
* wa_field-edit = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'WERKS'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 6.
wa_field-seltext_l = 'Plant'.
* wa_field-input = check.
* wa_field-edit = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MENGE'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Qty.'.
* wa_field-input = check.
* wa_field-edit = check.
wa_field-do_sum = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
* SORT W.R.T. PURCHASE ORDER NUMBER
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = check.
wa_sort-subtot = check.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
* FOR GRID TITLE
wa_title = 'Hello'.
* FOR LAYOUT
wa_layout-zebra = check.
* FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
wa_exclude-fcode = '&OUP'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&ODN'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&OAD'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
* wa_exclude-fcode = '&AVE'.
* APPEND wa_exclude TO it_exclude.
* CLEAR wa_exclude.
wa_exclude-fcode = '&INFO'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
* POPULATE ALL EVENTS INTO INTERNAL TABLE
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 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.
READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
wa_event-form = 'END'.
MODIFY it_event FROM wa_event INDEX sy-tabix.
CLEAR wa_event.
* DISPLAY RECORDS IN ALV GRID
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = rep_id
* i_callback_pf_status_set = 'PF'
i_callback_user_command = '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 = wa_title
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_field
it_excluding = it_exclude
* IT_SPECIAL_GROUPS =
it_sort = it_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'A'
is_variant = wa_variant
it_events = it_event
* 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_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form top
* TO WRITE THE HEADER
FORM top.
REFRESH it_top.
wa_top-typ = 'S'.
wa_top-key = text-001.
wa_top-info = rep_id.
APPEND wa_top TO it_top.
CLEAR wa_top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_top
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "top
*& Form end
* TO WRITE THE FOOTER
FORM end.
REFRESH it_end.
wa_end-typ = 'S'.
wa_end-key = text-001.
wa_end-info = rep_id.
APPEND wa_end TO it_end.
CLEAR wa_end.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_end
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "end
*& Form pf
* FOR PF-STATUS WITH USER DEFINED BUTTONS
* -->RT_EXTAB text
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_PF_ALV'.
ENDFORM. "pf
*& Form command
* TO HANDLE USER ACTIONS AGAINST PF-STATUS
* -->UCOMM text
* -->SELFIELD text
FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA : ok_code TYPE sy-ucomm.
ok_code = ucomm.
CASE ok_code.
WHEN 'T_DOWN'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'TOTAL DOWN'.
WHEN 'DOWN'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'DOWN'.
WHEN 'UP'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'UP'.
WHEN 'T_UP'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'TOTAL UP'.
ENDCASE.
ENDFORM. "command
Hope this helps you.
Thanks & Regards,
Tarun Gambhir -
What is the difference b/w ALV Function Module and ALV Methods?
Hello Friends,
Can anybody help me in finding out the difference between ALV Function Modules and ALV methods?
Thanks & Regards
Sathish KumarHi Sathish,
Plz go through this info. It is very useful.
hi,
chk these excellent links.
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
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
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
OOPs:
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
Rewords some points if it is helpful.
Rgds,
P.Naganjana Reddy -
HOW TO USE FUNCTION MODULE IN ALV
hi guyz
I developed an alv report using join statements .But i got all that fields in a function module. so how can i use function module in alv .
if i got a function module with all the fileds do i need to use select statement.
plz help me.
thanks
sudheerHi,
Hope the following helps..
1)
LOOP AT IT_OUTPUT.
Call the function module to get the tracking number and store the output in the
variable V_TRACKINGNO.
IT_OUTPUT-TRACKING_NO = V_TRACKINGNO.
MODIFY IT_OUTPUT TRANSPORTING TRACKING_NO.
ENDLOOP.
2) Date conversion
DATA: V_CHAR(10) VALUE '2006.11.17'.
DATA: V_DATE TYPE SYDATUM.
CONCATENATE V_CHAR(4) V_CHAR5(2) V_CHAR8(2) INTO V_DATE.
WRITE: V_DATE TO V_CHAR MM/DD/YYYY.
WRITE: / 'MM/DD/YYY Format - ', V_CHAR.
Please make sure to reward points for helpful answers..
Thanks,
Naren -
How to edit ALV report using function modules
I have a ALV report , i want to edit the report
using function modules.
how can i do that...
Edited by: ms kumar on Mar 6, 2008 3:24 PMhi i had used this report with the check box,
using the fm of alvs.....
*& Report ZZZ00
REPORT ZPR_02.
TYPE-POOLS: SLIS.
TABLES:pa0002,pa0008.
data:begin of it_pa0002 occurs 0,
checkbox,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
end of it_pa0002.
data:begin of it_pa00021 occurs 0,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
expand TYPE xfeld value 'X',
end of it_pa00021.
data:begin of it_pa0008 occurs 0,
pernr like pa0008-pernr,
begda like pa0008-begda,
endda like pa0008-endda,
ANSAL like pa0008-ANSAL,
LGA01 like pa0008-LGA01,
BET01 LIKE PA0008-BET01,
end of it_pa0008.
DATA: IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELD_CAT1 TYPE SLIS_T_FIELDCAT_ALV,
IT_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,
WA_FIELD_CAT1 TYPE SLIS_FIELDCAT_ALV,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
wa_keyinfo TYPE slis_keyinfo_alv.
CONSTANTS:c VALUE 'X'.
SELECT-OPTIONS: S_pernr FOR pa0002-pernr.
START-OF-SELECTION.
SET PF-STATUS 'DATA' .
PERFORM GET_DATA.
PERFORM BUILD_FIELD_CAT.
PERFORM GET_EVENTS.
PERFORM DISPLAY_DATA.
*& Form get_data
text
FORM GET_DATA .
SELECT pernr
begda
endda
vorna
nachn
FROM pa0002
INTO CORRESPONDING FIELDS OF TABLE IT_pa0002
WHERE pernr IN S_pernr.
ENDFORM. " get_data
*& Form build_field_cat
text
FORM BUILD_FIELD_CAT .
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'CHECKBOX'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Check Box'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'PERNR'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Personnel no'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'BEGDA'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Start date'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'ENDDA'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'End date'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'VORNA'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'First name'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'NACHN'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Last name'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'PERNR'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'Personnel no'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'BEGDA'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'Start date'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'ENDDA'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'End date'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'VORNA'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'First name'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'NACHN'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'Last name'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'PERNR'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'personnelno'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'BEGDA'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'begindate'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'ENDDA'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'enddate'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'ANSAL'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'annualsalary'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'LGA01'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'wagetype'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'BET01'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'Amount'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
ENDFORM. " build_field_cat
*& Form display_data
text
FORM DISPLAY_DATA .
it_layout-box_fieldname = 'CHECKBOX'.
it_layout-EDIT = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELD_CAT
IS_LAYOUT = IT_LAYOUT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_pa0002.
ENDFORM. " display_data
*& Form get_events
text
FORM GET_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
IMPORTING
ET_EVENTS = IT_EVENTS .
READ TABLE IT_EVENTS INTO WA_EVENTS
WITH KEY NAME = SLIS_EV_TOP_OF_PAGE.
IF SY-SUBRC = 0.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM. " get_events
*& Form top_of_page
text
FORM TOP_OF_PAGE.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'EMPLOYEE DATA'.
APPEND WA_HEADER TO IT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADER
ENDFORM. "top_of_page
*& Form GUI_SET
FORM GUI_SET USING RT_EXTAB TYPE SLIS_T_EXTAB .
SET PF-STATUS 'DATA' .
ENDFORM. "GUI_SET
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
DATA:V_PERNR LIKE PA0002-PERNR.
CASE R_UCOMM.
WHEN 'DET'.
DATA: V_FLAG.
clear : v_flag.
LOOP AT IT_PA0002.
if it_PA0002-checkbox = 'X'.
v_flag = 'X'.
v_pernr = IT_PA0002-PERNR.
SELECT PERNR
BEGDA
ENDDA
VORNA
NACHN
FROM PA0002
INTO CORRESPONDING FIELDS OF TABLE IT_PA00021
WHERE PERNR = V_PERNR.
SORT IT_PA00021 BY PERNR.
DELETE ADJACENT DUPLICATES FROM IT_PA00021 COMPARING PERNR.
READ TABLE IT_PA00021 INDEX 1.
SELECT PERNR
BEGDA
ENDDA
ANSAL
LGA01
BET01
FROM PA0008
INTO TABLE IT_PA0008
FOR ALL ENTRIES IN IT_PA00021
WHERE PERNR = IT_PA00021-PERNR.
if not it_PA0008[] Is initial.
SORT IT_PA0008 BY PERNR.
delete adjacent duplicates from it_PA0008 comparing pernr.
READ TABLE IT_PA0008 INDEX 1.
endif.
endif.
enddo.
it_layout1-group_change_edit = c.
it_layout1-colwidth_optimize = c.
it_layout1-zebra = c.
it_layout1-detail_popup = c.
it_layout1-get_selinfos = c.
it_layout-expand_fieldname = 'EXPAND'.
wa_keyinfo-header01 = 'PERNR'.
wa_keyinfo-item01 = 'PERNR'.
IF NOT V_FLAG IS INITIAL.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = IT_LAYOUT1
IT_FIELDCAT = IT_FIELD_CAT1
I_TABNAME_HEADER = 'PA0002'
I_TABNAME_ITEM = 'PA0008'
IS_KEYINFO = wa_keyinfo
TABLES
T_OUTTAB_HEADER = IT_PA00021
T_OUTTAB_ITEM = IT_PA0008.
ENDIF.
CLEAR: IT_PA00021,IT_PA0002,IT_PA0008.
ENDLOOP.
WHEN 'BACK'.
EXIT.
ENDCASE.
ENDFORM. "USER_COMMAND
reward points if useful,
venkat.
Maybe you are looking for
-
I started using my external monitor with my macbook pro and as soon as I plug it in it to the monitor it adjusts the screen by zooming out a bit and creating about 3/4 of an inch black borders on the top and bottom of the screen. But these dont show
-
Analog to Digital conversion of hi8 tapes
I have many hi8 video tapes that I have been trying to digitize so that I can import them into my imac. I have connected my analog hi8 camera to a Sony DSC-PC350 mini dv camcorder that has an analog to digital converter (pass through). In the VTR mod
-
Why am i having sim card issues
This happened before, but stopped. Now it is back with a vengeance
-
IPhone 4S back camera doesn't work
This is my second iPhone 4S that I have gotten and put on the ios 7 updates. On both the devices the back camera does not work. The app comes up black. Sometimes I can switch to use the front camera, but not always. Verizon is sending me a third phon
-
Creating fields as LOV (using alternate names) on OTL timecards
Hi, I would really appreciate if someone can help me understand the process of being able to add fields on OTL timecard as LOV fields using alternate names. These are COST segments which I need to add on OTL timecard. The part which is most confusing