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

Making view fields to output fields dynamically

Former Member
0 Likes
881

Hi,

I have a maintainance view. One of the fields contains a checkbox. If I check the checkbox i want to change input fields of that row to output fields. And if I uncheck the checkbox, the viceversa should happen.

I tried doing this by calling a module in PAI block. In that module I looped through the screen structure and made screen-input = 0 for the fields I want to make as output fields.

But I dont get the result.

Can anyone help me out as how I can do this?

Thanks,

Reena

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
822

Hi Prashant,

I already tried as you said but by giving screen-input = 0 as I want to make the fields as output fields. But it doesn't work. When i debug, I find the function module gets called and screen-input value for fields is set to 0. But I dont see the result in the view.

I guess that screen-input is getting reset back to 1 after my module is called. So I am not sure if i am calling my module from the right place.

Here is my PAI block. The code in bold below is where i am calling the module. Is it the right place?

PROCESS AFTER INPUT.

MODULE liste_exit_command AT EXIT-COMMAND.

MODULE liste_before_loop.

LOOP AT extract.

MODULE liste_init_workarea.

CHAIN.

FIELD v_t5asrmsgmap1s-msgty .

FIELD v_t5asrmsgmap1s-msgid .

FIELD v_t5asrmsgmap1s-msgno .

FIELD v_t5asrmsgmap1s-msgtxt .

FIELD v_t5asrmsgmap1s-hide_message .

FIELD v_t5asrmsgmap1s-alt_msgty .

FIELD v_t5asrmsgmap1s-alt_msgid .

FIELD v_t5asrmsgmap1s-alt_msgno .

FIELD v_t5asrmsgmap1s-alt_msgtxt .

MODULE check_fields_view1s.

MODULE set_update_flag ON CHAIN-REQUEST.

MODULE complete_v_t5asrmsgmap1s ON CHAIN-REQUEST.

ENDCHAIN.

FIELD vim_marked MODULE liste_mark_checkbox.

CHAIN.

FIELD v_t5asrmsgmap1s-msgty .

FIELD v_t5asrmsgmap1s-msgid .

FIELD v_t5asrmsgmap1s-msgno .

MODULE liste_update_liste.

ENDCHAIN.

<b> chain.

FIELD v_t5asrmsgmap1s-hide_message .

module on_hide_message.

endchain</b>.

ENDLOOP.

MODULE liste_after_loop.

-Reena

6 REPLIES 6
Read only

Former Member
0 Likes
822

Hi,

In the PAI, use the following :

CHAIN.

Field : p_checkbox.

Module Change_fields.

ENDCHAIN.

In Module Change_fields.

if p_checkbox = `X`.

LOOP at screen.

if screen-name = `EMPID`.

screen-input = 1.

endif.

modify screen.

endloop.

endif.

CHAIN. ENDCHAIN. helps to track all kind of changes in the screen fields. For anychange in the screen field CHECKBOX, module Change_fields would be called. You can check the same in Debug mode.

Best regards,

Prashant

Read only

Former Member
0 Likes
823

Hi Prashant,

I already tried as you said but by giving screen-input = 0 as I want to make the fields as output fields. But it doesn't work. When i debug, I find the function module gets called and screen-input value for fields is set to 0. But I dont see the result in the view.

I guess that screen-input is getting reset back to 1 after my module is called. So I am not sure if i am calling my module from the right place.

Here is my PAI block. The code in bold below is where i am calling the module. Is it the right place?

PROCESS AFTER INPUT.

MODULE liste_exit_command AT EXIT-COMMAND.

MODULE liste_before_loop.

LOOP AT extract.

MODULE liste_init_workarea.

CHAIN.

FIELD v_t5asrmsgmap1s-msgty .

FIELD v_t5asrmsgmap1s-msgid .

FIELD v_t5asrmsgmap1s-msgno .

FIELD v_t5asrmsgmap1s-msgtxt .

FIELD v_t5asrmsgmap1s-hide_message .

FIELD v_t5asrmsgmap1s-alt_msgty .

FIELD v_t5asrmsgmap1s-alt_msgid .

FIELD v_t5asrmsgmap1s-alt_msgno .

FIELD v_t5asrmsgmap1s-alt_msgtxt .

MODULE check_fields_view1s.

MODULE set_update_flag ON CHAIN-REQUEST.

MODULE complete_v_t5asrmsgmap1s ON CHAIN-REQUEST.

ENDCHAIN.

FIELD vim_marked MODULE liste_mark_checkbox.

CHAIN.

FIELD v_t5asrmsgmap1s-msgty .

FIELD v_t5asrmsgmap1s-msgid .

FIELD v_t5asrmsgmap1s-msgno .

MODULE liste_update_liste.

ENDCHAIN.

<b> chain.

FIELD v_t5asrmsgmap1s-hide_message .

module on_hide_message.

endchain</b>.

ENDLOOP.

MODULE liste_after_loop.

-Reena

Read only

0 Likes
822

Reena,

no it's not the right place. The formatting of your output has to be done at the pbo. So you have to recognise that the request has been made at pai and then act on it at pbo.

Read only

0 Likes
822

Thanks Neil & Prashant, it works now

- Reena

Read only

Former Member
0 Likes
822

Hi,

Please paste the Module module on_hide_message.

Best regards,

Prashant

Read only

Former Member
0 Likes
822

Here is the code for on_hide_message module

MODULE on_hide_message INPUT.

hide_message = v_t5asrmsgmap1s-hide_message.

IF hide_message = true.

LOOP AT SCREEN.

IF screen-name = 'V_T5ASRMSGMAP1S-ALT_MSGTY'

OR screen-name = 'V_T5ASRMSGMAP1S-ALT_MSGID'

OR screen-name = 'V_T5ASRMSGMAP1S-ALT_MSGNO'.

screen-input = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

ENDMODULE.