ALV Events in Header

In my OO ABAP ALV report i use containers.
So in my Top of page or in the header, I display a URL using the method
CALL METHOD p_dyndoc_id->add_link
EXPORTING
url = 'www.google.com'
text = l_text.
So when the user clicks on this URL, how to catch the ON_CLICK event.
Can anyone pls help me with an example?
Pls help
Thanks
Ram

Hi Prabha,
Good ... Check out the following documentation and examples
Events in alv and their FM
Please tell me what are the main events in alv and their FM and
why we use these:
1. SLIS_PRINT_ALV.
2. SLIS_T_LISTHEADER.
3. SLIS_T_EVENT.
4. SLIS_T_SORTINFO_ALV.
5. SLIS_T_LAYOUT_ALV.
6. SLIS_T_FIELDCAT_ALV.
and in classic reports what is the sequence of events:
=== Events are
At selection-screen output.
Initialization.
At selection-screen on field
At selection-screen on end of field
At selection-screen on Radiobutton Group R1. (If you have any radio buttons)
At selection-screen on block b1. (If you have any blocks)
Start-of-selection.
Get node. (if the data is retreived from a logical database)
Get node late. (if the data is retreived from a logical database)
Top-of-page. (if the write statement is in the end-of-selection event or we can say that before the first write statement)
end-of-selection.
and fuction modules are
LISTHEADER - Is used to print the header information in the ALV List. Name, Date, Time, ALV Name and other details are called as Header information.
EVENT - Basically this is the FM to handle Event's. When the user needs to do some event operation like when double clicking the a particular field we need to perform some operation.
These events are captured by this FM.
LAYOUT - This FM is used to define the layout of the List. There are many options available in this FM to define the Layout style.
FIELDCAT - These are used to populate the List header. We can change them according to our req.
These are some of the FM. I hope it is useful.
Check out the following links
http://www.sap-basis-abap.com/sapabap01.htm
Sample programs on ALV Grid
report zbnstest.
TABLES AND DATA DECLARATION.
*TABLES: mara,makt.",marc.
data syrepid like sy-repid.
data sydatum(10). " LIKE sy-datum.
data sypagno(3) type n.
WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
GROUP (TYPE-POOLS--------->SLIS)
type-pools : slis.
INTERNAL TABLE DECLARATION.
INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
data: begin of t_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
matkl like mara-matkl,
end of t_mara.
INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
data : begin of t_marc occurs 0,
matnr like mara-matnr,
werks like marc-werks,
minbe like marc-minbe.
data: end of t_marc.
INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
data : begin of t_makt occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
spras like makt-spras,
end of t_makt.
INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
data: begin of itab1 occurs 0,
matnr like mara-matnr,
meins like mara-meins,
maktx like makt-maktx,
spras like makt-spras,
werks like marc-werks,
minbe like marc-minbe,
end of itab1.
THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
AND THE LAYOUT FOR THE ALV.
HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
THIS IS DONE TO MAKE THE CODE SIMPLER.
OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
PROGRAMS.
IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
MORE TABLES AND CREATE A STRUCTURE
IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
data: fieldcatalog type slis_t_fieldcat_alv with header line,
fieldlayout type slis_layout_alv.
DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
TOP-OF-PAGE ETC.
data : eventstab type slis_t_event with header line.
DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
data : heading type slis_t_listheader with header line.
data : heading1 type slis_t_listheader with header line.
data : heading2 type slis_t_listheader with header line.
data : heading3 type slis_t_listheader with header line.
data : heading4 type slis_t_listheader with header line.
data : heading5 type slis_t_listheader with header line.
data : heading6 type slis_t_listheader with header line.
data : heading7 type slis_t_listheader with header line.
data : heading8 type slis_t_listheader with header line.
STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
data : colorstruct type slis_coltypes.
INITIALIZATION. *
initialization.
syrepid = sy-repid.
sypagno = sy-pagno.
clear fieldcatalog.
START-OF-SELECTION. *
start-of-selection.
SUBROUTINE TO POPULATE THE COLORSTRUCT
perform fill_colorstruct using colorstruct.
SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
perform populate_fieldcatalog.
SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
INTERNAL TABLE.
perform selectdata_and_sort.
SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
perform populate_layout using fieldlayout.
SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
perform merge_fieldcatalog.
SUBROUTINE TO POPULATE THE EVENTSTAB.
perform fill_eventstab tables eventstab.
SUBROUTINE TO POPULATE THE HEADING TABLES.
perform fill_headingtable tables heading using 'HEADING'.
perform fill_headingtable tables heading1 using 'HEADING1'.
perform fill_headingtable tables heading2 using 'HEADING2'.
perform fill_headingtable tables heading3 using 'HEADING3'.
perform fill_headingtable tables heading4 using 'HEADING4'.
perform fill_headingtable tables heading5 using 'HEADING5'.
perform fill_headingtable tables heading6 using 'HEADING6'.
perform fill_headingtable tables heading7 using 'HEADING7'.
perform fill_headingtable tables heading8 using 'HEADING8'.
SUBROUTINE TO DISPLAY THE LIST.
perform display_alv_list.
FORMS
IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
COLUMN JUSTIFICATION.
form populate_fieldcatalog.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATNR' 'X' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MEINS' ' '.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MAKTX' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MTART' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATKL' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'SPRAS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'WERKS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MINBE' ' ' .
endform. " POPULATE_FIELDCATALOG
FORM FILL_FIELDS_OF_FIELDCATALOG *
--> FIELDCATALOG *
--> P_TABNAME *
--> P_FIELDNAME *
--> P_KEY *
--> P_KEY *
form fill_fields_of_fieldcatalog tables fieldcatalog
structure fieldcatalog
using p_tabname
p_fieldname
p_key.
p_no_out.
fieldcatalog-tabname = p_tabname.
fieldcatalog-fieldname = p_fieldname.
fieldcatalog-key = p_key.
fieldcatalog-emphasize = '1234'.
*fieldcatalog-no_out = p_no_out.
append fieldcatalog.
endform. " FILL_FIELDSOFFIELDCATALOG
FORM POPULATE_LAYOUT *
--> FIELDLAYOUT *
form populate_layout using fieldlayout type slis_layout_alv.
fieldlayout-f2code = '&ETA' .
fieldlayout-zebra = 'X'.
FOR THE WINDOW TITLE.
fieldlayout-window_titlebar = 'ALV with Events'.
fieldlayout-colwidth_optimize = 'X'.
fieldlayout-no_vline = ' '.
*fieldlayout-no_input = 'X'.
fieldlayout-confirmation_prompt = ''.
fieldlayout-key_hotspot = 'X'.
This removes the column headings if the flag is set to 'X'
fieldlayout-no_colhead = ' '.
*fieldlayout-hotspot_fieldname = 'MAKTX'.
fieldlayout-detail_popup = 'X'.
fieldlayout-coltab_fieldname = 'X'.
endform. " POPULATE_LAYOUT
FORM SELECTDATA_AND_SORT *
form selectdata_and_sort.
select matnr meins mtart matkl from mara
into corresponding fields of t_mara
up to 500 rows .
select matnr maktx spras from makt
into corresponding fields of t_makt
where matnr = t_mara-matnr and
spras = sy-langu.
select matnr werks minbe from marc
into corresponding fields of t_marc
where matnr = t_mara-matnr.
append t_marc.
endselect.
append t_makt.
endselect.
append t_mara.
endselect.
perform populate_itab1.
sort itab1 by matnr.
endform. " SELECTDATA_AND_SORT
FORM MERGE_FIELDCATALOG *
form merge_fieldcatalog.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = syrepid
i_internal_tabname = 'ITAB1'
i_structure_name = 'COLORSTRUCT'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = syrepid
changing
ct_fieldcat = fieldcatalog[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
endform. " MERGE_FIELDCATALOG
IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
FOLLOWS:-
i_callback_program --> CALLING PROGRAM NAME
i_structure_name --> STRUCTURE NAME.
is_layout --> LAYOUT NAME.
it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
form display_alv_list.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
i_callback_program = syrepid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_structure_name = 'ITAB1'
is_layout = fieldlayout
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
TOOL BAR
i_save = 'A'
IS_VARIANT = ' '
it_events = eventstab[]
IT_EVENT_EXIT =
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = itab1
exceptions
program_error = 1
others = 2.
endform. " DISPLAY_ALV_LIST
*& Form POPULATE_ITAB1
text
--> p1 text
<-- p2 text
form populate_itab1.
loop at t_mara.
loop at t_makt where matnr = t_mara-matnr.
loop at t_marc where matnr = t_mara-matnr.
move-corresponding t_mara to itab1.
move-corresponding t_makt to itab1.
move-corresponding t_marc to itab1.
append itab1.
endloop.
endloop.
endloop.
endform. " POPULATE_ITAB1
*& Form FILL_EVENTSTAB
text
-->P_EVENTSTAB text *
form fill_eventstab tables p_eventstab structure eventstab.
WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
EVENTS NAME.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_eventstab[]
exceptions
list_type_wrong = 1
others = 2.
BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
IS DYNAMICALY CALLED.
read table p_eventstab with key name = slis_ev_top_of_page.
if sy-subrc = 0 .
move 'TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_coverpage.
if sy-subrc = 0 .
move 'TOP_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_coverpage .
if sy-subrc = 0 .
move 'END_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_top_of_page.
if sy-subrc = 0 .
move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_end_of_page.
if sy-subrc = 0 .
move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_list_modify.
if sy-subrc = 0 .
move 'LIST_MODIFY' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_list.
if sy-subrc = 0 .
move 'TOP_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_page.
if sy-subrc = 0 .
move 'END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_list .
if sy-subrc = 0 .
move 'END_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
endform. " FILL_EVENTSTAB
*& Form FILL_HEADINGTABLE
text
-->P_HEADING text *
form fill_headingtable tables p_heading structure heading
using tablename.
case tablename.
when 'HEADING'.
p_heading-typ = 'H'.
concatenate
' REPORT NAME:-' syrepid
' ABB Industry Pte Ltd' into p_heading-info.
append p_heading.
write sy-datum using edit mask '__/__/____' to sydatum.
concatenate
' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
into p_heading-info.
append p_heading.
when 'HEADING1'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-COVER-PAGE'.
append p_heading.
when 'HEADING2'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-COVER-PAGE'.
append p_heading.
when 'HEADING3'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
append p_heading.
when 'HEADING4'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-END-OF-PAGE'.
append p_heading.
WHEN 'HEADING5'.
P_HEADING-TYP = 'H'.
P_HEADING-INFO = 'LIST-MODIFY'.
APPEND P_HEADING.
when 'HEADING6'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-PAGE'.
append p_heading.
when 'HEADING7'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-LIST'.
append p_heading.
when 'HEADING8'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-LIST'.
append p_heading.
endcase.
endform. " FILL_HEADINGTABLE
FORM TOP_OF_PAGE *
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading[]
exceptions
others = 1.
endform.
*& Form FILL_COLORSTRUCT
text
-->P_COLORSTRUCT text *
form fill_colorstruct using p_colorstruct type slis_coltypes .
p_colorstruct-heacolfir-col = 6.
p_colorstruct-heacolfir-int = 1.
p_colorstruct-heacolfir-inv = 1.
endform. " FILL_COLORSTRUCT
FORM TOP_OF_COVERPAGE *
form top_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading1[]
exceptions
others = 1.
endform.
FORM END_OF_COVERPAGE *
form end_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading2[]
exceptions
others = 1.
endform.
FORM FOREIGN_TOP_OF_PAGE *
form foreign_top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading3[]
exceptions
others = 1.
endform.
FORM FOREIGN_END_OF_PAGE *
form foreign_end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading4[]
exceptions
others = 1.
endform.
FORM LIST_MODIFY *
*FORM LIST_MODIFY.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEADING5[]
EXCEPTIONS
OTHERS = 1.
*ENDFORM.
FORM END_OF_PAGE *
form end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading6[]
exceptions
others = 1.
endform.
FORM END_OF_LIST *
form end_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading7[]
exceptions
others = 1.
endform.
FORM TOP_OF_LIST *
form top_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading8[]
exceptions
others = 1.
endform.
*--- End of Program
Good Luck and thanks
AK

Similar Messages

  • In ALV Report output heading is printing twice.

    Hi Experts,
    Im working on ALV Reports.
    Im printing header text by using listheader and commentary write function module.
    the problem is when i sort any column in ALV ouput the heading is printing twice.
    Again if i sort the column the heading is printed is 4 times.
    so if anybody knows the solution how we can avoid repetition of heading ,
    Please reply me as soon as possible.
    regards
    Imrangs.

    Hi Noorie,
    Thanks a lot.
    Your answer is perfect.
    Bye.
    Regards,
    Imran

  • ALV Event is malfunctioning

    Hello gurus,
    I created a workbench with an edittable ALV for its data. This ALV has several tabs, lets say 5 tabs with individual event handler declaration. Tabs 1, 2 & 3 shares the same event/class and method declaration. 4&5 shares also the same but different to 1,2, & 3.
    I have events handle data change and button click (for a column of buttons that pops up a screen when pressed), which are both standard toolbar. Then I also have event toolbar for my custom icon and event user command to handle these icons.
    I run my ALV, tabs 1,2 & 3 have their data first. Then I just copy these data going to tab4.
    On tab 4, whenever I click on the standard toolbar 'add row' (+ icon), it adds new row and triggers event handle data change.
    Now my problem is, whenever I click on any other icon that triggers alv event, instead of going to their respective event, it always go to the handle data change event. (i.e. when I click on my custom toolbar icon, instead of going to event user command, it triggers the handle data change. Same with when I click on any buttons under the button columns, it triggers handle data change.)
    Tab 1,2 & 3 works fine. But 4 & 5 are not. They have the same process and coded with the same logic. The only difference I see is that 4 & 5 has handle data change event while 1,2 & 3 have not.
    Please help me analysing what's really causing the issue and what solution to apply to handle this.
    Thanks,
    Sheera

    you need to set the subtotal option only to the dummy field. see the below code related.
      "no need of subtot option here..
      ls_sort-spos = 1.
      ls_sort-fieldname = 'EBELN'.
      ls_sort-tabname = 'ITAB'.
      ls_sort-up = 'X'.
      ls_sort-group = 'UL'.
      APPEND ls_sort TO it_sort.
      CLEAR ls_sort.
      ls_sort-spos = 2.
      ls_sort-fieldname = 'D'.
      ls_sort-tabname = 'ITAB'.
      ls_sort-up = 'X'.
      ls_sort-group = 'UL'.
      ls_sort-subtot = 'X'.           "Only specify here
      APPEND ls_sort TO it_sort.

  • OO Splitter  ALV  grid's  Header  data Download

    Guys ,
       I  have OO Splitter  ALV  grid   but   unable  to  download Upper section( Splitter  ALV ) Header  data .....I  am  only  able  to  download  Lower part  data ...
      How  do  i  download  even  Upper section ( Splitter  ALV ) Header  data ...
      Please   help...OO Splitter  ALV  grid's  Header  data Download

    hi,
    when you use the splitter you cannot download both. You will be to download the data of that container on which you press download functionality. You need to add the button to download and add the logic to it.

  • ALV-Event data_changed after searchhelp with userdefined searchhelpexit

    Hi there ...
    I'm using an OO alv grid with an elementary searchhelp at defined fields.
    the search help uses an searchhelpexit, that simply filters data, to show the right stuff
    everything works fine!
    dependent on the returned value of the searchhelp, I need to trigger a recalculation of values.
    the alv-event "data_changed" looks interesting for that issue ... especially the flag "e_onf4_after" ...
    BUT: I don't know, when the flag is set :$
    the event is raised (with marked flags "e_onf4" and "e_onf4_before") before the Searchhelplist is displayed .... but I need to react AFTER the searchhelp is closed and the selected value is returned ...
    all I want to do is:
    trigger the recalculation after the user selected a value at the searchhelp
    can anybody help me in that case?!
    thanks a lot  & enjoy your weekend
    Markus

    Hi,
    You can call elementary search help like any popup screen
    with function F4IF_FIELD_VALUE_REQUEST.
    - Call f4 help manually in the event DATA_CHANGED
    - Process your recalculation
    - set values on cells..
    I hope it helps.

  • Need docu on alv events with examples

    hi experts,
    Need help on docu in <b>alv events</b> with exam</b>ples
    thanks in advance.

    Hi,
    Check this link..
    http://www.sap-basis-abap.com/abap/events-in-alv-and-their-fm.htm
    go through following links......
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    Re: Performance Optimization for the following Code (URGENT & VERY IMPORTAN
    The main events in alv and their FM and why we use these:
    1. SLIS_PRINT_ALV.
    2. SLIS_T_LISTHEADER.
    3. SLIS_T_EVENT.
    4. SLIS_T_SORTINFO_ALV.
    5. SLIS_T_LAYOUT_ALV.
    6. SLIS_T_FIELDCAT_ALV.
    For more information check the following link:
    http://sap-img.com/abap/what-are-the-events-in-alv.htm
    Regards,
    Omkar.

  • Doubt in Alv Report Coloumn Heading

    Hi Gurus
    I want to print 2 coloumn headings in ALv Report.
    For eg: 1st line coloumn heading contains
                  Name   Number        Date      status
                2nd line coloumn heading contains under status
                              Active      Incative            
    Then if my list size is not enough to show the full details. so i can cut it in 2 lines
        if my list contains 20 coloumns
        i have to put 10 coloumns in first line
        then remaning 10 coloums in second line.
    i want the solution for both the questions.
    Help me.
    Regards.
    Bhuvana.

    For the first issue
    Use Top of Page Event to write a simple list which will act as a header for the alv list.
    Second issue:
    In the fieldcat,
    Position all the first 10 coloums row_pos = 1
    Position all the next 10 coloums row_pos = 2
    Regards,
    Lijo Joseph
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:35 PM

  • ALV Display with header on each page.

    Hi experts,
    I had develop the report which output comes in ALV with heading. While printing the output, suppose there are 60 lines in output and 15 lines on each page so 4 page will print. Now i want the same heading will come on each page.
    Is it possible? if Yes how?
    Pls reply.
    Thanks,
    Abhishek.

    Hi,
    Write the heading in the top-of-page.
    You will have to register the event TOP-OF-PAGE and in the corresponding form write the header.
    Regards,
    Ankur Parab

  • ALV with multiple header & dynamic columns

    Hello All,
    I have a requirement where in I need to print multiple header in alv.
    For eg.
    User Name : <Name_1>
    Channel     : <Channel_1>
    Sale Org    : <Sales Org_1>
    Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
    User Name : <Name_2>
    Channel     : <Channel_2>
    Sale Org    : <Sales Org_2>
    Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
    no of columns (Col1 , col2 )  are dynamic  . Which would be the best alv type do I need do use?  Is it possible using simple alv grid display. How to handle dynamic column.
    Thnx.

    it is not possible with normal grid or list.
    I guess it is possible by using ALV Block list
    Modified below program to get mutiple header
    REPORT z_alv_block_list.
    Type-pools
    TYPE-POOLS: slis.
    Data declarations.
    DATA: BEGIN OF t_vbak OCCURS 0,
            vbeln TYPE vbeln,
            bstnk TYPE vbak-bstnk,
            erdat TYPE vbak-erdat,
            kunnr TYPE vbak-kunnr,
          END OF t_vbak.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln  TYPE vbeln,
            matnr  TYPE vbap-matnr,
            netpr  TYPE vbap-netpr,
            waerk  TYPE vbap-waerk,
            kwmeng TYPE vbap-kwmeng,
            meins  TYPE vbap-meins,
          END OF t_vbap.
    DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
    DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
    DATA: v_repid         TYPE syrepid.
    DATA: s_layout        TYPE slis_layout_alv.
    DATA: v_tabname       TYPE slis_tabname.
    DATA: t_events        TYPE slis_t_event.
    start-of-selection event.
    START-OF-SELECTION.
      v_repid = sy-repid.
    Get the fieldcatalog for the first block
      PERFORM get_fieldcat1 CHANGING t_fieldcatalog1.
    Get the fieldcatalog for the second block
      PERFORM get_fieldcat2 CHANGING t_fieldcatalog2.
    Get the data for the first block
      SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
             INTO TABLE t_vbak
             FROM vbak WHERE vbeln > '0060000100'.
    Get the data for the second block
      SELECT vbeln matnr netpr waerk kwmeng meins UP TO 10
    ROWS
             INTO TABLE t_vbap
             FROM vbap WHERE vbeln > '0060000100'.
    init
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
           EXPORTING
                i_callback_program = v_repid.
    First block
      v_tabname = 'ITAB1'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog1
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbak.
    Second block
      v_tabname = 'ITAB2'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog2
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbap.
    *Display
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
          FORM GET_FIELDCAT1                           
          Get the field catalog for the first block    
    FORM get_fieldcat1 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer purchase order.
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'BSTNK'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'BSTNK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Creation date.
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'ERDAT'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'ERDAT'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'KUNNR'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'KUNNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.
          FORM GET_FIELDCAT2                           
          Get the field catalog for the second block   
    FORM get_fieldcat2 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Material number
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'MATNR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MATNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Net price
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'NETPR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'NETPR'.
      s_fieldcatalog-cfieldname    = 'WAERK'.
      s_fieldcatalog-ctabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Currency.
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'WAERK'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'WAERK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Quantity
      s_fieldcatalog-col_pos       = '5'.
      s_fieldcatalog-fieldname     = 'KWMENG'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'KWMENG'.
      s_fieldcatalog-qfieldname    = 'MEINS'.
      s_fieldcatalog-qtabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    UOM
      s_fieldcatalog-col_pos       = '6'.
      s_fieldcatalog-fieldname     = 'MEINS'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MEINS'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.

  • Problem in alv report coumn header in the background while using salv

    Hi  all,
            now i am working on  alv report for this i have used salv i mean oops alv ,So here i am facing one issue while executing the report  in background
            the report column headers are not displaying properly as it is displaying in front end.
           In the back ground it is always displaying column header as data element field label short text. i have written a code to pick the long text
           but it is working fine if run the report in the frontend where as in the backgroiund it is always displaying short text but it is wrong.
    here i am attaching the output screen shots in front end and background.

    Hi Satish,
    I have tried this scenario with Reuse ALV grid 1st i found the same issue as u said in background job,
    then i set in field catalog as,
    wa_fcat-ddictxt = 'L'. Now its working fine. L stands for long text.
    Before...
    After...
    For LVC u can try the below fields in fieldcatlog.
    COLDDICTXT = 'L'.
    SELDDICTXT = 'L'

  • How to set title/text for ALV table column header in WD ABAP

    Hello,
    I am working in WDA using SALV_WD_Table to display data in table. I need to change the column header text, the obvious way is to get the column header and call the method SET_TEXT to set new text / title. However, this method does NOT work, it does not change the column header text. I also tried the SET_TOOLTIP, this one works, but SET_TEXT does not work. Anyone has idea why this not working and do you find any go-around solution?
    My version is NW 7.0
    Thank
    Jayson

    Hi jason ,
    For setting Heder text for your ALV table
    ip_confing type ref to CL_SALV_WD_CONFIG_TABLE.
    "set alv table header
      ip_config->if_salv_wd_table_settings~r_header->set_text( 'Test ALV Header functionality' ).
    first you have to hide the DDIC text and then try to set your own text .
    "modify columns
      LOOP AT lt_columns INTO ls_column.
        lr_column = ls_column-r_column.
        CASE ls_column-id.
          WHEN 'MANDT'.
            "hide this field
            lr_column->set_visible( cl_wd_abstr_table_column=>e_visible-none ).
           WHEN 'SEQNR'.
            "set header to different string
            lr_column->r_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none )." use this line to hide ddic text
            lr_column->r_header->set_text( 'Position' ).     
        endcase.
      endloop.
    Regards
    Chinnaiya P

  • Message handling in ALV events

    I have a screen with ALV Grid control. This grid has columns (attributes of more than one material). Now when I select more than one column and click on a button added on the ALV grid toolbar……it triggers a button click event and in the implementation I have  written a code to check whether the selected columns (ie attributes) are from same material or not….if not from same material it throws an error message (Message type E). Once the error message is displayed doing any operation exits from the program….as the Message type E exits from the program.
    The requirement is to remain on the same screen and not exit. Error will disappear only on selecting columns from the same material and press the button.
    Note : There are no input fields here. So the concept of Chain-EndChain doesn’t hold good.

    METHOD handle_user_command_mmv.
        DATA: lt_cols TYPE lvc_t_col,                       "Stores the selected columns
              wa_lt_cols LIKE LINE OF lt_cols,              "Work Area for the above
              skey TYPE char2,                              "To store the key of the selected material
              flag TYPE int1,                               "For getting the first entry in current field catalog
              errFlag TYPE int1,                            "Set if error occurs
              dupflag TYPE int1,                            "To check for invalid selection
              l_fld_name TYPE string,                       "String to hold dynamic column name
              it_curr_fcat TYPE lvc_t_fcat,                 "Current field catalog
              wa_curr_fcat LIKE LINE OF it_curr_fcat,       "Work Area for current field catalog
              it_new_fcat TYPE lvc_t_fcat,                  "New field catalog
              wa_new_fcat LIKE LINE OF it_new_fcat,         "Work Area for new field catalog
              it_sel_mat_fcat TYPE lvc_t_fcat,              "Selected materials field catalog
              wa_sel_mat_fcat LIKE LINE OF it_sel_mat_fcat, "Work Area for selected materials field catalog
              l_count_seq type int4.                         "Col position for the new table
        DATA: lt_fcat TYPE lvc_t_fcat.                  "New field catalog in which final data will be stored
    Structure to maintain the order of materials
        TYPES: BEGIN OF struct_mattab,
               matrkey TYPE char3,
               END OF struct_mattab.
        DATA: itab_mat_fcat TYPE TABLE OF struct_mattab,
              wa_mat_fcat LIKE LINE OF itab_mat_fcat,
              WA_G_MMV_F4_TAB LIKE LINE OF G_MMV_F4_TAB.
        CASE e_ucomm.
          WHEN 'MMV_CASCADE'.
    Get all selected columns in a temporary table
            CALL METHOD alv_grid_mmv->get_selected_columns
              IMPORTING
                et_index_columns = lt_cols[].
            flag = 1.
            dupflag = 1.
            l_count_seq = 1.
            errFlag = 0.
            CLEAR skey.
            LOOP AT lt_cols INTO wa_lt_cols.
              IF wa_lt_cols-fieldname <> 'LOCID' AND
                wa_lt_cols-fieldname <> 'TSYST' AND
                wa_lt_cols-fieldname <> 'MATNR' AND
                wa_lt_cols-fieldname <> 'CHARG' AND
                wa_lt_cols-fieldname <> 'DATUM' AND
                wa_lt_cols-fieldname <> 'DATE_MMV' AND
                wa_lt_cols-fieldname <> 'DOW' AND
                wa_lt_cols-fieldname <> 'INTNO' AND
                wa_lt_cols-fieldname <> 'MULTFLAG' AND
                wa_lt_cols-fieldname <> 'CELLIO_TAB' AND
                wa_lt_cols-fieldname <> 'CELLCOLOR_TAB' AND
                wa_lt_cols-fieldname <> 'LINECOLOR'.
    Get the key of the first column in the current field catalog other than the fixed columns
                IF flag = 1.
                  skey = wa_lt_cols-fieldname+7(2).
                  flag = flag + 1.
                ENDIF.
    Check if selected columns are from different materials or aggregate columns
                IF skey <> wa_lt_cols-fieldname+7(2).
                  dupflag = 2.
                ELSEIF wa_lt_cols-fieldname+7(2) = '00'.
                  dupflag = 3.
                ENDIF.
              ENDIF.
            ENDLOOP.
            <b>IF dupflag = 2.
              errFlag = 1.
              MESSAGE E067(OIJ_SP).
            ELSEIF dupflag = 3.
              errFlag = 1.
              MESSAGE E068(OIJ_SP).</b>       
             ELSE.
              CLEAR it_curr_fcat.
              CLEAR it_sel_mat_fcat.
              CLEAR it_new_fcat.
    Get the current field catalog
              CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
                IMPORTING
                  et_fieldcatalog = it_curr_fcat.
    If columns are not selected and the button is clicked
              IF SKEY EQ SPACE.
                IT_NEW_FCAT[] = IT_CURR_FCAT[].
              ELSE.
    Maintain the field catalog for the selected material in a temporary table
              LOOP AT it_curr_fcat INTO wa_curr_fcat.
                IF wa_curr_fcat-fieldname+7(2) = skey.
                  INSERT wa_curr_fcat INTO TABLE it_sel_mat_fcat.
                ENDIF.
    Inserting the aggregate and fixed columns into the new field catalog
               IF WA_CURR_FCAT-FIELDNAME EQ 'LOCID' OR
                WA_CURR_FCAT-FIELDNAME EQ 'TSYST' OR
                WA_CURR_FCAT-FIELDNAME EQ 'MATNR' OR
                WA_CURR_FCAT-FIELDNAME EQ 'CHARG' OR
                WA_CURR_FCAT-FIELDNAME EQ 'DATUM' OR
                WA_CURR_FCAT-FIELDNAME EQ 'DATE_MMV' OR
                WA_CURR_FCAT-FIELDNAME EQ 'DOW' OR
                WA_CURR_FCAT-FIELDNAME EQ 'INTNO' OR
                WA_CURR_FCAT-FIELDNAME EQ 'MULTFLAG' OR
                WA_CURR_FCAT-FIELDNAME EQ 'CELLIO_TAB' OR
                WA_CURR_FCAT-FIELDNAME EQ 'CELLCOLOR_TAB' OR
                WA_CURR_FCAT-FIELDNAME EQ 'LINECOLOR' OR
                WA_CURR_FCAT-FIELDNAME+7(2) EQ '00'.
                   WA_CURR_FCAT-COL_POS = l_count_seq.
                   APPEND WA_CURR_FCAT TO IT_NEW_FCAT.
                   l_count_seq = l_count_seq + 1.
               ENDIF.
              ENDLOOP.
    Sort the internal table to reflect ordering
              SORT IT_SEL_MAT_FCAT ASCENDING BY COL_POS.
              ENDIF.
            ENDIF.
    IF SKEY NE SPACE AND errFlag NE 1.
    Inserting the material columns into the new field catalog after cascading
         LOOP AT G_MMV_F4_TAB INTO WA_G_MMV_F4_TAB
                WHERE LOCID = G_LOCID.
              LOOP AT IT_SEL_MAT_FCAT INTO WA_SEL_MAT_FCAT.
                   CONCATENATE WA_SEL_MAT_FCAT-FIELDNAME(7) WA_G_MMV_F4_TAB-KEY INTO L_FLD_NAME.
                      LOOP AT IT_CURR_FCAT INTO WA_CURR_FCAT
                              WHERE FIELDNAME = L_FLD_NAME.
                         MOVE WA_SEL_MAT_FCAT-NO_OUT TO WA_CURR_FCAT-NO_OUT.
                         MOVE WA_SEL_MAT_FCAT-OUTPUTLEN TO WA_CURR_FCAT-OUTPUTLEN.
                         WA_CURR_FCAT-COL_POS = l_count_seq.
                         APPEND WA_CURR_FCAT TO IT_NEW_FCAT.
                         l_count_seq = l_count_seq + 1.
                     ENDLOOP.
              ENDLOOP.
            ENDLOOP.
    ENDIF.
    IF errFlag EQ 1.
    Get the current field catalog
              CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
                IMPORTING
                  et_fieldcatalog = it_curr_fcat.
      IT_NEW_FCAT[] = IT_CURR_FCAT[].
    ENDIF.
            CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
              EXPORTING
                it_fieldcatalog = it_new_fcat.
            CALL METHOD alv_grid_mmv->refresh_table_display.
    Saving the current fieldcatalog
            CLEAR g_itab_old_order.
            CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
              IMPORTING
                et_fieldcatalog = g_itab_old_order.
          WHEN 'MMV_COL_HDR_PREFIX'.
            CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
              IMPORTING
                et_fieldcatalog = lt_fcat.
            gv_mmv_col_hdr_setting = 1.
            PERFORM set_mmv_col_hdr_txt
              CHANGING lt_fcat
                       gv_mmv_col_hdr_setting.
            CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
              EXPORTING
                it_fieldcatalog = lt_fcat.
            CALL METHOD alv_grid_mmv->refresh_table_display.
          WHEN 'MMV_COL_HDR_SUFFIX'.
            CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
              IMPORTING
                et_fieldcatalog = lt_fcat.
            gv_mmv_col_hdr_setting = 2.
            PERFORM set_mmv_col_hdr_txt
              CHANGING lt_fcat
                       gv_mmv_col_hdr_setting.
            CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
              EXPORTING
                it_fieldcatalog = lt_fcat.
            CALL METHOD alv_grid_mmv->refresh_table_display.
          WHEN 'MMV_COL_HDR_1ST_PREFIX'.
            CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
              IMPORTING
                et_fieldcatalog = lt_fcat.
            gv_mmv_col_hdr_setting = 3.
            PERFORM set_mmv_col_hdr_txt
              CHANGING lt_fcat
                       gv_mmv_col_hdr_setting.
            CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
              EXPORTING
                it_fieldcatalog = lt_fcat.
            CALL METHOD alv_grid_mmv->refresh_table_display.
          WHEN 'MMV_COL_HDR_1ST_SUFFIX'.
            CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
              IMPORTING
                et_fieldcatalog = lt_fcat.
            gv_mmv_col_hdr_setting = 4.
            PERFORM set_mmv_col_hdr_txt
              CHANGING lt_fcat
                       gv_mmv_col_hdr_setting.
            CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
              EXPORTING
                it_fieldcatalog = lt_fcat.
            CALL METHOD alv_grid_mmv->refresh_table_display.
        ENDCASE.
      ENDMETHOD.                "handle_user_command_mmv

  • Alv Problem: Dynamic Header & Dynamic item

    Dear all,
    i have two internal table.
    one for header and one for item.
    in header table record is stored like this: (In Vertical Base)
    ID   Description
    L1   Level1
    L2   Level2
    L3   Level3
    L4   Level4
    ALV Displayed like this:
    Level1       Level2          Level3           Level4
    in item table record is stored like this: (in Horizental Base)
    L1     L2     L3    L4
    20     30    40     50
    21     31    41     51
    22     32    42     52
    23     33    43     53
    the question is that how can i display items data on the base of Header.
    thanx in advance
    Anshuman

    It looks to me that you already have all your item data in an internal table. Pass this table to your ALV (FM or OOP). Based on your header data, feed the Fieldcatalog with this data, and you're done.

  • ALV -Excel download -header & data comming in Different columns

    Hi,
    I have an ALV report with FM.When I download it to excel through LIST/EXPORT/LOCALFILE some columns are getting messed up (ex: header is in one column and data is comming in different column).
    When i do with LIST/EXPORT/SPREADSHEET option it is working fine.
    but users want to use the first option only.
    I am use FM's in this report.
    Regards
    Praveen

    Hi
    What is the statement you used to dowload data .Check the field catalog that u are passing to downloaad function module.
    or check in the debuging mode..
    change these options in excel sheet and checkout if it can help u
    1. Go to Tools -> Macro -> Security in Excel
    2. Select the ‘Trusted Sources’ tab and ensure that the checkbox titled ‘Trust access to Visual Basic Project’ is ticked.
    3. With the feature switched on, the data is passed to Excel.
    check this sample one
    TABLES : MAST , "Material to BOM Link
    STKO , "BOM Header
    MARA . "General Material Data
    * Types Begin with TY_ *
    TYPES : BEGIN OF TY_MASTER ,
    MATNR TYPE MAST-MATNR , "Material Number
    WERKS TYPE MAST-WERKS , "Plant
    STLAN TYPE MAST-STLAN , "BOM Usage
    STLNR TYPE MAST-STLNR , "Bill of material
    STLAL TYPE MAST-STLAL , "Alternative BOM
    ANDAT TYPE MAST-ANDAT , "Date record created on
    AEDAT TYPE MAST-AEDAT , "Date of Last Change
    AENAM TYPE MAST-AENAM , "Name of Person Who Changed Object
    STLST TYPE STKO-STLST , "BOM status
    ZPLP1 TYPE MBEW-ZPLP1 , "Future Planned Price 1
    DWERK TYPE MVKE-DWERK , "Delivering Plant (Own or External)
    END OF TY_MASTER .
    TYPES : MY_TYPE(20) TYPE C.
    * Constants Begin with C_ *
    * Internal tables Begin with IT_ *
    DATA : IT_MASTER TYPE STANDARD TABLE OF TY_MASTER,
    WA_MASTER TYPE TY_MASTER .
    DATA : IT_HEADER TYPE TABLE OF MY_TYPE.
    * Data Begin with W_ *
    DATA : W_PTH TYPE RLGRAP-FILENAME.
    DATA : W_FILE TYPE RLGRAP-FILENAME.
    * Field Symbols Begin with FS_ *
    * Select Options Begin with SO_ *
    * Parameter Begin with PR_ *
    * I N I T I A L I Z A T I O N *
    *--- Add Header Fields to Header Table ---
    APPEND 'Material Number' TO IT_HEADER .
    APPEND 'Plant' TO IT_HEADER .
    APPEND 'BOM Usage' TO IT_HEADER .
    APPEND 'Bill Code' TO IT_HEADER .
    APPEND 'Alternative BOM' TO IT_HEADER .
    APPEND 'Created On' TO IT_HEADER .
    APPEND 'Changed On' TO IT_HEADER .
    APPEND 'Changed By' TO IT_HEADER .
    APPEND 'BOM Status' TO IT_HEADER .
    APPEND 'Planned Price' TO IT_HEADER .
    APPEND 'Delivery Plant' TO IT_HEADER .
    IF SY-MANDT = '700'.
    W_PTH = '\lkdb01ISDISSoftware DevelopmentsDevelopmentsData FilesSAP DumpsBOM_Available'.
    ELSE.
    W_PTH = 'C:'.
    ENDIF.
    * A T S E L E C T I O N S C R E E N *
    * s t a r t o f s e l e c t i o n
    START-OF-SELECTION.
    *--- Load Data to Internal Table ---
    * SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST
    * INTO TABLE IT_MASTER
    * FROM MAST
    * INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
    * AND STKO~STLAL EQ MAST~STLAL
    * INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
    * WHERE MARA~MTART LIKE 'ZFG%'
    * AND STKO~LKENZ NE 'X'
    * AND STKO~LOEKZ NE 'X'
    * AND STKO~STLST EQ '1'.
    SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST MBEW~ZPLP1 MVKE~DWERK
    INTO TABLE IT_MASTER
    FROM MAST
    INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
    AND STKO~STLAL EQ MAST~STLAL
    INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
    INNER JOIN MBEW ON MBEW~MATNR EQ MAST~MATNR
    AND MBEW~BWKEY EQ MAST~WERKS
    INNER JOIN MVKE ON MVKE~MATNR EQ MAST~MATNR
    WHERE MARA~MTART LIKE 'ZFG%'
    AND STKO~LKENZ NE 'X'
    AND STKO~LOEKZ NE 'X'
    AND STKO~STLST EQ '1'.
    IF SY-SUBRC <> 0.
    MESSAGE I014(ZLOAD).
    ENDIF.
    *--- Set Path to Function Module ---
    CONCATENATE W_PTH SY-DATUM ' - ' 'BOM_AVAILABLE_PLANT.XLS' INTO W_FILE.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = W_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_MASTER
    FIELDNAMES = IT_HEADER
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_EIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
    MESSAGE I023(ZLOAD) WITH text-001.
    ELSE.
    MESSAGE I022(ZLOAD) WITH W_FILE. "Errors while downloading.
    ENDIF.
    END-OF-SELECTION.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
    Reward all helpfull answers
    Regards
    Pavan
    Message was edited by:
            Pavan praveen

  • ALV Event for data input

    I have an internal table . One of the fields can take input in the ALV grid using ABAP objects.
    When the user enters a value in this field , I would like to capture the values in all the cells of all the fields that are adjaccent to this editable field.
    I think I will have to use data_changed event . The SLIS examples are a bit complex, If there is a simpler example to show how this can be done , it will be great.

    That's right, that is the event that you want to use.  See example programs which start with BCALV_EDIT*
    Regards,
    Rich Heilman

Maybe you are looking for

  • How can I get my  complete iTunes library list back?

    I just downloaded a song from the iTunes Music Store. I don't know what I did, but now my screen only shows two recordings of the same song. 1. I want my library screen to show ALL of my songs, preferably in alphabetical order, if that is possible. 2

  • Hard drive failure immediately following 10.4.6 install

    The Apple Discussions have been such a great help to me over the years. Wanted to add my experience to the forum in case it helps someone. Background – 15” flat-panel iMac with 1GB RAM and 60GB ST360020 Seagate hard drive running 10.3.9. The hard dri

  • Preview will not work.  Have to force quit it.  Will not work on Jpg or pdf

    I tried sending the preview.plist to the trash and restarting the computer. It worked for a short time, now is back not working again. Could not find the file except in the trash. Any ideas how to fix? This has happened once before and it just starte

  • Java newbie questions...Setting the classpath in Unix

    When you set the classpath, how do you include anything already in the classpath? For instance, if your profile sets your classpath to "/home/weblogic/:home/weblogic/weblogic.jar, and you want to add MyJar.jar to it, can you enter: export classpath=~

  • Help!  SQL Server to Oracle 10.1.0.2

    Hello! I need your help. I need to migrate SQL Server 2000 to Oracle 10g on HP-UX. I read the SQL Developer documentation, but it only seems to be available for Windows, MacOS, and Linux. Is there one available for Unix? Thank you in advance, si