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

F4 Help for select-options.

Former Member
0 Likes
431

Hi Experts,

I need to use F4 help for a select - options field from a particular table.I have written the below code and it worked well.

FORM sub_show_help.

SELECT bukrs

FROM zfica_accurate

INTO TABLE gt_accurate.

delete ADJACENT DUPLICATES FROM gt_accurate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_CMCODE'

window_title = 'COMPANY CODE'

value_org = 'S'

multiple_choice = 'X'

TABLES

value_tab = gt_accurate

return_tab = gt_return.

s_cmcode-sign = 'I'.

s_cmcode-option = 'EQ'.

LOOP AT gt_return INTO gw_return .

s_cmcode-low = gw_return-fieldval.

APPEND s_cmcode.

ENDLOOP.

READ TABLE s_cmcode INDEX 1.

IF sy-subrc = 0.

gw_dynpread-fieldname = text-018.

gw_dynpread-fieldvalue = s_cmcode-low.

APPEND gw_dynpread TO gt_dynpread.

  • UPDATE THE SCREEN FIELD VALUES

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-repid

dynumb = sy-dynnr

TABLES

dynpfields = gt_dynpread

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

ENDIF.

IF sy-subrc <> 0.

MESSAGE i003.

ENDIF.

The problem is , I need to create a new type for s_cmcode(select-option ) field with the same structure as the select-option and the code is as below. I have created an internal table gt_sfield similar to s_cmcode . I have replaced s_cmcode with gt_sfield but the below code is not working. Its the same as the above program but its not showing up the values in the field.Could anyone please help me.

fORM SUB_SHOW_HELP.

SELECT BUKRS

FROM ZFICA_ACCURATE

INTO TABLE GT_ACCURATE.

gt_sfield[] = s_cmcode[].

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'BUKRS'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

WINDOW_TITLE = 'COMPANY CODE'

VALUE_ORG = 'S'

MULTIPLE_CHOICE = 'X'

TABLES

VALUE_TAB = GT_ACCURATE

RETURN_TAB = GT_RETURN.

LOOP AT GT_RETURN INTO gw_return.

gw_sfield-SIGN = 'I'.

gw_sfield-OPTION = 'EQ'.

MOve gw_return-fieldval to gw_sfield-low.

APPEND gw_sfield to gt_sfield.

ENDLOOP.

READ TABLE gt_sfield INDEX 1 INTO gw_sfield .

IF SY-SUBRC = 0.

gw_dynpread-fieldname = 'S_CMCODE'.

move gw_sfield-low to gw_dynpread-fieldvalue.

APPEND GW_DYNPREAD TO GT_DYNPREAD.

  • UPDATE THE SCREEN FIELD VALUES

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = SY-REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = GT_DYNPREAD

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

UNDEFIND_ERROR = 7

OTHERS = 8.

ENDIF.

IF SY-SUBRC <> 0.

MESSAGE I003.

ENDIF.

ENDFORM.

Hi Experts,

I need to use F4 help for a select - options field from a particular table.I have written the below code and it worked well.

FORM sub_show_help.

SELECT bukrs

FROM zfica_accurate

INTO TABLE gt_accurate.

delete ADJACENT DUPLICATES FROM gt_accurate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_CMCODE'

window_title = 'COMPANY CODE'

value_org = 'S'

multiple_choice = 'X'

TABLES

value_tab = gt_accurate

return_tab = gt_return.

s_cmcode-sign = 'I'.

s_cmcode-option = 'EQ'.

LOOP AT gt_return INTO gw_return .

s_cmcode-low = gw_return-fieldval.

APPEND s_cmcode.

ENDLOOP.

READ TABLE s_cmcode INDEX 1.

IF sy-subrc = 0.

gw_dynpread-fieldname = text-018.

gw_dynpread-fieldvalue = s_cmcode-low.

APPEND gw_dynpread TO gt_dynpread.

  • UPDATE THE SCREEN FIELD VALUES

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-repid

dynumb = sy-dynnr

TABLES

dynpfields = gt_dynpread

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

ENDIF.

IF sy-subrc <> 0.

MESSAGE i003.

ENDIF.

The problem is , I need to create a new type for s_cmcode(select-option ) field with the same structure as the select-option and the code is as below. I have created an internal table gt_sfield similar to s_cmcode . I have replaced s_cmcode with gt_sfield but the below code is not working. Its the same as the above program but its not showing up the values in the field.Could anyone please help me.

fORM SUB_SHOW_HELP.

SELECT BUKRS

FROM ZFICA_ACCURATE

INTO TABLE GT_ACCURATE.

gt_sfield[] = s_cmcode[].

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'BUKRS'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

WINDOW_TITLE = 'COMPANY CODE'

VALUE_ORG = 'S'

MULTIPLE_CHOICE = 'X'

TABLES

VALUE_TAB = GT_ACCURATE

RETURN_TAB = GT_RETURN.

LOOP AT GT_RETURN INTO gw_return.

gw_sfield-SIGN = 'I'.

gw_sfield-OPTION = 'EQ'.

MOve gw_return-fieldval to gw_sfield-low.

APPEND gw_sfield to gt_sfield.

ENDLOOP.

READ TABLE gt_sfield INDEX 1 INTO gw_sfield .

IF SY-SUBRC = 0.

gw_dynpread-fieldname = 'S_CMCODE'.

move gw_sfield-low to gw_dynpread-fieldvalue.

APPEND GW_DYNPREAD TO GT_DYNPREAD.

  • UPDATE THE SCREEN FIELD VALUES

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = SY-REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = GT_DYNPREAD

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

UNDEFIND_ERROR = 7

OTHERS = 8.

ENDIF.

IF SY-SUBRC <> 0.

MESSAGE I003.

ENDIF.

ENDFORM.

1 REPLY 1
Read only

Former Member
0 Likes
392

Hi,

The fucntion module 'DYNP_VALUES_UPDATE' should be used only for updating the screen field values. In your case you are updating the internal table using this function module.

Thanks

Pavan