Application Development 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: 

How to make input field non-editable through search help?

Former Member
0 Kudos

Hi,

    I want to make field non-editable through search help. But my search help is not hitting the non-editable field.

There are 4 fields which are populated through search help, but first 2 fields are populated which are editable  but remaining 2 fields which are non-editable they are not populated.

I have searched on SCN but I have not found any workaround condition in detailed.

Please suggest work around solution in detail.

Thank You.

1 ACCEPTED SOLUTION

pranay570708
Active Contributor
0 Kudos

Try below sample code:

PARAMETERS: P_MATNR LIKE MARA-MATNR.

DATA F4.

INITIALIZATION.

   LOOP AT SCREEN.

     IF SCREEN-NAME = 'P_MATNR'.

       SCREEN-INPUT = '0'.

       MODIFY SCREEN.

     ENDIF.

   ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

   DATA: TABNAME   TYPE  DFIES-TABNAME,

         FIELDNAME TYPE  DFIES-FIELDNAME.

   DATA  T_VALUE    TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.

   CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

     EXPORTING

       TABNAME           = TABNAME

       FIELDNAME         = FIELDNAME

       SEARCHHELP        = 'MAT1'

     TABLES

       RETURN_TAB        = T_VALUE

     EXCEPTIONS

       FIELD_NOT_FOUND   = 1

       NO_HELP_FOR_FIELD = 2

       INCONSISTENT_HELP = 3

       NO_VALUES_FOUND   = 4

       OTHERS            = 5.

   IF SY-SUBRC <> 0.

     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ELSE.

     READ TABLE T_VALUE INDEX 1.

     P_MATNR = T_VALUE-FIELDVAL.

     F4 = 'x'.

     SET SCREEN 1000. LEAVE SCREEN.

   ENDIF.

AT SELECTION-SCREEN OUTPUT.

   IF F4 = 'x'.

     LOOP AT SCREEN.

       SCREEN-INPUT = 0.

       MODIFY SCREEN.

     ENDLOOP.

   ENDIF.

18 REPLIES 18

sabirshah1
Participant
0 Kudos

Hi,

Your requirement is not clear ,

u mean to say , when u press F4 button u r not able to see search help list ?

Regards,

Sabir Shah.

0 Kudos

No I am able to see F4 even if the fields are non editable mode but the values are not populated through search help. It remains blank.


0 Kudos

Hi ,

IF u will use input fields in disable mode , the values will not be populated in those fields , for that u have make fields editable and fill values and after filling values provide a check or disable them.

Regards ,

Sabir Shah.

0 Kudos

It becomes non-editable as it is mandatory but i want that as soon as user enters the value it should become non-editable.

0 Kudos

to make fields editable or non editable , u have to go table maintenance generator function module , and implement code in PBO and PAI as per your requirement ,

Loop at screen.

if screen-fieldname = 'Field'.

screen-input = 0.

endif.

modify screen.

endloop.

pranay570708
Active Contributor
0 Kudos

Try below sample code:

PARAMETERS: P_MATNR LIKE MARA-MATNR.

DATA F4.

INITIALIZATION.

   LOOP AT SCREEN.

     IF SCREEN-NAME = 'P_MATNR'.

       SCREEN-INPUT = '0'.

       MODIFY SCREEN.

     ENDIF.

   ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

   DATA: TABNAME   TYPE  DFIES-TABNAME,

         FIELDNAME TYPE  DFIES-FIELDNAME.

   DATA  T_VALUE    TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.

   CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

     EXPORTING

       TABNAME           = TABNAME

       FIELDNAME         = FIELDNAME

       SEARCHHELP        = 'MAT1'

     TABLES

       RETURN_TAB        = T_VALUE

     EXCEPTIONS

       FIELD_NOT_FOUND   = 1

       NO_HELP_FOR_FIELD = 2

       INCONSISTENT_HELP = 3

       NO_VALUES_FOUND   = 4

       OTHERS            = 5.

   IF SY-SUBRC <> 0.

     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ELSE.

     READ TABLE T_VALUE INDEX 1.

     P_MATNR = T_VALUE-FIELDVAL.

     F4 = 'x'.

     SET SCREEN 1000. LEAVE SCREEN.

   ENDIF.

AT SELECTION-SCREEN OUTPUT.

   IF F4 = 'x'.

     LOOP AT SCREEN.

       SCREEN-INPUT = 0.

       MODIFY SCREEN.

     ENDLOOP.

   ENDIF.

Former Member
0 Kudos

Hi,

If the field is in editable mode the f4 help values will not populated.

The F4 help values are populated only in editable mode.

Regards,

Mahesh

0 Kudos

yes, we can populate. check sample code i have pasted above.

0 Kudos

Hi.
have u Tried, What he suggested.

Pranay Patel

You Can use At selection-screen Ouput Then make it screen-output =0.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

     IF SCREEN-NAME = 'S_VBELN-HIGH'.

       SCREEN-INPUT = 0.

       MODIFY SCREEN.

     ENDIF.

   ENDLOOP.

0 Kudos

I want the given scenario for table maintenance generator, not in report.

0 Kudos

you can achieve that through events in table maintenance generator.

0 Kudos

Hi Pranay,

                 Please suggest me to use which event?

Is the event "Fill Hidden Fields" .

Please suggest me, still I have not found any solution.

Thanks,

Regards.


Sandra_Rossi
Active Contributor
0 Kudos

Be careful, you should be clear in your question, not too much theoretical. If I understand well, you don't need any ABAP.

You have generated a table/view maintenance dialog for a given custom table(s).

For every line, you have 2 input fields, and 2 output fields. Where do these 2 output fields come from? (I guess these are fields which do not belong to the maintained table, but these are text fields coming from a text table(s))

When you press F4 on these 2 input fields, you want the 2 output fields being filled.

For this scenario, you can achieve this using a view of type "maintenance view", by joining the main table, and the text table(s) (note: it is/they are to be connected to the main table via foreign key(s) in the main table, of type "text table"). In this view, you define the text fields of type "display only".

You generate a dialog for this maintenance view.

If it's another scenario, please clarify.

PS: in any case, via a search help, and without any ABAP, you may press F4 on an input field, and based on the selected value, the output field can be automatically filled out.

0 Kudos

I have already created TMG, why I would go on create maintenance view for the table?

And SAP doesn't allow to create maintenance view after creating TMG.

0 Kudos

Generating a TMD takes 2 seconds. As I said, a maintenance view allows to define read-only fields without ABAP. What is your exact scenario please?

0 Kudos

Requirement :

My search help is not hitting the non-editable field. I am retrieving 4 fields from search help, with the help of first field remaining 3 fields are fetched. But my requirement is that after fetching the value from search help field 3rd and 4th should be in non-editable format. Again I am saying as soon as values are fetched from search help field 3rd and 4th should be in non-editable format.

Issue :

As I tried through TMG making the field in non-editable format. As soon I made it in non-editable format the search help is not hitting the non-editable field.

Please Suggest,

Regards.

0 Kudos

Okay, so you want the field to be initially in "input" mode, and after F4 is pressed which returns a value in this field, you change it in "output" mode (that wasn't clear at all in your first question! You said it in one subsequent post, but it was a little be lost). So the answer by corresponds to what you want, except that you want it for TMD.

To make the field "output", you need to change the input attribute to "off" (SCREEN-INPUT = '0') at runtime in the PBO.

But when a search help is called by the system, the PBO is not called.

So you need to call the search help programmatically, and trigger the PAI (which in turn will trigger the PBO), that you may do using LEAVE SCREEN from the POV.

So, anyway, you need to change the flow logic, add a PROCESS ON VALUE-REQUEST for your field, So, no TMD event needed.

PS: I don't really like the solution of changing the flow logic as it might be overriden in the next generation of the TMD (if dynpro is to be regenerated), but I don't think of any other solution.

0 Kudos

By the way, I don't see the interest of protecting a field after the F4 in a TMD, as it is a very simple dialog (list and detail screens, that's all). I mean, this can be useful in more complex custom dialogs, but why do you need it in a TMD, is that so much important?