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

search help focus

Former Member
0 Likes
469

Hello,

I have implemented a search help with the following code, but when the popup window appears, it doesn't react to any keyboard key (like Enter or arrows), because the focus is on the main screen of the program.

Thanks a lot

DATA: lv_repid TYPE repid,

lv_dynnr TYPE dynnr,

lv_stepl TYPE systepl.

DATA: BEGIN OF lw_values,

bukrs TYPE bukrs,

kunnr TYPE kunnr,

altkn TYPE zclie,

name1 TYPE name1_gp,

stcd1 TYPE stcd1,

sortl TYPE sortl,

END OF lw_values.

DATA lt_values LIKE STANDARD TABLE OF lw_values.

lv_repid = sy-repid.

lv_dynnr = sy-dynnr.

CALL FUNCTION 'DYNP_GET_STEPL'

IMPORTING

povstepl = lv_stepl

EXCEPTIONS

stepl_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

SELECT bukrs a~kunnr altkn name1 stcd1 sortl

FROM kna1 AS a INNER JOIN knb1 AS b

ON akunnr EQ bkunnr

INTO TABLE lt_values

WHERE bukrs EQ zob_zcjbc_cab-bukrs. "and

  • akont eq p_hkont.

IF sy-subrc <> 0.

MESSAGE s178(zob) WITH p_hkont.

EXIT.

ENDIF.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ALTKN'

dynpprog = lv_repid

dynpnr = lv_dynnr

dynprofield = 'WA_TC_SCREEN-RETOB'

stepl = lv_stepl

window_title = 'Elegir cliente PLIDO'

value_org = 'S'

TABLES

value_tab = lt_values

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

Hello,

I have implemented a search help with the following code, but when the popup window appears, it doesn't react to any keyboard key (like Enter or arrows), because the focus is on the main screen of the program.

Thanks a lot

DATA: lv_repid TYPE repid,

lv_dynnr TYPE dynnr,

lv_stepl TYPE systepl.

DATA: BEGIN OF lw_values,

bukrs TYPE bukrs,

kunnr TYPE kunnr,

altkn TYPE zclie,

name1 TYPE name1_gp,

stcd1 TYPE stcd1,

sortl TYPE sortl,

END OF lw_values.

DATA lt_values LIKE STANDARD TABLE OF lw_values.

lv_repid = sy-repid.

lv_dynnr = sy-dynnr.

CALL FUNCTION 'DYNP_GET_STEPL'

IMPORTING

povstepl = lv_stepl

EXCEPTIONS

stepl_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

SELECT bukrs a~kunnr altkn name1 stcd1 sortl

FROM kna1 AS a INNER JOIN knb1 AS b

ON akunnr EQ bkunnr

INTO TABLE lt_values

WHERE bukrs EQ zob_zcjbc_cab-bukrs. "and

  • akont eq p_hkont.

IF sy-subrc <> 0.

MESSAGE s178(zob) WITH p_hkont.

EXIT.

ENDIF.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ALTKN'

dynpprog = lv_repid

dynpnr = lv_dynnr

dynprofield = 'WA_TC_SCREEN-RETOB'

stepl = lv_stepl

window_title = 'Elegir cliente PLIDO'

value_org = 'S'

TABLES

value_tab = lt_values

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

1 REPLY 1
Read only

Former Member
0 Likes
420

I found the solution to put the focus on the help screen:

I've used the return table of the function, and removed the repid and dynnr parameters, and the parameter with the screen field to which the result should be placed. Instead of that, I have read the result table and written the result (index 1, field FIELDVAL) into my screen field directly.

See the code below:

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ALTKN'

stepl = lv_stepl

value_org = 'S'

TABLES

value_tab = lt_values

return_tab = lt_return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ELSE.

READ TABLE lt_return INTO lw_return INDEX 1.

IF sy-subrc EQ 0.

wa_tc_screen-terob = lw_return-fieldval.

ENDIF.

ENDIF.