Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

After sorting the table cannot use the position button to find data.

Former Member
0 Likes
604

I've a customized table, before that just have a position button at the bottom for search the data.

After that i added the sorting button(ascending and descending).

The issue now is after i use the sorting button to sort the data, i cannot use the position button to find data anymore.

If I didnt sort the data at 1st, I'm able to find the data by used the position button.

Can anyone help me? Thanks~!!

Edited by: Aldrich Chong on Feb 25, 2009 9:18 AM

I've a customized table, before that just have a position button at the bottom for search the data.

After that i added the sorting button(ascending and descending).

The issue now is after i use the sorting button to sort the data, i cannot use the position button to find data anymore.

If I didnt sort the data at 1st, I'm able to find the data by used the position button.

Can anyone help me? Thanks~!!

Edited by: Aldrich Chong on Feb 25, 2009 9:18 AM

2 REPLIES 2
Read only

Former Member
0 Likes
569

hi,

Can u please paste ur code, it wil be help full.

Thanks

Suraj

Read only

0 Likes
569

----


  • TABLES DECLARATION

----


tables: afko,

aufk,

marc,

zppe001_02.

data: i_mara type standard table of mara.

data: i_afko type standard table of afko.

data: i_zppe001_02 type standard table of zppe001_02.

data: wa_zppe001_02 type zppe001_02.

----


  • SELECTION PARAMETERS

----


selection-screen begin of block a with frame title text-001.

select-options:

s_plnbez for afko-plnbez,

s_werks for aufk-werks,

s_dispo for marc-dispo,

s_auart for aufk-auart,

s_aufnr for afko-aufnr.

parameters: p_prlog type c as checkbox default 'X'.

parameters: p_prfor type c as checkbox.

selection-screen: skip.

selection-screen end of block a.

----


  • DATA DECLARATION

----


data: i_order type standard table of zppe001. "insert DEVK900756

data: wa_order type zppe001. "insert DEVK900756

data: fm_name type rs38l_fnam.

data: no_open type c,

no_close type c.

at selection-screen on s_plnbez.

refresh i_mara.

if not s_plnbez is initial.

select * into table i_mara

from mara

where matnr in s_plnbez.

if sy-subrc ne 0.

message e600(f1) with text-e01.

endif.

endif.

at selection-screen on s_aufnr.

if not s_aufnr is initial.

select * into table i_afko

from afko

where aufnr in s_aufnr.

if sy-subrc ne 0.

message e600(f1) with text-e02.

endif.

endif.

----


  • INITIALIZATION

----


initialization.

perform init.

&----


*& Form init

&----


form init.

endform. " init

----


  • START-OF-SELECTION

----


start-of-selection.

if p_prfor eq 'X'.

data: lv_count type i.

data: lv_counter type i.

clear: lv_counter.

lv_count = 0.

perform get_selected_data.

sort i_order by aufnr.

if not i_order[] is initial.

loop at i_order into wa_order.

*{ insert DEVK901692

no_open = 'X'.

no_close = 'X'.

at first.

clear: fm_name.

perform get_smartform_name.

no_open = ' '.

endat.

*} insert DEVK901692

read table i_zppe001_02 into wa_zppe001_02 with key aufnr = wa_order-aufnr.

if sy-subrc ne 0.

clear: wa_zppe001_02-counter.

endif.

wa_zppe001_02-aufnr = wa_order-aufnr.

wa_zppe001_02-ctime = sy-uzeit.

wa_zppe001_02-cdate = sy-datum.

wa_zppe001_02-name = sy-uname.

wa_zppe001_02-counter = wa_zppe001_02-counter + 1.

*{ insert DEVK901692

at last.

no_close = ' '.

endat.

perform call_smartform using no_open

no_close.

if sy-ucomm eq 'PRNT'.

*} insert DEVK901692

call function 'ENQUEUE_EZPPE001_02'

exporting

mode_zppe001_02 = 'E'

mandt = sy-mandt

aufnr = wa_order-aufnr

exceptions

foreign_lock = 1

system_failure = 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.

insert into zppe001_02 values wa_zppe001_02.

commit work.

call function 'DEQUEUE_EZPPE001_02'

exporting

mode_zppe001_02 = 'E'

mandt = sy-mandt

aufnr = wa_order-aufnr.

endif.

lv_count = lv_count + 1.

endloop.

endif.

endif.

if p_prlog eq 'X'. "OR p_prfor EQ 'X'. insert DEVK901692

perform write_data.

endif.

----


  • END-OF-SELECTION

----


end-of-selection.

&----


*& Form get_data

&----


form get_data using p_bukrs p_kunnr.

perform get_detail.

endform. " get_data

&----


*& Form get_detail

&----


form get_detail.

endform. " get_detail

&----


*& Form combine_data

&----


form combine_data .

endform. " combine_data

&----


*& Form write_data

&----


form write_data .

select * into table i_zppe001_02

from zppe001_02

where aufnr in s_aufnr.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = 'ZPPR006'

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

i_structure_name = 'ZPPE001_02'

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • 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

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = i_zppe001_02

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. " write_data

&----


*& Form get_smartform_name

&----


form get_smartform_name .

  • STEP 1

  • Passing data to SMARTFORMS and generate SMARTFORM function module

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZPPF003'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

importing

fm_name = fm_name

exceptions

no_form = 1

no_function_module = 2

others = 3

.

if sy-subrc <> 0.

message 'Error in SMARTFORM function module generation!' type 'E'.

endif.

endform. " get_smartform_name

&----


*& Form call_smartform

&----


form call_smartform using p_no_open

p_no_close.

data: control_parameters type ssfctrlop.

clear control_parameters.

  • Make sure spool is not closed

control_parameters-no_open = p_no_open.

control_parameters-no_close = p_no_close.

  • STEP 2

  • Call the generated SMARTFORM function module

call function fm_name

exporting

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = control_parameters

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

wa_zppe001 = wa_order

v_counter = wa_zppe001_02-counter

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

  • TABLES

  • it_bsid = it_zfie001

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

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. "call_smartform

&----


*& Form get_selected_data

&----


form get_selected_data .

select koplnbez koaufnr kogltrp kogamng fkauart fkwerks kt~maktx

podoknr podokar tkbmeng korsnum tkstktx kostlty kostlnr kostlal

into corresponding fields of table i_order

from aufk as fk

inner join afko as ko

on koaufnr = fkaufnr

  • INNER JOIN marc AS rc

  • ON rcmatnr = koplnbez

inner join makt as kt

on ktmatnr = koplnbez

inner join stko as tk

on tkstlty = kostlty

and tkstlnr = kostlnr

and tkstlal = kostlal

left join stpo as po

on postlty = tkstlty

and postlnr = tkstlnr

and postpoz = tkstkoz

where ko~plnbez in s_plnbez

and ko~aufnr in s_aufnr

and fk~auart in s_auart

and ko~dispo in s_dispo.

*{Insert DEVK902021

if sy-subrc eq 0.

select aufnr max( counter ) as counter into corresponding fields of table i_zppe001_02

from zppe001_02

where aufnr in s_aufnr

group by aufnr.

endif.

*Insert DEVK902021}

if sy-subrc eq 0.

select * into table i_zppe001_02

from zppe001_02

where aufnr in s_aufnr.

endif.

endform. " get_selected_data