04-01-2020 11:32 PM
Hello,
In an abap program, I have a dynpro which contains an input field and an output field. I want to know how to update the output field after entering data on the input field and click on 'Enter' on the keyboard by the user .
Example: the user enters the customer code and after a click on 'Enter' the customer name is displayed in the output field.
Regards,
04-02-2020 4:03 AM
Hi Zakaria,
Implement your logic inside Process After Input Module.
eg.
Inside user command module add the code segment to select customer name as like below.
SELECT name1 from KNA1 into var1 WHERE KUNNR = var2.
04-02-2020 1:57 AM
This is how it will work for you, let me know if you need further information:
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (31) FOR FIELD f_input. " attribute description if wanted
PARAMETERS: f_input TYPE char10. " your input value with your data type
SELECTION-SCREEN COMMENT (02) dummy. " to leave some space
SELECTION-SCREEN COMMENT (30) f_output. " your output description
SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN OUTPUT. " this is triggered when pressed 'ENTER'
" set your logic here to fill f_output based on f_input
f_output = 'Test'
04-02-2020 4:03 AM
Hi Zakaria,
Implement your logic inside Process After Input Module.
eg.
Inside user command module add the code segment to select customer name as like below.
SELECT name1 from KNA1 into var1 WHERE KUNNR = var2.
04-02-2020 4:06 AM
bzakaria,
If its a Report Program:
You could write your code in the event AT SELECTION SCREEN. Your understanding on events is very important to write the code. Below are the two events that may confuse you, their understanding can give you a clarity.
AT SELECTION SCREEN OUTPUT --> This Event is triggered before the screen is displayed. You cannot write your logic here because when this event is triggered your user still would have not entered any value.
AT SELECTION SCREEN --> This event is used to validate your inputs which are entered in the screen. This event will be suitable for your requirement since you want to extract the text based on the input.
AT SELECTION SCREEN.
* Write a select Query that will fetch the text for the customer code and feed it to the output field
Two Points you need to handle:
1) There can be a scenario where the customer code is empty, in that case ensure your select query does not run unnecessarily.
2) The customer code value entered can be wrong as well, so its important you validate the customer code before you write a query for fetching the text.
If its a Module Pool program:
You have to write your Code in the event PROCESS AFTER INPUT of the screen.The above consideration will hold true here as well.
Regards!
04-05-2020 10:59 AM
This is a bit confusing. It's perfectly possible to use screens other than a selection screen in a report program..
04-05-2020 3:31 AM
michael.piesche , th_budunwela44 , satishkumarbalasubramanian
Thank you for your help.
I would like to know how to distinguish between the input fields. because my case is that I have 4 input fields and 4 output fields, each output field displays the designation of an input field.
Today when clicks on 'Enter' in an input field: 4 requests are executed.
regards,
04-05-2020 7:14 AM
bzakaria , please follow the community guidelines:
And when you do open another question, try to be more specific on the content of your request:
04-05-2020 5:33 AM
Dear Zakaria
If you have four input fields as you said, then you need to add the IF condition as below:
AT SELECTION-SCREEN OUTPUT.
IF NOT input_field_1 is INITIAL.
"write your select or display statement for input_field_1 here.
ENDIF.
IF NOT input_field_2 is INITIAL.
"write your select or display statement for input_field_1 here.
ENDIF.
.......
.......
Regards,
Venkat
04-05-2020 10:54 AM
In the Process After Input of your screen, you can link a certain module to a field and add further syntax to limit it to data-changes or -inputs in said field.
Some sample code below, and I suggest you look up these statements:
FIELD [input-field] MODULE [corresponding-module].
If you want to trigger the same module for different fields, that can be done as well with the CHAIN-ENDCHAIN statements.
Now if I'm mistaken and you're working with a selection screen, then forget what I said and check Michael Piesche's posts.
Good luck
04-06-2020 8:02 PM