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

Change field length dynamically

Former Member
0 Likes
1,661

Hi,

I have created a customized infotype with several fields to which dropdown facility should be provided.

I am getting the details of dropdown from a Z-table and storing it in an internal table , later I am passing the internal table contents to below function module.

I am using the function module F4IF_INT_TABLE_VALUE_REQUEST in POV block for a field to provide F4 functionality.

*Requirement:The user wants the screen field length to change dynamically based on the maximum length of the dropdown it has.*

Solution: I have written the below code in Process on value request block for the input field:

P9011-ELIGIBILITY.

SELECT zbkey zekey zedescription

FROM zeoptions

INTO TABLE gt_zeoptions.

REFRESH gt_return.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'ZEDESCRIPTION'

  • PVALKEY = ' '

dynpprog = sy-cprog

dynpnr = sy-dynnr

dynprofield = 'P9011-ELIGIBILITY'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

value_org = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

value_tab = gt_zeoptions

  • FIELD_TAB =

return_tab = gt_return

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 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.

*

LOOP AT SCREEN.

CHECK screen-name = 'P9011-ELIGIBILITY'.

READ TABLE gt_return INTO gs_return INDEX 1.

IF sy-subrc = 0.

screen-length = STRLEN( gs_return-fieldval ).

MODIFY SCREEN.

ENDIF.

ENDLOOP.

This code will change the screen length dynamically based on the input text length.

But on hitting ENTER,the screen field length is defaulting to original length.

Pease help how to set the length back to the input text field length?

Hi,

I have created a customized infotype with several fields to which dropdown facility should be provided.

I am getting the details of dropdown from a Z-table and storing it in an internal table , later I am passing the internal table contents to below function module.

I am using the function module F4IF_INT_TABLE_VALUE_REQUEST in POV block for a field to provide F4 functionality.

*Requirement:The user wants the screen field length to change dynamically based on the maximum length of the dropdown it has.*

Solution: I have written the below code in Process on value request block for the input field:

P9011-ELIGIBILITY.

SELECT zbkey zekey zedescription

FROM zeoptions

INTO TABLE gt_zeoptions.

REFRESH gt_return.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'ZEDESCRIPTION'

  • PVALKEY = ' '

dynpprog = sy-cprog

dynpnr = sy-dynnr

dynprofield = 'P9011-ELIGIBILITY'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

value_org = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

value_tab = gt_zeoptions

  • FIELD_TAB =

return_tab = gt_return

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 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.

*

LOOP AT SCREEN.

CHECK screen-name = 'P9011-ELIGIBILITY'.

READ TABLE gt_return INTO gs_return INDEX 1.

IF sy-subrc = 0.

screen-length = STRLEN( gs_return-fieldval ).

MODIFY SCREEN.

ENDIF.

ENDLOOP.

This code will change the screen length dynamically based on the input text length.

But on hitting ENTER,the screen field length is defaulting to original length.

Pease help how to set the length back to the input text field length?

3 REPLIES 3
Read only

Former Member
0 Likes
941

hi,

I think you must setup length of this field in PBO too...

regards, darek

Read only

0 Likes
941

I tried doing it in PBO,PAI and POV but even then it is defalting to original length on pressing ENTER

Read only

0 Likes
941

hi,

I've checked - it working in PBO !

I've create simple program with a screen . In screen designer I put on screen 100

two fields: vbak-vbeln and xfield. Both have orignally length 10 character...

I decrease this length to 8 character - and it working...

below my sample program:

REPORT ZSCREEN.

tables: vbak.

data: xfield(10).

data: ok_code like sy-ucomm.

call screen 100.

- PBO module -


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'Z100'.

  • SET TITLEBAR 'xxx'.

LOOP AT screen.

IF screen-name = 'VBAK-VBELN'.

screen-length = 8.

ENDIF.

IF screen-name = 'XFIELD'.

screen-length = 8.

ENDIF.

MODIFY screen.

ENDLOOP.

ENDMODULE. " STATUS_0100 OUTPUT

send your PBO code if you still have a problem,

regards, darek