‎2006 Jun 13 12:10 PM
I have 10 columns in my table control. How do i perform sorting in the table control on the basis of two columns ?
‎2006 Jun 13 12:16 PM
just look at this programm option for sorting...
<b>DEMO_DYNPRO_TABCONT_LOOP_AT</b>
‎2006 Jun 13 12:52 PM
HI
GOOD
GO THROUGH CODE
Sample code for vertical scrolling in PAI processing will look like this:
MODULE user_command_XXXX INPUT. (XXXX is screen no.)
CASE ok_code.
WHEN 'P--'.
CLEAR ok_code.
PERFORM paging USING 'P--'.
WHEN 'P-'.
CLEAR ok_code.
PERFORM paging USING 'P-'.
WHEN 'P+'.
CLEAR ok_code.
PERFORM paging USING 'P+'.
WHEN 'P++'.
CLEAR ok_code.
PERFORM paging USING 'P++'.
&----
*& Form PAGING
&----
Form to do scrolling for screen XXXX
----
>CODE OKCODE value (P, P-, P, P+ )
----
FORM paging USING code.
DATA: i TYPE i,
j TYPE i.
CASE code.
WHEN 'P--'. <table control name>-top_line = 1.
WHEN 'P-'.
<table control name>-top_line =
<table control name>-top_line - line_count.
IF <table control name>-top_line LE 0.
<table control name>-top_line = 1.
ENDIF.
WHEN 'P+'.
i = <table control name>-top_line + line_count.
j = <table control name>-lines - line_count + 1.
IF j LE 0. j = 1. ENDIF.
IF i LE j.
<table control name>-top_line = i.
ELSE.
<table control name>-top_line = j.
ENDIF.
WHEN 'P++'.
<table control name>-top_line =
<table control name>-lines - line_count + 1.
IF <table control name>-top_line LE 0.
<table control name>-top_line = 1.
ENDIF.
ENDCASE.
ENDFORM. " PAGING
THANKS
MRUTYUN
‎2006 Jun 13 1:11 PM
Hi,
Check the Demo programs <b>RSDEMO_TABLE_CONTROL</b> ,<b> RSDEMO02</b>
Regards
vijay
‎2006 Jun 13 1:16 PM
Very Simple. You can not only have two columns but multiple columns is possible.
First, make the multiple column selection active in your table control (do this using Screen painter).
Suppose you have declared your table control as follows:
*Table control to display details
CONTROLS: tc_cust_micr TYPE TABLEVIEW USING SCREEN 0100.
And suppose the table control has say 4 columns, then declare:
DATA: ws_fld1(5),ws_fld2(5), ws_fld3(5),ws_fld4(5).
fld1 TYPE fieldname VALUE 'LOCKB',
fld2 TYPE fieldname VALUE 'BATCH',
fld3 TYPE fieldname VALUE 'CHECT',
fld4 TYPE fieldname VALUE 'KUNNR',
DATA: ws_col LIKE LINE OF tc_cust_micr-cols.
DATA : BEGIN OF i_out_tab OCCURS 0,
sel(1),
kunnr LIKE knbk-kunnr,
lockb LIKE t049l-lcknr,
chect LIKE febep-chect,
batch LIKE febep-itmnr,
END OF i_out_tab.
Now in your PAI user_command event:
&----
*& Module user_command INPUT
----
MODULE user_command INPUT.
CLEAR: ws_fld1(5),ws_fld2(5), ws_fld3(5),ws_fld4(5),
ws_col.
loop at tc_cust_micr-cols into ws_col.
if ws_col-screen-name = 'I_OUT_TAB-LOCKB' and
ws_col-selected = 'X'.
ws_fld1 = fld1.
endif.
if ws_col-screen-name = 'I_OUT_TAB-BATCH' and
ws_col-selected = 'X'.
ws_fld2 = fld2.
endif.
if ws_col-screen-name = 'I_OUT_TAB-CHECT' and
ws_col-selected = 'X'.
ws_fld3 = fld3.
endif.
if ws_col-screen-name = 'I_OUT_TAB-KUNNR' and
ws_col-selected = 'X'.
ws_fld4 = fld4.
endif.
endloop.
CASE ws_ok_code.
WHEN c_sort_up.
CLEAR: ws_ok_code.
SORT i_out_tab BY (ws_fld1) (ws_fld2)
(ws_fld3) (ws_fld4).
WHEN c_sort_down.
CLEAR: ws_ok_code.
SORT i_out_tab BY (ws_fld1) descending
(ws_fld2) descending
(ws_fld3) descending
(ws_fld4) descending.
WHEN OTHERS.
CLEAR : ws_ok_code.
ENDCASE.
ENDMODULE. " user_command INPUT
I think this should solve ur query.
Rgds.
Subbu