Sorting problem in ALV
I am facing the following problem:
I have an ALV list in the following format:
fld1 fld2 fld3
bb1 bb2 comp1
<blank> <blank> comp2
<blank> <blank> comp3
aa1 aa2 comp4
<blank> <blank> comp5
<blank> <blank> comp6
<blank> <blank> comp7
<blank> - spaces are displayed
where:
comp1 ; comp2 ; comp3 -> belong to bb1 (fld1) field and
comp4 ; comp5 ; comp6 ; comp7 -> belong to aa1 (fld1) field
Now, when the user is sorting the ALV report by field: "Fld1" (by clicking on the ascending or descending sort buttons on ALV), the ALV list is displayed in the following format:
fld1 fld2 fld3
<blank> <blank> comp2
<blank> <blank> comp3
<blank> <blank> comp5
<blank> <blank> comp6
<blank> <blank> comp7
aa1 aa2 comp4
bb1 bb2 comp1
where as, I was expecting the output to be in this format:
fld1 fld2 fld3
aa1 aa2 comp4
<blank> <blank> comp5
<blank> <blank> comp6
<blank> <blank> comp7
bb1 bb2 comp1
<blank> <blank> comp2
<blank> <blank> comp3
Problem: The "<blanks>" in the ALV are also sorted and fld3 is not attached with fld1 and fld2.
Is there any way by which I can avoid this problem??
I am using "set_table_for_first_display" method to display the ALV report.
I have already tried grouping fld3 (comp's) by fld1 and fld2 using nested internal table (both statically and using pointers) and passing it to ALV via. "r_alv_grid->set_table_for_first_display" method. However, this didnt work.
Please help.
REPORT ZBLOCK_ALV.
CONSTANTS :
c_x VALUE 'X'.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-tabname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
TYPE-POOLS: slis. " ALV Global types
TYPES:
1st Table
BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr, " Customer number
ernam TYPE kna1-ernam, " Name of Person who Created
erdat TYPE kna1-erdat, " Creation date
name1 TYPE kna1-name1, " Name 1 .
END OF ty_kna1,
2nd Table
BEGIN OF ty_mara,
matnr TYPE mara-matnr, " Material number
ernam TYPE mara-ernam, " Name of Person who Created
ersda TYPE mara-ersda, " Creation date
mtart TYPE mara-mtart, " Material type
matkl TYPE mara-matkl, " Material group
END OF ty_mara,
3rd Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
vkorg TYPE vbak-vkorg, " Sales organization
vtweg TYPE vbak-vtweg, " Distribution channel
kunnr TYPE vbak-kunnr, " Sold-to party
erdat TYPE vbak-erdat, " Creation date
END OF ty_vbak.
DATA:
gs_layout TYPE slis_layout_alv,
gt_kna1 TYPE TABLE OF ty_kna1,
gt_mara TYPE TABLE OF ty_mara,
gt_vbak TYPE TABLE OF ty_vbak.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '02' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
Read data
SELECT kunnr ernam erdat name1
FROM kna1
UP TO p_max ROWS
INTO TABLE gt_kna1.
SELECT matnr ernam ersda mtart matkl
FROM mara
UP TO p_max ROWS
INTO TABLE gt_mara.
SELECT vbeln vkorg vtweg kunnr erdat
FROM vbak
UP TO p_max ROWS
INTO TABLE gt_vbak.
END-OF-SELECTION.
PERFORM f_display_data.
FORM USER_COMMAND *
FORM user_command USING u_ucomm TYPE sy-ucomm
us_selfield TYPE slis_selfield. "#EC CALLED
DATA:
ls_vbak TYPE ty_vbak.
CASE u_ucomm.
WHEN '&IC1'. " Pick
CASE us_selfield-tabname.
WHEN 'GT_MARA'.
WHEN 'GT_KNA1'.
WHEN 'GT_VBAK'.
READ TABLE gt_vbak INDEX us_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND
Form f_display_data
FORM f_display_data.
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
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
gs_layout-group_change_edit = c_x.
gs_layout-colwidth_optimize = c_x.
gs_layout-zebra = c_x.
gs_layout-detail_popup = c_x.
gs_layout-get_selinfos = c_x.
Build field catalog and sort table
m_fieldcat 'KUNNR' 'KNA1' 'GT_KNA1'.
m_fieldcat 'ERNAM' 'KNA1' 'GT_KNA1'.
m_fieldcat 'ERDAT' 'KNA1' 'GT_KNA1'.
m_fieldcat 'NAME1' 'KNA1' 'GT_KNA1'.
m_sort 'KUNNR'.
Build Event Table
MOVE 'TOP_OF_PAGE' TO ls_event-name.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO lt_events.
MOVE 'END_OF_LIST' TO ls_event-name.
MOVE 'END_OF_LIST' TO ls_event-form.
APPEND ls_event TO lt_events.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_events = lt_events
it_sort = lt_sort
i_save = 'A'
TABLES
t_outtab = gt_kna1.
ENDFORM. " F_DISPLAY_DATA
FORM top_of_page *
FORM top_of_page. "#EC CALLED
ULINE.
WRITE : sy-uname, sy-title(56) CENTERED, sy-datum.
ULINE.
ENDFORM. " TOP_OF_PAGE
FORM End_of_list *
FORM end_of_list. "#EC CALLED
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
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
Build field catalog and sort table
m_fieldcat 'MATNR' 'MARA' 'GT_MARA'.
m_fieldcat 'ERNAM' 'MARA' 'GT_MARA'.
m_fieldcat 'ERSDA' 'MARA' 'GT_MARA'.
m_fieldcat 'MTART' 'MARA' 'GT_MARA'.
m_fieldcat 'MATKL' 'MARA' 'GT_MARA'.
m_sort 'MATNR'.
Build Event Table
MOVE 'END_OF_LIST' TO ls_event-name.
MOVE 'END_OF_LIST_2' TO ls_event-form.
APPEND ls_event TO lt_events.
gs_layout-list_append = c_x.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_sort = lt_sort
it_events = lt_events
i_save = 'A'
TABLES
t_outtab = gt_mara.
ENDFORM. " END_OF_LIST
FORM End_of_list_2 *
FORM end_of_list_2. "#EC CALLED
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
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
Build field catalog and sort table
m_fieldcat 'VBELN' 'VBAK' 'GT_VBAK'.
m_fieldcat 'VKORG' 'VBAK' 'GT_VBAK'.
m_fieldcat 'VTWEG' 'VBAK' 'GT_VBAK'.
m_fieldcat 'KUNNR' 'VBAK' 'GT_VBAK'.
m_fieldcat 'ERDAT' 'VBAK' 'GT_VBAK'.
m_sort 'VBELN'.
Build Event Table
MOVE 'TOP_OF_PAGE' TO ls_event-name.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO lt_events.
gs_layout-list_append = c_x.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_sort = lt_sort
it_events = lt_events
i_save = 'A'
TABLES
t_outtab = gt_vbak.
ENDFORM. " END_OF_LIST_2
Similar Messages
-
Sutotal Problem in ALV for three sorted columns
Hello experts,
i am developing one ALV report for purcj=hase history vendor wise and material group wise.
i am fetching data from rbkp,rseg,mara,makt.
i am also fetching tax code.problem is that that there are 3 columns have group wise and i need sutotal on tax code wise and vendor wise quantity.
please help me for sort problem.
thanksHi Abhishek,
Click on below links:
[http://wiki.sdn.sap.com/wiki/display/Snippets/DisplaysubtotaltextinALV+grid]
[ALV - Sort - Subtotal;
BR
Dep -
How to display output only sort format in alv
Hi Experts,
I have one problem in alv output display. I'm developing alv report for orders raised during the period.I want to display each order wise value(netwr) and order quatity (kwmeng) . i set 8 radio buttons one radio btn click then i want output ex.in grid display click on sort then each order wise calculate the value and quantity . that particular data to display when click on radio button.
ex:click on sort in grid display.
(branch) (order no) (quantity) (value) (BSTNK)
AMUM 0000003354 2 10 3,271
AMUM 0000003354 1 10 6,542
(above qty sum 2+1=3)
(SUM) = AMUM 0000003354 3 20 9,813
HIP2 0000003362 2 5 17,810
HIP2 0000003362 1 5 23,075
(sum) = HIP2 0000003362 10 40,885
i display output in alv griddisplay.client asking one rb put in selection screen i want output like above only sum col.
when i click one radio button output is come like (sum) above.
Please help me.
Thanks & Regards,
Balakrishna Gajulahi you need to use sortinfo for your requirement.
ie see the below code.
"declare sortinfo at data declaration
data: wa_sort type slis_sortinfo_alv, "''' add this
layout type slis_layout_alv. "add this
""make the below changes in your fieldcat
wa_fieldcat-tabname = 'FINAL'.
wa_fieldcat-seltext_m = 'Td - Rvdt'.
wa_fieldcat-fieldname = 'QUANTITY'.
wa_fieldcat-do_sum = 'X'. """"""add this to your *QUANTITY field*
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'FINAL'.
wa_fieldcat-seltext_m = 'temp''.
wa_fieldcat-fieldname = 'VALUE'.
wa_fieldcat-do_sum = 'X'. """"""add this to your *VALUE field*
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
""""" you need to add this after workarea of fieldcat
wa_sort-fieldname = 'BRANCH'. " Here Branch indicates the fieldname
wa_sort-subtot = 'X'.
append wa_sort to it_sort.
clear wa_sort.
wa_sort-fieldname = 'ORDERNO'.
append wa_sort to it_sort.
clear wa_sort.
" in your alv fm add sortinfo
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-cprog
is_layout = layout
it_fieldcat = it_fieldcat
it_sort = it_sort """""""""add this
tables
t_outtab = final " your internal table name
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.
This solves your purpose.
Regards,
koolspy. -
Hi Friends,
I have the following 2 problems in ALV report
1) Logo is not getting displayed in the report.
2) When i click on the Purchase order number in the report the interactive report is not working,i am not able to see report of First interactive level.
can you help it out friends.
Thanks and regards
Dinesh
REPORT YSDBALV1
tables: ekko , ekpo .
type-pools: slis .
Table for Display Header
data:i_header type slis_t_listheader with header line.
*Fieldcat Declaration
data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
*Table of Events
data:i_event type slis_t_event with header line .
For Layout
data:i_layout type slis_layout_alv .
data: text(30) .
*Internal Table Declaration
data: begin of it_final occurs 0 ,
ebeln like ekko-ebeln , "Purchasing Document No.
bedat like ekko-bedat , "Purchasing Document Date
matnr like ekpo-matnr , "Material No.
netwr like ekpo-netwr , "Net Order Value in PO Currancy
meins like ekpo-meins , "UOM
chk(1) ,
light(1) ,
change like ekpo-menge ,
end of it_final .
**select option Declaration
selection-screen begin of block block.
select-options: s_ebeln for ekko-ebeln .
selection-screen end of block block .
selection-screen begin of block block1 .
parameters:grid radiobutton group r .
parameters:list radiobutton group r .
selection-screen end of block block1 .
at selection screen
at selection-screen .
select single * from ekko where ebeln in s_ebeln .
if sy-subrc <> 0 .
message e000(8I) WITH 'No Data Exists' .
endif .
start-of-selection .
if grid = 'X' .
perform get_data .
perform event using i_event[] .
perform field using fieldcatalog[] .
perform layout using i_layout .
perform grid_display .
endif .
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
*DATA Retrieval from tables
SELECT EKKO~EBELN
EKKO~BEDAT
EKPO~EBELP
EKPO~MATNR
EKPO~NETWR
EKPO~MEINS
EKPO~MENGE
EKPO~BPRME
INTO CORRESPONDING FIELDS OF table IT_FINAL
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE EKKO~EBELN IN S_EBELN.
APPEND IT_FINAL.
endform. " get_data
*Getting the Event for Top of Page display.
*& Form event
text
-->P_I_event[] text
form event using p_i_event type slis_t_event.
clear p_i_event .
refresh p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_i_event
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
read table p_i_event with key name = slis_ev_top_of_page into i_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE_PO' to i_event-form.
modify p_i_event from i_event index sy-tabix transporting form.
endif.
clear i_event.
endform. " event
*Display Top-of Page Details and Logo
form top_of_page_po .
clear i_header .
refresh i_header .
write sy-datum to text.
i_header-typ = 'H'.
i_header-info = 'PURCHASE OREDER DETAILS'.
append i_header.
*Logo Display
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header[]
I_LOGO = 'ENJOYSAPLOGO'.
endform .
*Field Catalog Append
*& Form field
text
-->P_fieldCATALOG[] text
form field using p_fieldcatalog type slis_t_fieldcat_alv.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order No'.
fieldcatalog-col_pos = 1.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
fieldcatalog-seltext_m = 'PO Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 4.
fieldcatalog-outputlen = 20.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Net Value '.
fieldcatalog-col_pos = 5.
fieldcatalog-outputlen = 20.
fieldcatalog-do_sum = 'X'.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Units'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 4.
append fieldcatalog .
clear fieldcatalog.
endform. " field
*& Form layout
text
form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
i_layout-zebra = 'X'.
i_layout-lights_fieldname = 'LIGHT'.
i_layout-lights_tabname = 'IT_FINAL'.
i_layout-box_fieldname = 'CHK'.
i_layout-box_tabname = 'IT_FINAL'.
i_layout-edit = ' '.
endform.
*To display Buttons in the MENU BAR if needed
FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
SLIS_T_EXTAB.
SET PF-STATUS 'MENUPO'.
ENDFORM.
*Event for Interactive display of ALV report
form USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
if r_ucomm = '&IC1'.
READ TABLE IT_FINAL index rs_selfield-tabindex.
write:/ IT_FINAL-ebeln.
endif.
endform .
*Parameters of FM REUSE_ALV_GRID_DISPLAY
*& Form grid_display
text
--> p1 text
<-- p2 text
form grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = I_EVENT[]
TABLES
t_outtab = IT_FINAL.
endform. " grid_display*& Report YSDBALV1
REPORT YSDBALV1.
tables: ekko , ekpo .
type-pools: slis .
Table for Display Header
data:i_header type slis_t_listheader with header line.
*Fieldcat Declaration
data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
*Table of Events
data:i_event type slis_t_event with header line ,
wa_event type line of slis_t_event.
For Layout
data:i_layout type slis_layout_alv .
data: text(30) .
*Internal Table Declaration
data: begin of it_final occurs 0 ,
ebeln like ekko-ebeln , "Purchasing Document No.
bedat like ekko-bedat , "Purchasing Document Date
matnr like ekpo-matnr , "Material No.
netwr like ekpo-netwr , "Net Order Value in PO Currancy
meins like ekpo-meins , "UOM
chk(1) ,
light(1) ,
change like ekpo-menge ,
end of it_final .
**select option Declaration
selection-screen begin of block block.
select-options: s_ebeln for ekko-ebeln .
selection-screen end of block block .
selection-screen begin of block block1 .
parameters:grid radiobutton group r .
parameters:list radiobutton group r .
selection-screen end of block block1 .
at selection screen
at selection-screen .
select single * from ekko where ebeln in s_ebeln .
if sy-subrc <> 0 .
message e000(8I) WITH 'No Data Exists' .
endif .
start-of-selection .
if grid = 'X' .
perform get_data .
perform event using i_event[] .
perform field using fieldcatalog[] .
perform layout using i_layout .
perform grid_display .
endif .
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
*DATA Retrieval from tables
SELECT EKKO~EBELN
EKKO~BEDAT
EKPO~EBELP
EKPO~MATNR
EKPO~NETWR
EKPO~MEINS
EKPO~MENGE
EKPO~BPRME
INTO CORRESPONDING FIELDS OF table IT_FINAL
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE EKKO~EBELN IN S_EBELN.
APPEND IT_FINAL.
endform. " get_data
*Getting the Event for Top of Page display.
*& Form event
text
-->P_I_event[] text
form event using p_i_event type slis_t_event.
clear p_i_event .
refresh p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_i_event.
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
read table p_i_event with key name = slis_ev_top_of_page into wa_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE_PO' to i_event-form.
modify p_i_event from i_event index sy-tabix transporting form.
endif.
clear i_event.
endform. " event
*Display Top-of Page Details and Logo
form top_of_page_po .
clear i_header .
refresh i_header .
write sy-datum to text.
i_header-typ = 'H'.
i_header-info = 'PURCHASE OREDER DETAILS'.
append i_header.
*Logo Display
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header[]
I_LOGO = 'ENJOYSAP_LOGO'.
endform .
*Field Catalog Append
*& Form field
text
-->P_fieldCATALOG[] text
form field using p_fieldcatalog type slis_t_fieldcat_alv.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order No'.
fieldcatalog-col_pos = 1.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
fieldcatalog-seltext_m = 'PO Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 4.
fieldcatalog-outputlen = 20.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Net Value '.
fieldcatalog-col_pos = 5.
fieldcatalog-outputlen = 20.
fieldcatalog-do_sum = 'X'.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Units'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 4.
append fieldcatalog .
clear fieldcatalog.
endform. " field
*& Form layout
text
form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
i_layout-zebra = 'X'.
i_layout-lights_fieldname = 'LIGHT'.
i_layout-lights_tabname = 'IT_FINAL'.
i_layout-box_fieldname = 'CHK'.
i_layout-box_tabname = 'IT_FINAL'.
i_layout-edit = ' '.
endform.
*To display Buttons in the MENU BAR if needed
FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
SLIS_T_EXTAB.
SET PF-STATUS 'MENUPO'.
ENDFORM.
*Event for Interactive display of ALV report
form USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
if r_ucomm = '&IC1'.
READ TABLE IT_FINAL index rs_selfield-tabindex.
set parameter id 'VL1' field it_final-ebeln.
call transaction 'ME23N'.
endif.
endform .
*Parameters of FM REUSE_ALV_GRID_DISPLAY
*& Form grid_display
text
--> p1 text
<-- p2 text
form grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = I_EVENT[]
TABLES
t_outtab = IT_FINAL.
endform. " grid_display
Regards,
Rusidar S. -
Hi Experts,
Can i achieve sorting in Blocked ALV report as we can do in ALV Grid Display.???
If so, how can this be achieved????
For example, if there are 3 records with the same value for a field.....say thfreee rows with name 'Gaurav'.
I want to show 'Gaurav' only in the first row and the other two rows must be empty.
Gaurav 1 2 3
Gaurav 4 5 6
Gaurav 7 8 9
Should be seen as
Gaurav 1 2 3
4 5 6
7 8 9
Thanks and regards
Gaurav raghavHere is the code.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = 'ZCRM_ACTIVITY_REPORT'
CHANGING
ct_fieldcat = gt_fieldcatalog[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
CLEAR gs_sort.
gs_sort-fieldname = 'ORG'.
gs_sort-tabname = 'GT_ITAB'.
gs_sort-spos = '1'.
gs_sort-up = 'X'.
APPEND gs_sort TO gt_sort.
CLEAR gs_sort.
gs_sort-fieldname = 'EMPLOYEE'.
gs_sort-tabname = 'GT_ITAB'.
gs_sort-spos = '2'.
gs_sort-up = 'X'.
APPEND gs_sort TO gt_sort.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gt_layout
it_fieldcat = gt_fieldcatalog
i_tabname = 'GT_ITAB'
it_events = gt_events
it_sort = gt_sort
i_text = 'Report 1 '
TABLES
t_outtab = gt_itab
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'. -
I have a problem with ALV Grid User Command?
Hi Experts,
I have a problem with ALV GRID User Command.
I am calling TCODE IW33 (Order Display) from the ALV output at first time by selecting an order. But, User command is calling IW33 Initial screen with blank value of order. Even I checked in debugging the value what I selected is passing properly, but once that screen (IW33 Initial) displays, value doesn't appear. Then, Manually, I created another session and gone to TCODE IW33 and displayed an order. After that I came out from that order. Then again run my ALV program and selected another order, now order is displaying, but not what I selected current order instead of displaying previous order what I just displayed manually. If I selected any other order, system will display the same order what I dislayed manually.
Here is my code.
FORM user_command_alv USING u_ucomm TYPE sy-ucomm
us_self_field TYPE slis_selfield.
CASE u_ucomm.
WHEN '&IC1'.
READ TABLE it_final INDEX us_self_field-tabindex INTO wa_final.
WHEN 'ORDER'.
IF NOT wa_final-order IS INITIAL.
SET PARAMETER ID 'COK' FIELD wa_final-order.
CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
ENDIF.
endform.
PARAMETER ID 'COK' also the standard one.
Could you please help me out, Where I did wrong?
If I select any order, that order only should display.
Thanks in advance.
Regards,
Sarayu.
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:33 PMhi,
Please check it once the Paramater ID is 'ANR' for IW33 order number.
Hope this may help.
Regards,
Sravanthi -
Problem with ALV grid in edit mode
Hello, gurus!
I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell. And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
Thanks,
MikhailHi Prabhu,
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
title_of_report = text-010.
SET TITLEBAR '0100' WITH title_of_report.
DATA: g_event_receiver TYPE REF TO lcl_event_handler.
IF z_custom_container IS INITIAL .
CREATE OBJECT z_custom_container
EXPORTING
container_name = 'ALV_ZAC'.
CREATE OBJECT alv_grid
EXPORTING
i_parent = z_custom_container.
g_repid = sy-repid.
gs_variant-report = g_repid.
x_save = 'A'.
PERFORM check_alv_grid_fields.
ps_layout-cwidth_opt = 'X'.
ps_layout-edit = 'X'.
CALL METHOD alv_grid->set_ready_for_input
EXPORTING
i_ready_for_input = '1'.
* CALL METHOD alv_grid->register_edit_event
* EXPORTING
* i_event_id = cl_gui_alv_grid=>mc_evt_enter.
APPEND s_list_rec to it_list_rec.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
is_variant = gs_variant
i_save = x_save
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = it_list_rec[].
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDIF.
FORM check_alv_grid_fields .
DATA: ls_fcat LIKE LINE OF pt_fieldcat.
REFRESH pt_fieldcat .
CLEAR: ps_layout, ls_fcat.
ls_fcat-fieldname = 'VBELN'.
ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table = 'LIPS'. " .
ls_fcat-outputlen = 9.
* ls_fcat-datatype = 'CHAR'.
* ls_fcat-inttype = 'C'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR: ls_fcat.
ls_fcat-fieldname = 'ERDAT'.
ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
ls_fcat-outputlen = 9.
* ls_fcat-f4availabl = 'X' .
* ls_fcat-datatype = 'DATS'.
* ls_fcat-inttype = 'D'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR: ls_fcat.
ENDFORM. " check_alv_grid_fields
FORM save_p .
CLEAR l_valid.
CALL METHOD alv_grid->check_changed_data
IMPORTING
e_valid = l_valid.
IF l_valid IS INITIAL.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-i01
txt1 = text-i02
txt2 = text-i03
txt3 = text-i04.
ELSE.
i_dat_reg = zrumm_prr-cdprr.
CLEAR is_temp_otc.
freshit i_prrpus_fax.
freshit i_list2_ot.
LOOP AT it_list_rec INTO s_list_rec.
MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
i_list2_ot-fgrup = 'RECE'.
i_list2_ot-prrnu = i_num_prr.
APPEND i_list2_ot.
MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
APPEND i_prrpus_fax.
ENDLOOP.
ENDIF.
Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM -
Background task problem with alv grid display
Hello !
I have a problem when executing my program in background.
In foreground I have no problem, my ALV appears. In the background I have a dump.
The current ABAP program "SAPLKKBL" had to be terminated because one of the statements could not be executed.
I use the function module 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'F533_USER_COMMAND'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = i_fgroup[]
i_save = 'X'
it_sort = gd_sort
i_buffer_active = ' '
i_callback_pf_status_set = 'F534_SET_PF_STATUS'
TABLES
t_outtab = mytab
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.
I don't understand where the problem is. Please help me.
Thank you.I love replying to old threads:
Try this link
http://scn.sap.com/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job -
Sorting Problem in FND_MENU_ENTRIES_TL Table
Hi,
FND_MENU_ENTRIES_TL Table storing the record FND_MENU_ENTRIES_TL_N1(MENU_ID,PROMPT,LANGUAGE) wise in R12. But whereas in 11i, records stored FND_MENU_ENTRIES_TL_U1(MENU_ID,ENTRY_SEQUENCE,LANGUAGE).
I am confused, whether i need to recreate the index in R12, so the records will get store MENU_ID,ENTRY_SEQUENCE,LANGUAGE wise.
Could any one please suggest me how to resolve this problem.
Thanks,
Praba T815667 wrote:
Hi,
FND_MENU_ENTRIES_TL Table storing the record FND_MENU_ENTRIES_TL_N1(MENU_ID,PROMPT,LANGUAGE) wise in R12. But whereas in 11i, records stored FND_MENU_ENTRIES_TL_U1(MENU_ID,ENTRY_SEQUENCE,LANGUAGE).
I am confused, whether i need to recreate the index in R12, so the records will get store MENU_ID,ENTRY_SEQUENCE,LANGUAGE wise.
Could any one please suggest me how to resolve this problem.
Thanks,
Praba TPl do not abuse the forums by cross-posting in multiple forums
Sorting Problem in FND_MENU_ENTRIES_TL Table
Sorting Problem in FND_MENU_ENTRIES_TL Table
Your issue is related to EBS, not to database upgrades (which is the topic of this forum)
Srini -
Hi, I'm having a bit of a sorting problem when it comes to an artist with name variations. The example I'm going to use is DJ Tiesto.
There are album I have where he is credited as DJ Tiesto, and others where he is simply Tiesto.
In the end, I'd like these albums sorted chronologically under one name (say DJ Tiesto), while still preserving and showing the proper artist name for each album. I have it set to sort by "Album by Year", which is working fine.
The major problem I am having is that I can't get it to display properly across all iTunes viewing methods: List mode, Grid mode, and Coverflow.
I've tried leaving the Artist field alone, and changing the Sort Artist field to "DJ Tiesto" for all songs, and that almost works:
-List mode groups them all under "DJ Tiesto", while showing each albums Artist as the correct artist name.
-Grid mode sorted by Album groups them all under "DJ Tiesto", while showing each albums Artist as the correct artist name.
-Coverflow sorts them all in chronological order, while showing each albums Artist as the correct artist name.
Problem is, Grid mode sorted by ARTIST creates two separate artists! Some for DJ Tiesto and some for Tiesto!
To correct this I tried changing the Album Artist field for all songs to "DJ Tiesto", which solved that problem but created a bunch of new ones:
-List mode is still correctly grouping them under "DJ Tiesto", while showing each albums Artist as the correct artist name.
-Grid mode sorted by Album is still correctly grouping them under "DJ Tiesto", *however now it is not displaying the correct Artist name for each album!*
-Grid mode sorted by Artist is now grouping them all under "DJ Tiesto", *however it is not displaying the correct Artist name for each album!*
-Coverflow is sorting them in correct chronological order, *however it as well is not displaying the correct Artist name for each album!*
Using the Album Artist tag has created more problems that it has solved! Is there anyone who knows a way to achieve what I am trying to do? I have tried seemingly every option I can and have still not found a way to do this!!
Thanks!My own method of working involves renaming the files upon import to:
i "shotdate_sequencenumber"
Files are therefore typically named
b 2007-11-25_001
etc.
This way, sorting by Filename automatically sorts by Date by default. And it wouldn't even matter if you added a descriptive text in between the date and number (
b 2007-11-25_Scotland_001 -
Problem with ALV filter functionality when filtered for multiple values
Hi,
I am facing a problem with ALV filter functionality.
I have displayed an ALV with some columns col_A, col_B and col_C
col_A---- col_B -
col_C
1----
a -
abc
2----
b -
pqr
3----
c -
lmn
4----
d -
xyz
5----
f -
stu
From the settings link I am applying filter on column col_C and selected multiple values say 'pqr', 'xyz' and 'lmn'.
Now the ALV is showing rows only for last selection i.e . results are fetched only for value 'lmn'.
i.e. after applying the filter the ALV table looks as below:
col_A---- col_B -
col_C
3----
c -
lmn
But ideally it should be:
col_A---- col_B -
col_C
2----
b -
pqr
3----
c -
lmn
4----
d -
xyz
I could not find any OSS note related to this issue.
Please help me resolve this issue.
Thanks,
FerozHi,
I am facing a problem with ALV filter functionality.
I have displayed an ALV with some columns col_A, col_B and col_C
col_A---- col_B -
col_C
1----
a -
abc
2----
b -
pqr
3----
c -
lmn
4----
d -
xyz
5----
f -
stu
From the settings link I am applying filter on column col_C and selected multiple values say 'pqr', 'xyz' and 'lmn'.
Now the ALV is showing rows only for last selection i.e . results are fetched only for value 'lmn'.
i.e. after applying the filter the ALV table looks as below:
col_A---- col_B -
col_C
3----
c -
lmn
But ideally it should be:
col_A---- col_B -
col_C
2----
b -
pqr
3----
c -
lmn
4----
d -
xyz
I could not find any OSS note related to this issue.
Please help me resolve this issue.
Thanks,
Feroz -
Problem with ALV search help Dictionary Search Help
Hello experts
I have a problem with ALV search help.
I use DDIC table ZXXX with text table ZXXX_T. I created DDIC search help form table ZXXX. In my WD application, in context on COMPONENTCONTROLLER i set on attribute: 'Input help mode' as 'Dictionary Search Help' and in 'Dictionary Search Help' I pass name of new created DDIC search help.
I create a input field from that atrribute and search help works fine (there was a value and description for value from text table). So I created ALV witch contains that attribute too.
Next I set column for this attribute in ALV as editable but on Serch help for this collumn I have only value. I DON'T HAVE TEXT DESCRIPTION FOR VALUE.
Please help me and tell me what I do wrong?
MikoHello,
Thank's for your help. I create DDic Search help for all fields from my ALV. Next I changed 'TYPE' for all ALV fields in COMPONENTCONTROLLER from ZXXX-Zfield to Zfield, and I changed 'Input help mode' from 'Automatic' to 'Dictionary Search Help'. Now I see Value and Description for value in Search Help in my ALV.
Regards
Miko -
Sorting problem in standard vendor search help
Hi all,
I'm enhancing the vendor search help.
I found that there is a sorting problem in the original standard search help.
The 1st time to search vendor in the search help returns a correct list, then I just sort the vendor in ascending order. This time the column name of the hit list changes and mismatch the actual values.
Any one faced this problem before?
What's wrong are there ?
Thanks.Thanks Peluka.
But even I don't enhance the vendor search help, I still found that the original standard version has this problem after sorting.
Is that the program bug?
Have anyone encountered this problem before? -
How can we sort records in alv, give example
how can we sort records in alv, give example
Hi
<b>Setting Sort Conditions</b>
It is possible to set sort conditions for the table data. This is achieved by filling an internal table of structure LVC_T_SORT which consists of the sort criteria. To have an initial sorting, pass it to the parameter IT_SORT of the method set_table_for_first_display.
FORM prepare_sort_table CHANGING pt_sort TYPE lvc_t_sort .
DATA ls_sort TYPE lvc_s_sort .
ls_sort-spos = '1' .
ls_sort-fieldname = 'CARRID' .
ls_sort-up = 'X' . "A to Z
ls_sort-down = space .
APPEND ls_sort TO pt_sort .
ls_sort-spos = '2' .
ls_sort-fieldname = 'SEATSOCC' .
ls_sort-up = space .
ls_sort-down = 'X' . "Z to A
APPEND ls_sort TO pt_sort .
ENDFORM. " prepare_sort_table
<b>Preparing the table for sorting settings</b>
We have two important points to tell about this topic. First one is that, be ready for a short dump if any one of the fields given to be sorted is not in the content of the field catalog. Secondly, when you make ALV Grid to sort data, by default it vertically merges fields having the same content. To avoid from this for all of the columns, you can set no_merging field of the layout structure to X. If you want to disable merging for just some columns, set no_merging field of the field catalog row corresponding to that column.
You can get and set sort criteria applied whenever you want by using methods get_sort_criteria and set_sort_criteria, respectively.
<b>
Sort Using FACTORY CLASSES</b>
<b>Sorts CL_SALV_SORTS</b>
we can add some sorting to the ALV grid. Create the object reference variable and receive the object using the GET_SORTS method of the GR_TABLE object. Next, add the sort by calling the ADD_SORT method of the GR_SORTS object.
report zalvom_demo1.
data: ispfli type table of spfli.
data: gr_table type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table.
data: gr_column type ref to cl_salv_column_table.
data: gr_sorts type ref to cl_salv_sorts.
data: color type lvc_s_colo.
start-of-selection.
select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ).
gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ).
gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ).
gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'.
color-int = '1'.
color-inv = '0'.
gr_column->set_color( color ).
gr_sorts = gr_table->get_sorts( ).
gr_sorts->add_sort 'CITYTO' ).
gr_table->display( ).
Regards
Ravish
<b><i>
Reward if useful to you</i></b>
Message was edited by:
Ravish Garg -
How does the SORT function in ALV grid work?
Hi,
I have a report for which the o/p is displayed in ALV grid format.There is one column in the O/p strcuture which is "No of days".Based on certain conditions,i need to display the value for some of the days as Negative e.g. " - 45".Becasuse of this,I have declared the field for the "No of days" of the type "CHAR".
Now when i sort(using ALV grid SORT function) the list on basis of this column,it doesnt give me the correct o/p.
CAN anyone tell me how do i handle this?I want the list to be sorted correctly on basis of the "No of days" column.
Thanks!This is your Fourth Cross Posting in last three days on same issue!!
CHAR type column doesnt work for SORT function in ALV grid!
How to sort a column of type CHAR
I dont,ve link for your Fourth Thread on same,though i'm short memory loss.
Maybe you are looking for
-
ReqIntf.setResourceResponse returning Error
Hi , I am trying to approve request through reqIntf.setResourceResponse() API and I am getting folowing error. I am using OIM 9102 BP18 Thor.API.Exceptions.tcInvalidResponseException at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234
-
What is macdefender and is it needed for macbook pro
What is Macdefender? This software tried to download on my computer by itself and during that process said I had viruses on my computer including a trojan. Is it necessary to have a virus software on my Macbook pro? Should I be concerned that seve
-
Ziio: Composite video out?
In the initial specsheets released for the Ziio 7" a composite video out was mentioned. It seems that the current specs does not mention this? Is composite video out present on current Ziio's? /lars
-
Original apple id was changed because of change in email address
How do I recover books from ibooks under the original apple id
-
HT2905 Can I delete albums in folder on hard drive
I am trying to clean up harddrive space on my laptop, all my albums are in a MP3 folder and Itunes folder. Can I delete the MP3 folder?