ALV Hierarchical With multiple boxes
Hello.
I have an alv hierarchical with multiple boxes.
Can I insert a buttom in Gui status of alv that allows me to expand all the boxes of hierarchy?
Regards
Angela
Hi Narendra,
Try this program:
TABLES : sflight.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
w_repid = sy-repid.
DATA: BEGIN OF it_sflight OCCURS 0,
checkbox(1),
carrid LIKE sflight-carrid,
END OF it_sflight.
*layout
DATA: wa_layout TYPE slis_layout_alv.
*field catalog
DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
wa_fieldcatalog TYPE slis_fieldcat_alv.
START-OF-SELECTION.
SELECT carrid FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight.
END-OF-SELECTION.
CLEAR it_fieldcatalog.
REFRESH it_fieldcatalog.
wa_fieldcatalog-fieldname = 'CHECKBOX'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'Chk'.
wa_fieldcatalog-checkbox = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'CARRID'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-seltext_m = 'Carrid'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = wa_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcatalog
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
FORM user_command USING p_ucomm TYPE sy-ucomm
p_selfld TYPE slis_selfield.
CASE p_ucomm.
WHEN '&DATA_SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
LOOP AT it_sflight WHERE checkbox = 'X'.
DELETE it_sflight INDEX sy-tabix.
ENDLOOP.
p_selfld-refresh = 'X'.
ENDCASE.
ENDFORM. "user_command
Hope this helps you.
Regards,
Chandra Sekhar
Similar Messages
-
Help req : alv grid with multiple row selection
Hi all sap gurus,
i have a alv list display program , in which i can select the o/p rows(multiple rows)
and perform some actiom based on some icons .
now i have to convert this in to grid display
this is initial code i.e for list
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE ztest.
DATA : checkbox type c.
DATA : END OF itab.
s_layout-box_fieldname = 'CHECKBOX'.
ty_events-name = slis_ev_top_of_page.
ty_events-form = 'TOP_OF_PAGE'.
APPEND ty_events TO it_events.
ALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'ITAB'
i_inclname = v_repid
CHANGING
ct_fieldcat = build_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'ITAB'
is_layout = s_layout
it_fieldcat = build_fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = 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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab
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.
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = 'DELE'.
LOOP AT iTAB WHERE CHECKbox = 'X' .
ENDLOOP.
MODIFY ztEST FROM TABLE itAB.
ENDIF.
selfield-refresh = 'X'.
ENDFORM.
NOW I HAVE A LIST O/P WHERE I CAN SELECT THE BOX AND CLICK DELETE ICON.
NOW I WANT TO CHANGE TO GRID, SO I KEPT EVERYTHING SAMRE AND I CHANGED " LIST" TO "GRID"
NOW TWO THINGS HAPPEND
1) I SEE A EMPTY COLUMN IN THE O/P , I GUESS THATS BECAUSE CHECKBOSX IN INTERNAL TABLE , SO I REMOVED IT
SO THIS MADE ME TO REMOVE
IF ucomm = 'DELE'.
LOOP AT iTAB." WHERE CHECKbox = 'X' .------PROBLEM
ENDLOOP.
MODIFY ztEST FROM TABLE itAB.
ENDIF.
selfield-refresh = 'X'.
NOW I DON'T SEE THE EMPTY COLUMN , BUT NOW PROBLEM IS I CANNNOT DISTINGUISH AS TO WHICH IS SELECTED AND AT ANY POINT OF TIME I CANSELECT ONLY ROW.
ALL I WANT IS
1) I WANT TO SELECT MULTIPLE ROWS AND SHOULD BE ABLE TO KNOW WHICH ROWS WERE SELECTED IN THE O/P SCREEN.
IN THE LIST DISPLAY I HAD CHECKBOX = 'X' FOR ALL THE ROWS THAT WERE SELECTED , I WANT THE SIMILAR THING in grid display
LET ME KNOW whether this can be done without USING 00 LANG.
thanksHi Swati,
Below code might help full for you. Description: is It selects multiple rows from ALV and display it on the next ALV.
*************************Reward Point If help full********************************************
*& Report z7cc_alv_oops_show_next_alv *
*& DEVELOPERS NAME : CHIDANAND CHAUHAN
*& DATE: SATURDAY 08-07-2006
*& DESCRIPTION: TO CREATE AN OBJECT ORIENTED ALV
REPORT z7cc_alv_oops_show_next_alv MESSAGE-ID z5hs .
DATA : BEGIN OF it_mara OCCURS 0,
mark TYPE flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF it_mara.
DATA : BEGIN OF it_mara1 OCCURS 0,
* mark type flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF it_mara1.
DATA : BEGIN OF it_mara2 OCCURS 0,
* mark type flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF it_mara2.
DATA : t_fieldcat TYPE lvc_t_fcat,
t_fieldcat1 TYPE lvc_t_fcat,
s_fieldcat LIKE LINE OF t_fieldcat.
DATA : s_layout TYPE lvc_s_layo.
DATA : control TYPE REF TO cl_gui_custom_container,
grid TYPE REF TO cl_gui_alv_grid.
DATA: BEGIN OF wa ,
mark TYPE flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF wa.
* CLASS lcl_events_box DEFINITION
CLASS lcl_events_box DEFINITION.
PUBLIC SECTION.
METHODS :
*Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
*imporTing er_data_changed,
handler_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
handler_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
ENDCLASS. "lcl_events_box DEFINITION
* CLASS lcl_events_box IMPLEMENTATION
CLASS lcl_events_box IMPLEMENTATION.
* method to handle the user command.
METHOD handler_user_command.
PERFORM form_usercommand CHANGING e_ucomm.
ENDMETHOD. "Handler_user_command
*& Mehod to handle the toolbar.
METHOD handler_toolbar.
PERFORM form_toolbar CHANGING e_object e_interactive
e_object->mt_toolbar.
ENDMETHOD. "Handler_ToolBar
ENDCLASS. "lcl_events_box IMPLEMENTATION
START-OF-SELECTION.
DATA : w_events TYPE REF TO lcl_events_box.
SELECT matnr mtart meins FROM mara INTO CORRESPONDING FIELDS OF TABLE
it_mara.
CALL SCREEN 100.
*& Module pbo_module OUTPUT
* text
MODULE pbo_module OUTPUT.
IF grid IS INITIAL.
CREATE OBJECT control
EXPORTING
container_name = 'CUST_CTRL'.
CREATE OBJECT grid
EXPORTING
i_parent = control.
PERFORM build_catalog.
PERFORM build_catalog1.
PERFORM build_layout.
CALL METHOD grid->set_table_for_first_display
EXPORTING
is_layout = s_layout
CHANGING
it_outtab = it_mara[]
it_fieldcatalog = t_fieldcat.
CREATE OBJECT w_events.
SET HANDLER : w_events->handler_toolbar FOR grid,
w_events->handler_user_command FOR grid.
CALL METHOD grid->set_toolbar_interactive.
ELSE.
CALL METHOD grid->refresh_table_display.
ENDIF.
ENDMODULE. " pbo_module OUTPUT
*& Form BUILD_CATALOG
FORM build_catalog .
s_fieldcat-col_pos = '1'.
s_fieldcat-fieldname = 'MARK'.
s_fieldcat-checkbox = 'X'.
s_fieldcat-edit = 'X'.
APPEND s_fieldcat TO t_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-col_pos = '2'.
s_fieldcat-fieldname = 'MATNR'.
s_fieldcat-scrtext_m = 'MATERIAL'.
APPEND s_fieldcat TO t_fieldcat.
s_fieldcat-col_pos = '3'.
s_fieldcat-fieldname = 'MTART'.
s_fieldcat-scrtext_m = 'MATERL TYPE'.
APPEND s_fieldcat TO t_fieldcat.
s_fieldcat-col_pos = '4'.
s_fieldcat-fieldname = 'MEINS'.
s_fieldcat-scrtext_m = 'UOM'.
APPEND s_fieldcat TO t_fieldcat.
ENDFORM. " BUILD_CATALOG
*& Form BUILD_LAYOUT
* text
* --> p1 text
* <-- p2 text
FORM build_layout .
s_layout-zebra = 'X'.
* S_LAYOUT-CWIDTH_OPT = 'X'.
s_layout-grid_title = 'Material Details'.
ENDFORM. "BUILD_LAYOUT
" BUILD_LAYOUT////////////////////////////////////
" USER_COMMAND_0100 INPUT
*& Form FORM_USERCOMMAND
* text
* <--P_E_UCOMM text
FORM form_usercommand CHANGING p_e_ucomm.
CASE p_e_ucomm.
WHEN 'INT1'.
DO.
READ TABLE it_mara INDEX sy-index TRANSPORTING mark matnr.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF it_mara-mark = 'X'.
READ TABLE it_mara INTO wa TRANSPORTING matnr mtart meins .
MOVE-CORRESPONDING wa TO it_mara1.
READ TABLE it_mara1 TRANSPORTING matnr mtart meins .
MOVE-CORRESPONDING it_mara1 TO it_mara2.
APPEND it_mara2.
CALL METHOD grid->set_table_for_first_display
EXPORTING
is_layout = s_layout
CHANGING
it_outtab = it_mara2[]
it_fieldcatalog = t_fieldcat1.
* SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
* CALL TRANSACTION 'MM02'.
ENDIF.
* ENDIF.
ENDDO.
ENDCASE.
ENDFORM. " FORM_USERCOMMAND
*& Form FORM_TOOLBAR
* text
* <--P_E_OBJECT text
* <--P_E_INTERACTIVE text
* <--P_E_OBJECT_>MT_TOOLBAR text
FORM form_toolbar CHANGING p_e_object TYPE REF TO
cl_alv_event_toolbar_set
p_e_interactive
mt_toolbar TYPE ttb_button.
DATA wal_button TYPE stb_button.
*WAL_BUTTON-ICON = ICON_status_reverse.
wal_button-text = 'GO'.
wal_button-quickinfo = 'PROCEED'.
wal_button-function = 'INT1'.
wal_button-butn_type = 0.
wal_button-disabled = space.
INSERT wal_button INTO p_e_object->mt_toolbar INDEX 1.
ENDFORM. " FORM_TOOLBAR
*& Module PF-STATUS OUTPUT
* text
MODULE pf-status OUTPUT.
SET PF-STATUS 'Z7CCSTAT'.
ENDMODULE. " PF-STATUS OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_CATALOG1
* text
* --> p1 text
* <-- p2 text
FORM build_catalog1 .
s_fieldcat-col_pos = '1'.
s_fieldcat-fieldname = 'MATNR'.
s_fieldcat-scrtext_m = 'MATERIAL'.
APPEND s_fieldcat TO t_fieldcat1.
s_fieldcat-col_pos = '2'.
s_fieldcat-fieldname = 'MTART'.
s_fieldcat-scrtext_m = 'MATERL TYPE'.
APPEND s_fieldcat TO t_fieldcat1.
s_fieldcat-col_pos = '3'.
s_fieldcat-fieldname = 'MEINS'.
s_fieldcat-scrtext_m = 'UOM'.
APPEND s_fieldcat TO t_fieldcat1.
ENDFORM. " BUILD_CATALOG1 -
ALV Grid with Multiple Headers
Dear All ,
I want to know is it possible to display Multiple header in the ALV Grid Display it is possible in List Display that i dne but i want in
My requirment is :
Header 1 | Header 2
SubHeader 1 | SubHeader 2 | SubHeader 3 | SubHeader 4
R1 | R2 | R1 | R2 |
R1 | R2 | R1 | R2 |
R1 | R2 | R1 | R2 |
R1 | R2 | R1 | R2 |
R1 | R2 | R1 | R2 |
R1 | R2 | R1 | R2 |
Header line 1 and Header line 2 in this format .
How it could be possible Please suggest or its not at all possible . Please suggest .
Thanks & Regards,
Aryan>
Aryan@sap wrote:
> That i will do in end but i want with ALV Grid . If it wont be possible with ALV grid i will finally do with ALV List .
> If any solution possible through ALV Grid then Please Suggest .
Then go for ALV List. But i am not sure if you can achieve this using the method suggested by Soumyaprakash.
You can give it a try though.
It is possible because that I have seen in standard here i cant paste the screen shot . but how its comming tht i am not able to analysis .
This is news to me now. Which standard code are you referring to?
Good luck !! -
Back from ALV Grid with multiple refresh
I have a report that from a selection screen shows an editable ALV Grid, and after I save it, it will refresh the grid.
My problem is when I hit the BACK button it returns to the "previous grid" instead of the selection screen
I am using the following:
WHEN 'BACK_C'.
LEAVE to SCREEN '0'.
How can I force it to go back to the selection screen?
sidenote: I have tried using call
selection-screen '1000'
but it adds a new problem as in the selection screen hitting back will return to the grid and I can never exit the report.Neither solution works.
If it helps, I'm refreshing the grid with:
DATA : ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
CALL METHOD ref_grid->refresh_table_display( ).
It seems when I refresh the grid it generates a completely independent grid screen and there's no way to skip them all and return to the selection screen. -
Printing page numbers in an ALV report with multiple grids
Hi,
I have developed a report using OO ALV GRID. The output is having multiple grids navigated using a menu button appended to the standard tool bar
(Ref report: BCALV_GRID_07). On navigation, we are able to display specific titles when each grid is displayed.
When we print those individual pages (the grids), we are able to print the page numbers and the title for the first grid but when we display the next grid and print, we are unable to initialise the page number
and print specific title. The page numbers continues from the last printing.
I am looking at identifying the grid when the print event - PRINT_TOP_OF_PAGE is triggered so that a grid specific title can be printed and also page number initialised.
Any suggestions is highly appreciated.
Thanks.
Mani.You cannot have one event for all the grids as you cannot identify for which grid the event has fired. You need to activate the event for each of the grid and handle the code independently.
regards,
Ravi
Note - Please mark the helpful answers -
Regarding alv report with check boxes
Hai,
i have four check boxes as input named new,rejected,accepted and all.these four four check boxes information is nothing but the information that displayed under one field in my internal table.if i click the new check box means that corresponding
data has to be display similarly for accepted and rejected .if i click the all check box means all records has to be displayed.now i am facing one problem if i suppose to click all check box with either new or rejected orelse accepted orelse with all the three with all check box means then it wont goes to output instead of that it remains in the same window i.e input screen. pls tell me the solution as soon as possible.
with regards,
R.Dhineshraj.hi dhinesh,
one thing...wen ur writing a code for checkboxes ...checck for the following..
1> for individual check box code...one check box should b selected at a time..
2> for combination of checkboxes...after end-of-selection event...where u put this condition...give the if-clause with and condition...for all possible conditions of all 4 checkboxes...
den accordingly...select the form-perform corresponding to the checkbox selection...
example code..im writing here...for individual assignment...
PARAMETERS: invoiced AS CHECKBOX.
PARAMETERS: good_iss AS CHECKBOX.
END-OF-SELECTION.
IF invoiced = 'X'.
PERFORM create_fieldcatalog.
PERFORM display_data.
ELSE.
IFgood_iss = 'X'.
let me knw if it helps u..
regards
kanika -
ALV REPORT WITH MULTIPLE BLOCKS - COLUM TOTAL
Hi friends,
In the following code, I am not getting the column total.
--- SAMPLE 1--
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'.
PERFORM list_append TABLES IT_CTV
USING '1'
'IT_CTV'.
PERFORM list_append TABLES IT_APP
USING '2'
'IT_APP'.
PERFORM f_list_display.
FORM USER_COMMAND *
FORM user_command USING i_ucomm LIKE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
ENDFORM. " USER_COMMAND
Form list_append
FORM list_append TABLES ut_table
USING u_no TYPE char1
u_tabname TYPE slis_tabname.
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DATA: GT_ZSUM TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv. " Sort table
DATA:
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event,
ls_layout TYPE slis_layout_alv.
ls_layout-group_change_edit = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-zebra = 'X'.
ls_layout-cell_merge = 'X'.
ls_layout-detail_popup = 'X'.
ls_layout-get_selinfos = 'X'.
ls_layout-max_linesize = '300'.
CASE u_no.
WHEN '1'.
ls_fieldcat-SELTEXT_L = ' REGION'.
m_fieldcat 'BZIRK' 'IT_CTV'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' CTV STOCK'.
m_fieldcat 'CTVST' 'IT_CTV'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' CTV VALUE'.
m_fieldcat 'CTVVL' 'IT_CTV'.
ls_fieldcat-DO_SUM = 'X'.
m_sort 'BZIRK'.
WHEN '2'.
ls_fieldcat-SELTEXT_L = ' REGION'.
m_fieldcat 'BZIRK' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' RFG STK'.
m_fieldcat 'RFGST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' RFG VAL'.
m_fieldcat 'RFGVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' WM STK'.
m_fieldcat 'WMCST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' WM VAL'.
m_fieldcat 'WMCVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' MCCS STK'.
m_fieldcat 'MOVST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' MCCS VAL'.
m_fieldcat 'MOVVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' APP STK'.
m_fieldcat 'APPST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' APP VAL'.
m_fieldcat 'APPVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-DO_SUM = 'X'.
m_sort 'BZIRK'.
ENDCASE.
ls_fieldcat-COL_POS = 1.
ls_fieldcat-FIELDNAME = 'BZIRK'.
ls_fieldcat-DO_SUM = 'X'.
ls_fieldcat-FIX_COLUMN = 'X'.
APPEND ls_fieldcat TO lT_fieldcat.
IF u_no CA '13'.
MOVE 'TOP_OF_PAGE' TO ls_event-name.
CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ELSE.
MOVE 'TOP_OF_LIST' TO ls_event-name.
CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = lt_fieldcat
is_layout = ls_layout
i_tabname = u_tabname
it_events = lt_events
it_sort = lt_sort
TABLES
t_outtab = ut_table
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
ENDFORM. " LIST_APPEND
Form f_list_display
FORM f_list_display.
DATA ls_print TYPE slis_print_alv.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = ls_print
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. " F_LIST_DISPLAY
FORM top_of_page1 *
FORM top_of_page1. "#EC CALLED
WRITE 'SALES REPORT'.
PERFORM TOP_LIST1.
ENDFORM.
FORM top_of_list2 *
FORM top_of_list2. "#EC CALLED
WRITE 'STOCK REPORT'.
PERFORM top_of_page.
ENDFORM.
*-----END OF SAMPLE 1 -
Could any help me.
Thanx in advance.
Regards,
A S VINCENTHai Vincent
Check & Run the follow ABAP Code
*& Report ZALV_Block *
REPORT ZALV_block NO STANDARD PAGE HEADING
MESSAGE-ID ZZ.
*..Type Definitions for ALV Report
TYPE-POOLS SLIS.
Table Declarations. *
TABLES: MARA, "Material Master
MARC, "Plant Data for Material
MARD, "Storage Location Data for Material
VBAP, "Sales Document: Item Data
VBUP. "Sales Document: Item Status
Internal table to store sales orders.......
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_VBAP.
internal table to store final data
DATA: BEGIN OF IT_FINAL OCCURS 0,
WERKS LIKE MARD-WERKS, "Plant
MATNR LIKE MARD-MATNR, "Material Number
LGORT LIKE MARD-LGORT, "Storage Location
LABST LIKE MARD-LABST, "Valuated stock with unrestricted use
INSME LIKE MARD-INSME, "Stock in quality inspection
RETME LIKE MARD-RETME, "Blocked Stock Returns
UMLME LIKE MARD-UMLME, "Stock in transfer
MAKTX LIKE MAKT-MAKTX, "Material description
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_FINAL.
ALV Type declaration *
*..Field Catalog for Basic List.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*..Events For Basic List.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT.
*..Layout For Basic List
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*..Sort Table For Basic List
DATA: IT_SORT TYPE SLIS_SORTINFO_ALV OCCURS 0 WITH HEADER LINE.
DATA DECLARATIONS *
DATA: V_FLAG,
VINDEX TYPE SY-TABIX,
TOTAL TYPE VBAP-KWMENG. "Open order quantity
*..To Store Program Name
DATA: V_REPID TYPE SYREPID.
*..To know whether basic list contains any data
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,
S_WERKS FOR MARC-WERKS,
S_LGORT FOR MARD-LGORT.
SELECTION-SCREEN END OF BLOCK B1.
Event:Initialization *
INITIALIZATION.
V_REPID = SY-REPID.
AT Selection Screen. *
AT SELECTION-SCREEN.
PERFORM VALIDATIONS.
Event: Start-of-Selection *
START-OF-SELECTION.
To get data from vbap into internal table IT_VBAP
PERFORM FETCH_OPEN_DATA.
To get data into final internal table IT_FINAL
IF V_FLAG = 'X'.
PERFORM FETCH_FINAL_DATA.
ENDIF.
IF V_FLAG = ''.
MESSAGE I010 WITH 'NO DATA TO BE DISPLAYED'.
EXIT.
ELSE.
--Setting the FIELD CATALOG for ALV
PERFORM FILL_FIELDCAT_HEADER.
*-----Setting the LAYOUT for ALV
PERFORM GET_LAYOUT.
*-----Getting the ALV Events
PERFORM GET_EVENT.
*---- To Sort the list
PERFORM DO_SORT.
ENDIF.
Event: End-of-Selection *
END-OF-SELECTION.
*--Generating the ALV LIST DISPLAY
PERFORM DISPLAY_LIST.
FORM DEFINITIONS *
*& Form VALIDATIONS
To validate data in selection screen
--> p1 text
<-- p2 text
FORM VALIDATIONS.
PERFORM VALIDATE_MATNR.
PERFORM VALIDATE_WERKS.
PERFORM VALIDATE_LGORT.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT SINGLE MATNR
WERKS
LGORT
FROM MARD
INTO (MARD-MATNR, MARD-WERKS, MARD-LGORT)
WHERE MATNR = MARA-MATNR
AND WERKS = MARC-WERKS
AND LGORT = MARD-LGORT.
ENDIF.
ENDFORM. " VALIDATIONS
*& Form VALIDATE_MATNR
To validate MATNR
--> p1 text
<-- p2 text
FORM VALIDATE_MATNR.
IF NOT S_MATNR[] IS INITIAL.
SELECT MATNR
UP TO 1 ROWS
INTO (MARD-MATNR)
FROM MARA
WHERE MATNR IN S_MATNR.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-001.
ENDIF.
ENDFORM. " VALIDATE_MATNR
*& Form VALIDATE_WERKS
To validate plant
--> p1 text
<-- p2 text
FORM VALIDATE_WERKS.
IF NOT S_WERKS[] IS INITIAL.
SELECT WERKS
UP TO 1 ROWS
INTO (MARD-WERKS)
FROM MARC
WHERE WERKS IN S_WERKS.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-002.
ENDIF.
ENDFORM. " VALIDATE_WERKS
*& Form VALIDATE_LGORT
To validate storage
--> p1 text
<-- p2 text
FORM VALIDATE_LGORT.
IF NOT S_LGORT[] IS INITIAL.
SELECT LGORT
UP TO 1 ROWS
INTO (MARD-LGORT)
FROM MARD
WHERE LGORT IN S_LGORT.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-003.
ENDIF.
ENDFORM. " VALIDATE_LGORT
*& Form FETCH_OPEN_DATA
To get data into internal table IT_VBAP
--> p1 text
<-- p2 text
FORM FETCH_OPEN_DATA.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP
WHERE MATNR IN S_MATNR
AND WERKS IN S_WERKS
AND LGORT IN S_LGORT.
ENDIF.
LOOP AT IT_VBAP.
SELECT * FROM VBUP
INTO VBUP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND LFSTA NE 'C'.
ENDSELECT.
ENDLOOP.
IF SY-SUBRC NE 0.
REFRESH IT_VBAP.
MESSAGE E000 WITH TEXT-004.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
To get sum of all quantities as open order quantity
LOOP AT IT_VBAP.
TOTAL = TOTAL + IT_VBAP-KWMENG.
ENDLOOP.
ENDFORM. " FETCH_OPEN_DATA
*& Form FETCH_FINAL_DATA
To get data into final internal table IT_FINAL
--> p1 text
<-- p2 text
FORM FETCH_FINAL_DATA.
SELECT A~MATNR
A~WERKS
A~LGORT
MAKTX
LABST
INSME
RETME
UMLME
VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
FROM MARD AS A
INNER JOIN MAKT AS B
ON AMATNR = BMATNR
AND SPRAS = 'E'
INNER JOIN VBAP AS C
ON AMATNR = CMATNR
FOR ALL ENTRIES IN IT_VBAP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND KWMENG = IT_VBAP-KWMENG
AND A~MATNR IN S_MATNR
AND A~WERKS IN S_WERKS
AND A~LGORT IN S_LGORT.
IF SY-SUBRC NE 0.
V_FLAG = SPACE.
MESSAGE E001 WITH 'No data found IN the selection criteria'.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
ENDFORM. " FETCH_FINAL_DATA
*& Form FILL_FIELDCAT_HEADER
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_HEADER .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_FINAL'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_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.
LOOP AT IT_FIELDCAT INTO WA_FIELDCAT.
CASE WA_FIELDCAT-FIELDNAME.
WHEN 'KWMENG'.
WA_FIELDCAT-COL_POS = '11'.
WA_FIELDCAT-OUTPUTLEN = '22'.
WA_FIELDCAT-SELTEXT_L = 'Net Value'.
WA_FIELDCAT-DO_SUM = 'X'.
ENDCASE.
MODIFY IT_FIELDCAT FROM WA_FIELDCAT INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_HEADER
*& Form GET_LAYOUT
text
--> p1 text
<-- p2 text
FORM GET_LAYOUT .
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. " GET_LAYOUT
*& Form GET_EVENT
text
--> p1 text
<-- p2 text
FORM GET_EVENT .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS
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.
LOOP AT IT_EVENTS INTO WA_EVENTS.
CASE WA_EVENTS-NAME.
WHEN 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'FILL_LIST_HEADER'.
WHEN 'USER_COMMAND'.
WA_EVENTS-FORM = 'PROCESS_BASIC_LIST'.
ENDCASE.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_EVENT
FORM FILL_LIST_HEADER *
FORM FILL_LIST_HEADER.
WRITE:2'Report :' , SY-REPID,
: 85 ' Intelligroup Asia Pvt Ltd' CENTERED,
: 159 'Date :' ,SY-DATUM,
:/2'User :', SY-UNAME,
: 82 ' Hyderabad ' CENTERED ,
: 159 'Pg.No :' ,SY-PAGNO,
:/86 ' Stock Report ' CENTERED.
SKIP 2.
ENDFORM. "FILL_LIST_HEADER
*& Form DISPLAY_LIST
text
--> p1 text
<-- p2 text
FORM DISPLAY_LIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = 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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
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_LIST
*& Form do_sort
text
--> p1 text
<-- p2 text
FORM DO_SORT .
*-- Populating the sort table
IT_SORT-FIELDNAME = 'MATNR'.
IT_SORT-TABNAME = 'IT_FINAL'.
IT_SORT-UP = 'X'.
it_sort-subtot = 'X'.
APPEND IT_SORT.
ENDFORM. " do_sort
Thanks & Regards
Sreenivasulu P -
ALV REPORT WITH MULTIPLE BLOCKS
To print two blocks in a single ALV report, I have taken the sample and modified to my requirement. I am having the following problems in this code.
1. Columnwise total not appearing.
2. Amount and numbers in all the columns are
left justified instead of right justified.
The code written is given below. Kindly check the same and suggest for corrections.
--- SAMPLE 1--
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'.
PERFORM list_append TABLES IT_CTV
USING '1'
'IT_CTV'.
PERFORM list_append TABLES IT_APP
USING '2'
'IT_APP'.
PERFORM f_list_display.
FORM USER_COMMAND *
FORM user_command USING i_ucomm LIKE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
ENDFORM. " USER_COMMAND
Form list_append
FORM list_append TABLES ut_table
USING u_no TYPE char1
u_tabname TYPE slis_tabname.
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv. " Sort table
DATA:
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event,
ls_layout TYPE slis_layout_alv.
ls_layout-group_change_edit = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-zebra = 'X'.
ls_layout-cell_merge = 'X'.
ls_layout-detail_popup = 'X'.
ls_layout-get_selinfos = 'X'.
ls_layout-max_linesize = '300'.
CASE u_no.
WHEN '1'.
ls_fieldcat-SELTEXT_L = ' REGION'.
ls_fieldcat-DO_SUM = 'X'.
m_fieldcat 'BZIRK' 'IT_CTV'.
ls_fieldcat-SELTEXT_L = ' CTV STOCK'.
m_fieldcat 'CTVST' 'IT_CTV'.
ls_fieldcat-SELTEXT_L = ' CTV VALUE'.
m_fieldcat 'CTVVL' 'IT_CTV'.
m_sort 'BZIRK'.
ls_fieldcat-DO_SUM = 'X'.
WHEN '2'.
ls_fieldcat-SELTEXT_L = ' REGION'.
m_fieldcat 'BZIRK' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' RFG STK'.
m_fieldcat 'RFGST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' RFG VAL'.
m_fieldcat 'RFGVL' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' WM STK'.
m_fieldcat 'WMCST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' WM VAL'.
m_fieldcat 'WMCVL' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' MCCS STK'.
m_fieldcat 'MOVST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' MCCS VAL'.
m_fieldcat 'MOVVL' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' APP STK'.
m_fieldcat 'APPST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' APP VAL'.
m_fieldcat 'APPVL' 'IT_APP'.
m_sort 'BZIRK'.
ENDCASE.
ls_fieldcat-COL_POS = 1.
ls_fieldcat-FIELDNAME = 'BZIRK'.
ls_fieldcat-DO_SUM = 'X'.
ls_fieldcat-FIX_COLUMN = 'X'.
APPEND ls_fieldcat TO lT_fieldcat.
IF u_no CA '13'.
MOVE 'TOP_OF_PAGE' TO ls_event-name.
CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ELSE.
MOVE 'TOP_OF_LIST' TO ls_event-name.
CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = lt_fieldcat
is_layout = ls_layout
i_tabname = u_tabname
it_events = lt_events
it_sort = lt_sort
TABLES
t_outtab = ut_table
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
ENDFORM. " LIST_APPEND
Form f_list_display
FORM f_list_display.
DATA ls_print TYPE slis_print_alv.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = ls_print
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. " F_LIST_DISPLAY
Thanks in advance.
A S VINCENTHai Vincent
Check the following Code
*& Report ZALV_BLOCK *
REPORT ZALV_BLOCK NO STANDARD PAGE HEADING
MESSAGE-ID ZZ.
*..Type Definitions for ALV Report
TYPE-POOLS SLIS.
Table Declarations. *
TABLES: MARA, "Material Master
MARC, "Plant Data for Material
MARD, "Storage Location Data for Material
VBAP, "Sales Document: Item Data
VBUP. "Sales Document: Item Status
Internal table to store sales orders.......
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_VBAP.
internal table to store final data
DATA: BEGIN OF IT_FINAL OCCURS 0,
WERKS LIKE MARD-WERKS, "Plant
MATNR LIKE MARD-MATNR, "Material Number
LGORT LIKE MARD-LGORT, "Storage Location
LABST LIKE MARD-LABST, "Valuated stock with unrestricted use
INSME LIKE MARD-INSME, "Stock in quality inspection
RETME LIKE MARD-RETME, "Blocked Stock Returns
UMLME LIKE MARD-UMLME, "Stock in transfer
MAKTX LIKE MAKT-MAKTX, "Material description
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_FINAL.
ALV Type declaration *
*..Field Catalog for Basic List.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*..Events For Basic List.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT.
*..Layout For Basic List
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*..Sort Table For Basic List
DATA: IT_SORT TYPE SLIS_SORTINFO_ALV OCCURS 0 WITH HEADER LINE.
DATA DECLARATIONS *
DATA: V_FLAG,
VINDEX TYPE SY-TABIX,
TOTAL TYPE VBAP-KWMENG. "Open order quantity
*..To Store Program Name
DATA: V_REPID TYPE SYREPID.
*..To know whether basic list contains any data
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,
S_WERKS FOR MARC-WERKS,
S_LGORT FOR MARD-LGORT.
SELECTION-SCREEN END OF BLOCK B1.
Event:Initialization *
INITIALIZATION.
V_REPID = SY-REPID.
AT Selection Screen. *
AT SELECTION-SCREEN.
PERFORM VALIDATIONS.
Event: Start-of-Selection *
START-OF-SELECTION.
To get data from vbap into internal table IT_VBAP
PERFORM FETCH_OPEN_DATA.
To get data into final internal table IT_FINAL
IF V_FLAG = 'X'.
PERFORM FETCH_FINAL_DATA.
ENDIF.
IF V_FLAG = ''.
MESSAGE I010 WITH 'NO DATA TO BE DISPLAYED'.
EXIT.
ELSE.
--Setting the FIELD CATALOG for ALV
PERFORM FILL_FIELDCAT_HEADER.
*-----Setting the LAYOUT for ALV
PERFORM GET_LAYOUT.
*-----Getting the ALV Events
PERFORM GET_EVENT.
*---- To Sort the list
PERFORM DO_SORT.
ENDIF.
Event: End-of-Selection *
END-OF-SELECTION.
*--Generating the ALV LIST DISPLAY
PERFORM DISPLAY_LIST.
FORM DEFINITIONS *
*& Form VALIDATIONS
To validate data in selection screen
--> p1 text
<-- p2 text
FORM VALIDATIONS.
PERFORM VALIDATE_MATNR.
PERFORM VALIDATE_WERKS.
PERFORM VALIDATE_LGORT.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT SINGLE MATNR
WERKS
LGORT
FROM MARD
INTO (MARD-MATNR, MARD-WERKS, MARD-LGORT)
WHERE MATNR = MARA-MATNR
AND WERKS = MARC-WERKS
AND LGORT = MARD-LGORT.
ENDIF.
ENDFORM. " VALIDATIONS
*& Form VALIDATE_MATNR
To validate MATNR
--> p1 text
<-- p2 text
FORM VALIDATE_MATNR.
IF NOT S_MATNR[] IS INITIAL.
SELECT MATNR
UP TO 1 ROWS
INTO (MARD-MATNR)
FROM MARA
WHERE MATNR IN S_MATNR.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-001.
ENDIF.
ENDFORM. " VALIDATE_MATNR
*& Form VALIDATE_WERKS
To validate plant
--> p1 text
<-- p2 text
FORM VALIDATE_WERKS.
IF NOT S_WERKS[] IS INITIAL.
SELECT WERKS
UP TO 1 ROWS
INTO (MARD-WERKS)
FROM MARC
WHERE WERKS IN S_WERKS.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-002.
ENDIF.
ENDFORM. " VALIDATE_WERKS
*& Form VALIDATE_LGORT
To validate storage
--> p1 text
<-- p2 text
FORM VALIDATE_LGORT.
IF NOT S_LGORT[] IS INITIAL.
SELECT LGORT
UP TO 1 ROWS
INTO (MARD-LGORT)
FROM MARD
WHERE LGORT IN S_LGORT.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-003.
ENDIF.
ENDFORM. " VALIDATE_LGORT
*& Form FETCH_OPEN_DATA
To get data into internal table IT_VBAP
--> p1 text
<-- p2 text
FORM FETCH_OPEN_DATA.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP
WHERE MATNR IN S_MATNR
AND WERKS IN S_WERKS
AND LGORT IN S_LGORT.
ENDIF.
LOOP AT IT_VBAP.
SELECT * FROM VBUP
INTO VBUP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND LFSTA NE 'C'.
ENDSELECT.
ENDLOOP.
IF SY-SUBRC NE 0.
REFRESH IT_VBAP.
MESSAGE E000 WITH TEXT-004.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
To get sum of all quantities as open order quantity
LOOP AT IT_VBAP.
TOTAL = TOTAL + IT_VBAP-KWMENG.
ENDLOOP.
ENDFORM. " FETCH_OPEN_DATA
*& Form FETCH_FINAL_DATA
To get data into final internal table IT_FINAL
--> p1 text
<-- p2 text
FORM FETCH_FINAL_DATA.
SELECT A~MATNR
A~WERKS
A~LGORT
MAKTX
LABST
INSME
RETME
UMLME
VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
FROM MARD AS A
INNER JOIN MAKT AS B
ON AMATNR = BMATNR
AND SPRAS = 'E'
INNER JOIN VBAP AS C
ON AMATNR = CMATNR
FOR ALL ENTRIES IN IT_VBAP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND KWMENG = IT_VBAP-KWMENG
AND A~MATNR IN S_MATNR
AND A~WERKS IN S_WERKS
AND A~LGORT IN S_LGORT.
IF SY-SUBRC NE 0.
V_FLAG = SPACE.
MESSAGE E001 WITH 'No data found IN the selection criteria'.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
ENDFORM. " FETCH_FINAL_DATA
*& Form FILL_FIELDCAT_HEADER
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_HEADER .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_FINAL'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_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.
LOOP AT IT_FIELDCAT INTO WA_FIELDCAT.
CASE WA_FIELDCAT-FIELDNAME.
WHEN 'KWMENG'.
WA_FIELDCAT-COL_POS = '11'.
WA_FIELDCAT-OUTPUTLEN = '22'.
WA_FIELDCAT-SELTEXT_L = 'Net Value'.
WA_FIELDCAT-DO_SUM = 'X'.
ENDCASE.
MODIFY IT_FIELDCAT FROM WA_FIELDCAT INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_HEADER
*& Form GET_LAYOUT
text
--> p1 text
<-- p2 text
FORM GET_LAYOUT .
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. " GET_LAYOUT
*& Form GET_EVENT
text
--> p1 text
<-- p2 text
FORM GET_EVENT .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS
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.
LOOP AT IT_EVENTS INTO WA_EVENTS.
CASE WA_EVENTS-NAME.
WHEN 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'FILL_LIST_HEADER'.
WHEN 'USER_COMMAND'.
WA_EVENTS-FORM = 'PROCESS_BASIC_LIST'.
ENDCASE.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_EVENT
FORM FILL_LIST_HEADER *
FORM FILL_LIST_HEADER.
WRITE:2'Report :' , SY-REPID,
: 85 ' Intelligroup Asia Pvt Ltd' CENTERED,
: 159 'Date :' ,SY-DATUM,
:/2'User :', SY-UNAME,
: 82 ' Hyderabad ' CENTERED ,
: 159 'Pg.No :' ,SY-PAGNO,
:/86 ' Stock Report ' CENTERED.
SKIP 2.
ENDFORM. "FILL_LIST_HEADER
*& Form DISPLAY_LIST
text
--> p1 text
<-- p2 text
FORM DISPLAY_LIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = 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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
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_LIST
*& Form do_sort
text
--> p1 text
<-- p2 text
FORM DO_SORT .
*-- Populating the sort table
IT_SORT-FIELDNAME = 'MATNR'.
IT_SORT-TABNAME = 'IT_FINAL'.
IT_SORT-UP = 'X'.
it_sort-subtot = 'X'.
APPEND IT_SORT.
ENDFORM. " do_sort
Thanks & Regards
Sreenivasulu P -
Hi All,
I have developed a ALV grid report where my first feild is checkbox.My requirement is that when user select some records using check box in output then a BDC should call to update each records.
But i am enable to get checked records when i click a button on application toolbaar.Please sugest me the way to get checked records.
I have used below code:
WA_FIELDCAT-FIELDNAME = 'CHECKBOX'.
WA_FIELDCAT-TABNAME = 'IT_BLOCKED_CUS'.
WA_FIELDCAT-CHECKBOX = 'X'.
wa_FIELDCAT-INPUT = 'X'.
WA_FIELDCAT-EDIT = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'KUNN2'.
WA_FIELDCAT-TABNAME = 'IT_BLOCKED_CUS'.
WA_FIELDCAT-SELTEXT_L = TEXT-001.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'KUNNR'.
WA_FIELDCAT-TABNAME = 'IT_BLOCKED_CUS'.
WA_FIELDCAT-SELTEXT_L = TEXT-002.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EVENTS = IT_EVENTS
I_SAVE = 'A'
I_GRID_SETTINGS = S_GLAY
IT_SORT = IT_SORT
I_DEFAULT = 'X'
TABLES
T_OUTTAB = IT_BLOCKED_CUS
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE I018.
LEAVE LIST-PROCESSING.
ENDIF.
FORM PF_STATUS USING LT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ZSTATUS'.
ENDFORM.
FORM USER_COMMAND USING G_UCOMM TYPE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
data: REF_GRID TYPE REF TO CL_GUI_ALV_GRID,
l_valid type c.
CASE G_UCOMM.
WHEN '&BLK_UNBLK'.
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA
ENDIF.
loop at IT_blocked_cus into wa_blocked_cus where CHECKBOX = 'X' .
PERFORM CALL_BDC.
endloop.
Please help me.
Regards,
Mohit khandelwalFORM USER_COMMAND USING G_UCOMM TYPE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
data: REF_GRID TYPE REF TO CL_GUI_ALV_GRID,
l_valid type c.
break-point.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA
ENDIF.
CASE G_UCOMM.
WHEN '&BLK_UNBLK'.
loop at IT_blocked_cus into wa_blocked_cus where CHECKBOX = 'X' .
PERFORM CALL_BDC.
endloop.
endcase.
endform.
keep break-point in the above form and see. what is happening. -
Hello Experts,
Any examples would be highly appreciated.Thank you and take care!Hi,
Check this thread for ALVs -
Interactive ALV
ashish -
Can I get a sample program of ALV (oops) with check boxes in it. thank you.
Types: begin of lt_io.
include structure mara. " Your Structure
Types: style_table type lvc_t_style.
Types: end of lt_io.
data: lt_io type table of lt_io,
ls_layout type lvc_s_layo,
lt_fcat type lvc_t_fcat,
lo_grid type ref to cl_gui_alv_grid.
field-symbols: <io> type lt_io,
<fcat> type lvc_s_fcat.
... fill your output table ....
ls_layout-stylefname = 'STYLE_TABLE'.
loop at lt_io assigning <io>.
PERFORM set_style USING 'CHECKBOX' "Your Filename
CHANGING <io>.
endloop.
... Fill Your Field Catalog lt_fcat
read table lt_fcat assigning <fcat>
where fieldname = 'CHECKBOX'.
<fcat>-checkbox = 'X'.
create grid control lo_grid.
CALL METHOD lo_grid->set_table_for_first_display
EXPORTING
is_layout = ls_layout
CHANGING
it_fieldcatalog = lt_fcat
it_outtab = lt_io[].
FORM set_button_to_line
USING iv_fieldname TYPE lvc_fname
CHANGING cs_io TYPE io.
DATA: ls_style TYPE lvc_s_styl,
lt_style TYPE lvc_t_styl.
ls_style-fieldname = iv_fieldname.
if cs_io-checkbox = ' '.
ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
else.
ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
endif.
ls_style-maxlen = 2.
INSERT ls_style INTO TABLE io-style_table.
ENDFORM. "set_icon_to_status_line
[/code].
A classical report is a program that generates a single list, which must contain all of the required detail information.
1) This procedure may result in extensive lists from which the user has to pick the relevant data.
2) For background processing, this is the only possible method. After starting a background job, there is no way of influencing the program.
3) The desired selections must be made beforehand and the list must provide detailed information.
4) For dialog sessions, there are no such restrictions.
5) The user is present during the execution of the program and can control and manipulate the program flow directly.
6) To be able to use all advantages of the online environment, classical reporting was developed into interactive reporting.
ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain up to 90 columns in the display with the wide array of display options.
Advantages.
Collapse multiple reports into one, drastically cutting down your report development time
Save many hours using built-in ALV sorting, subtotaling and filtering capabilities
Add conditional structures into your ALV report: No programming required!
Combine ALV with display variants to meet a wide range of reporting requirements more easily
Dynamically reorder column layouts and add/subtract fields
Enable users and analysts to save their own personalized variants
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action
Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
declarations for spl.group.
GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV
GT_SORT TYPE SLIS_T_SORTINFO_ALV, "for sort
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'FIELD1'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
ls_sort-subtot = 'X'. "subtotal
APPEND LS_SORT TO E06_LT_SORT.
APPEND LS_SORT TO E06_LT_SORT.
LS_SORT-FIELDNAME = 'FIELD2'.
LS_SORT-SPOS = 2.
LS_SORT-UP = 'X'.
ls_sort-subtot = 'X'. "subtotal
APPEND LS_SORT TO E06_LT_SORT.
for creating the group..
DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
CLEAR LS_SP_GROUP.
LS_SP_GROUP-SP_GROUP = 'A'.
LS_SP_GROUP-TEXT = TEXT-005.
APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
and pass this info to FM...
layout-sUBTOTALS_TEXT = 'SUbt...'
and pass spl group info to fieldcatalog also...
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
IT_SORT = GT_SORT[]
TYPES :
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
waerk TYPE vbak-waerk, " Document currency
END OF ty_vbak.
DATA:
vbak TYPE vbak,
gt_vbak TYPE TABLE OF ty_vbak.
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
Form f_read_data
FORM f_read_data.
SELECT vkorg kunnr vbeln netwr waerk
UP TO p_max ROWS
INTO TABLE gt_vbak
FROM vbak
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
Form f_display_data
FORM f_display_data.
TYPE-POOLS: slis. " ALV Global types
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM.
Check out these sample programs
BCALV_GRID_01
This program illustrates how the events for print processing PRINT_TOP_OF_PAGE,
PRINT_END_OF_PAGE, PRINT_TOP_OF_LIST,PRINT_END_OF_LIST are handled. The
corresponding handler methods control the appearance of the list printed.
BCALV_GRID_02
Show a detail list in an amodal window. There is no second dynro needed in contrast to
BCALV_GRID_03.
BCALV_GRID_03
This program implements a function on event DOUBLE_CLICK. According to the selected line data
from table SBOOK is selected and displayed by a second ALV Control in a dialog dynpro.
BCALV_GRID_04
Illustrates the use of exceptions (lights or leds). According to the values of SFLIGHT-SEATSOCC, the
lights are set to 1 (red), 2 (yellow) or 3 (green).
BCALV_GRID_05
Demonstrate the creation of an own toolbar button.
BCALV_GRID_06
Demonstrate the creation of an own context menu.
BCALV_GRID_07
Append a menu button to the standard toolbar.
BCALV_GRID_08
Append a menu with default button to the standard toolbar. It is exactly the same as
BCALVC_TB_WITH_MENU except for methods HANDLE_MENU_BUTTON and HANDLE_TOOLBAR.
Editable ALV grids
BCALV_EDIT_01
This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
BCALV_EDIT_02
This report illustrates how to set chosen cells of an ALV Grid Control editable.
BCALV_EDIT_03
In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
The report checks the input value(s) semantically and provides protocol messages in case of error
BCALV_EDIT_04
This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
implement the saving of the new data.
BCALV_EDIT_05
This example shows how to use checkboxes within an ALV Grid Control. You learn:
(1) how to define a column for editable checkboxes for an attribute of your list
(2) how to evaluate the checked checkboxes
(3) how to switch between editable and non-editable checkboxes
BCALV_EDIT_06
This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
Grid Control.
BCALV_EDIT_07
This example shows how to define dropdown listboxes for particular cells of your output table.
BCALV_EDIT_08
This report implements an ALV Grid Control with an application specific F4 help. The following aspects
are dealt with:
(1) how to replace the standard f4 help
(2) how to pass the selected value to the ALV Grid Control
(3) how to build an f4 help, whose value range depend on a value of another cell.
Check this link tooo
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/07/23/oopsALVin+ABAP&showComments=true
The ALV Grid Control is a tool with which you can output non-hierarchical lists in a
standardized format. The list data is displayed as a table on the screen.
The ALV Grid Control offers a range of interactive standard list functions that users need
frequently (find, sort, filter, calculate totals and subtotals, print, print preview, send list,
export list (in different formats), and so on. These functions are implemented in the
proxy object class. You as the programmer have the possibility to turn off functions not
needed. In most cases the implementations of the standard functions provided by the
control are sufficient. However, if required, you can adjust these implementations to
meet application-specific needs.
You can add self-defined functions to the toolbar, if necessary.
The ALV Grid Control allows users to adjust the layout of lists to meet their individual
requirements (for example, they can swap columns, hide columns, set filters for the
data to be displayed, calculate totals, and so on). The settings (list customizing) made
by a specific user are called a display variant. Display variants can be saved on a userspecific
or on a global basis. If such display variants exist for a list, they can be offered
to the user for selection. If a display variant is set as the default variant, the associated
list is always displayed based on the settings of this variant.
2. REUSE_ALV_LIST_DISPLAY
REUSE_ALV_GRID_DISPLAY
REUSE_ALV_FIELDCATALOG_MERGE
REUSE_ALV_COMMENTARY_WRITE
3. Use of Field Catalog is to determines the technical properties & add formating information of the column.
6. all the definition of internal table, structure, constants are declared in a type-pool called SLIS.
7.fieldcat-fieldname
fieldcat-ref_fieldname
fieldcat-tabname
fieldcat-seltext_m
5. Form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.
Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
The report output can contain up to 90 columns in the display with the wide array of display options.
The commonly used ALV functions used for this purpose are;
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
Purpose of the above Functions are differ not all the functions are required in all the ALV Report.
But either no.7 or No.8 is there in the Program.
How you call this function in your report?
After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.
Then use follwing function module.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Prog.name'
I_STRUCTURE_NAME = 'I_ITAB'
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = I_ITAB.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC .
ENDIF.
ENDFORM. " GET_FINAL_DATA
The object F_IT_ALV has a field, the activity ACTVT, which can
contain four permitted values: 01, 02, 03 and 70. Each of the
activities 01, 02 and 70 controls the availability of particular
functions (in the menu and the toolbar) of the ALV line item list:
a) 01: "Settings -> Display variant -> Save..."
b) 02: "Settings -> Display variant -> Current..." and
"Settings -> Display variant -> Current header rows "
c) 70: "Settings -> Display variant -> Administration..."
Activity 03 corresponds to the minimum authorization, which is the
most restricted one: The user can only select layouts which have
been configured already. In particular, all of the other functions
named above are inactive with activity 03.
Now if you want to permit a user to change the column selection and
the headers as well as to save the layout thus created, for example,
but if you do not want to permit the user to administrate the
layouts, you grant him or her the authorization for activities 01
and 02.
Check this link it will be mosty usefull for u
http://www.sap-img.com/fu017.htm
check this link
http://abapprogramming.blogspot.com/
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
Changing width of a custom container dynamically
Display Page numbers in ALV
Insert picture in selection screen.
Logo in OO ALV Grid
check these links
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
Try these links
Simple ALV report
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
For More alv report examples check these Tcodes LIBS, BIBS Here u can find more number of examples on alv reports of different kinds
check this sample code for intercative alv report
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
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.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'this is my first alv pgm'.
HLINE-TYP = 'H'.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH -
ABAP list with multiple headers
Hi experts,
i have to display a table with multiple headers. Example:
Header 1 = Sales order header
Header 2 = Sales order items
It's possible to create an ABAP list with 2 headers?
Thanks in advance.Hi Dan,
FYI .
[ALV Grid with Multiple Headers;
Regards
Abhii -
Drag and Drop multiple boxes and snap to multiple locations then reveal button
Hi I'm Trying to develop a small game where the user chooses from a range of boxes of the left of screen and can drag 3 of them separatley to 3 holding boxes on ther right. each box can be dragged to any location and the order is not important. Once the 3 holding boxes are all full I want a new button to appear. I completed a tutorial and I've got one box working perfectly but no matter what i try I can't get it working with multiple boxes and locations. Below is a list of the instance names of the movie clips plus my actionscript. I've attached a link to the flash file. Any help would be really appreciated. Cheers
LINK
http://www.sainters.net/flash_preview/flash_test/flash test_v6.fla.zip
INSTANCE NAMES
box 1 = "circle_mc"
box 2 = "circle_mc2"
both the grey boxes are called = "targetCircle"
ACTIONSCRIPT
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(1);
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
dragSetup(circle_mc,targetCircle);Two things...
1) if you want both circles to be draggable you need to execute that last line twice, once for each.
dragSetup(circle_mc); // left off second argument purposefully
dragSetup(circle_mc2);
2) you do not want to name the targets the same name... only one will work as a target that way. GIve them different names, and assign each one a property like...
targetCircle1.isTarget == true;
targetCircle2.isTarget == true;
and in your hittest function test for that property. And if you don't want to allow the user to drop two circles on the same target, set that property to false after it is dropped on... something like...
if (this._droptarget.isTarget) { // may still need eval() portion
this._droptarget.isTarget = false;
Back to item 1... with this approach you won't need to pass the target as an argument, unless you need to have each circle dropped on a specific target instead of any of them (in that case you go back to specifying and testing the target instance)
Your overall dragSetup function will change in various ways if you follow what is offered here as far as allowing for any circle to be placed on any target. If you require specific targets, then your code would remain much as it is except you still need different instance names for all the objects. -
Analysis Authorization based on Hier node with multiple display hierarchies
Hi guys - I've got a problem where s.o. might have an idea of how to switch on the light at the end of the tunnel, I am currently standing in:
Requirement:
Cost Center Authorization should be given through RSECADMIN, reporting should be possible for any hierarchy that exists for the authorization relevant info object.
Preferred solution:
The Cost Center Analysis Authorization should be given through RSECADMIN - Hierarchy node assignment.
u2022 A dedicated Authorization Cost Center Hierarchy will be maintained in ECC6 as an alternative cost center hierarchy and extracted into BW.
u2022 The RSECADMIN Hierarchy node assignment should be based on a particular node (Type 2).
u2022 The display level will be specified as required (here: Level 7)
u2022 The Authorization granted should be independent of hierarchy name and version (validity 3).
Reporting Scenario and technical impact:
As mentioned above, when designing and running a query the user should be able to freely select other (i.e. than the authorization) display hierarchies for the authorization relevant reporting object 'Cost Center' as well. The technical names of the semantically relevant hierarchy nodes could therefore vary. E.g. cost centers 1, 2 and 3, being assigned under hierarchy node u2018Au2019 of the RSECADMIN relevant authorization hierarchy, could be subsumed by hierarchy node u2018Bu2019 in another display hierarchy, which the user may want to display in accordance to his reporting needs. Ideally, the alternative display hierarchy should therefore display node u2018Bu2019.
My findings so far (based on prototyping) turn out that this is not possible as long u2018Bu2019 (and its hierarchy) is not authorized in RSECADMIN. Can these findings be confirmed? And if not, would anyone have an idea of how to facilitate the reporting scenario?
Would there be any other way to grant access, possibly based on RSECADMIN single values, and also enable the user to flexibly display hierarchies with only those hierarchy nodes whose single cost center values the user has been given access to?
Thanks everyone for your input...
Claus
Edited by: Claus64 on Jul 13, 2009 4:10 AMHI CLause,
On Jul 14 2009, you wrote in SDN and said:
FYI: Found a solution...
The hierarchy analysis authorization will be based on a navigational attribute of cost center.
With analysis authorizations it is possible to declare the Auth object (e.g. 0COSTCENTER__RACCAUT0) as authorization relevant and leave the superior object 0COSTCENTER auth irrelevant.
The auth will be given for 0COSTCENTER__RACCAUT0. This object will be placed as a filter of the query, being restricted by an Authorization variable for hierarchy nodes.
Due to the concept of Analysis Authorizations, this variable will automatically pick up the nodes granted as part of RSECADMIN Hierarchy based Authorization.
As mentioned above, 0COSTCENTER as the regular reporting characteristic remains auth irrelevant and can therefore take any hierarchy thatu2019s available. Reporting on single values will be possible, too. Only those nodes show up that hold the authorized cost centers in accordance to the authorization.
If the auth relevant 0COSTCENTER__RACCAUT0 is not used in the query definition by either not taking it in as a filter or skipping the Auth variable, the query will launch the message that the authorization is missing. No data show up at all.
Claus
See this thread:
Analysis Authorization based on Hier node with multiple display hierarchies
I am also in the same situation as you and need to understadn your solution. I understand that you created a Nav Attr on 0COSTCENTER and made this auth relevant whilst ensuring that 0COSTCENTER is NOT auth relevant. This is all fine. The issue was you have multiple hierachies for 0COSTCENTER, how did the new Nav Attr help you solve your issue. When loading 0COSTCENTER what values did you load ino the new Nav Attribute and how did that link to the hierachies? Also, in RSECADMIN you created hiearchy nodes based on the Nav Attribute but I am confused as to what values you have in the Nav Attr.
I appreciate if you can share your solution from the past in more details.
many thanks -
Using HLEVEL Property with Multiple Hierarchies
Hello,
I am trying to use the HLEVEL property on a dimension to indent the rows different amounts. Easy stuff, except I'm doing a row expansion on hierarchy 3 (H3). Using EVPRO(AppName, MemberID, "HLEVEL") always returns the HLEVEL from H1. If you select the same member ID in the member selector under different hierarchies and click the Properties button you can see a different value for HLEVEL, but I can't figure out how to get that in a report using EVPRO.
Is there a way to tell EVPRO specifically which hierarchy to use when returning the value for HLEVEL?
Thanks!
Paul Petersen
AkiliMike,
please check the answer in this other post:
EVPRO with multiple hierarchies
It's for the MS platform, but it's the same for Netweaver.
EVPRO can only retrieve the HLEVEL for the first hierarchy. You need to maintain further custom properties if you want to get the level of a member within multiple hierarchies.
Regards,
Simmaco
Maybe you are looking for
-
Can anyone explain why following code doesn't work in my KM: <% String viewName = new String (snpRef.getInfo("COLL_NAME")); nameLength = viewName.length(); if (nameLength >30) { viewName = viewName.substring(0,30); %> It falls with exception: co
-
Hi all, We just moved some java JSP's/code to a new Apache2(2.0.55)/Tomcat5.5.12 running Java 1_05_05 server. Java -version: java version "1.5.0_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05) Java HotSpot(TM) Server VM (bui
-
It does not work ((( It says it hasnt been probaly activated my gift card was 15 pounds too please help
-
Dear Gurus, Maintain the calendar in SAP as per the Bank Holidays which is required for "Payment Schedule Run" and "Payment Notice Report". How we can configure the same. If we maintaing changes in Factory calender directly what was the impact to oth
-
Hi, I am working on financial Reporting 11.1.1.3 version. While designing the reports, how can set the page fields separately. Eg: In page am setting period (Jan - Dec) and Scenario (Actual and budget). Running the report in page Jan , Actual Feb. Ac