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

Condition inside a search help exit

PriyankaAgarwal
Product and Topic Expert
Product and Topic Expert
0 Likes
616

Hello Colleagues,

I have implemented a search help exit for restricting values of a domain.The selection method used in search help is DD07T.

The values are getting restricted properly.

Now,I need to restrict the values based on some condition(screen or view name) which uses this search help.I see the sy-tcode returns sm30 and sy-dynnr returns 0600.

When the search help exit is called the sy-dynnr changes to the screen 0600 of the program SAPMSHLP. But I want to check based on the sy-dynnr of the calling screen/view.

I have written the following code but it doesnt work since the sy-dynnr changes to 0600 as soon as the search help exit gets called.

TYPES: my_type TYPE dd07t.

DATA: BEGIN OF ls_record.

INCLUDE STRUCTURE seahlpres.

DATA: END OF ls_record.

FIELD-SYMBOLS: <fs> TYPE my_type.

CHECK callcontrol-step = 'DISP'.

IF sy-dynnr = '0800'.

LOOP AT record_tab ASSIGNING <fs> CASTING.

IF <fs>-domvalue_l <= '10'.

DELETE record_tab INDEX sy-tabix.

ENDIF.

ENDLOOP.

ELSEIF sy-dynnr = '0400'.

LOOP AT record_tab ASSIGNING <fs> CASTING.

IF <fs>-domvalue_l > '10'.

DELETE record_tab INDEX sy-tabix.

ENDIF.

ENDLOOP.

ENDIF.

Could anyone tell me how can i check. Viewname and screen number is the only way. But in search help exit i dont get the correct screen number or transaction code.

Thanks,

Priyanka

Hello Colleagues,

I have implemented a search help exit for restricting values of a domain.The selection method used in search help is DD07T.

The values are getting restricted properly.

Now,I need to restrict the values based on some condition(screen or view name) which uses this search help.I see the sy-tcode returns sm30 and sy-dynnr returns 0600.

When the search help exit is called the sy-dynnr changes to the screen 0600 of the program SAPMSHLP. But I want to check based on the sy-dynnr of the calling screen/view.

I have written the following code but it doesnt work since the sy-dynnr changes to 0600 as soon as the search help exit gets called.

TYPES: my_type TYPE dd07t.

DATA: BEGIN OF ls_record.

INCLUDE STRUCTURE seahlpres.

DATA: END OF ls_record.

FIELD-SYMBOLS: <fs> TYPE my_type.

CHECK callcontrol-step = 'DISP'.

IF sy-dynnr = '0800'.

LOOP AT record_tab ASSIGNING <fs> CASTING.

IF <fs>-domvalue_l <= '10'.

DELETE record_tab INDEX sy-tabix.

ENDIF.

ENDLOOP.

ELSEIF sy-dynnr = '0400'.

LOOP AT record_tab ASSIGNING <fs> CASTING.

IF <fs>-domvalue_l > '10'.

DELETE record_tab INDEX sy-tabix.

ENDIF.

ENDLOOP.

ENDIF.

Could anyone tell me how can i check. Viewname and screen number is the only way. But in search help exit i dont get the correct screen number or transaction code.

Thanks,

Priyanka

2 REPLIES 2
Read only

nikhilkup
Active Participant
0 Likes
506

null

Edited by: Nikhil Poojari on Aug 21, 2009 12:17 PM

Edited by: Nikhil Poojari on Aug 21, 2009 12:17 PM

Read only

PriyankaAgarwal
Product and Topic Expert
Product and Topic Expert
0 Likes
506

Hi Nikhil,

No I cannot hard code the screen number because different screens will be calling the same search help exit. Based the on screen which is calling, I want to restrict the values.

Regards,

Priyanka