‎2005 Oct 22 2:40 PM
HI
I HAVE AN ISSUE
I have created a table-control in dialog programing.
It has five columns. i have set the first column in active mode and the remaining column four column in inactive mode.
Now if i enter the first column value and press 'ENTER' in the keyboard the other column should also be filled dynamically.
So can you suggest me how does the system recognize the 'ENTER' button in the keyboard.
Deepak
‎2005 Oct 22 3:16 PM
Hi
you have to check the value of OK_CODE, if user press enter the OK_CODE has the value of the first function of standard toolbar of your gui status.
It doesn't usually give a value to that function, so if user press key, the OK_CODE value is space.
Max
Message was edited by: max bianchi
‎2005 Oct 22 3:35 PM
Hi deepak,
To handle any user comand, like enter or any other key, you need to assign an ok code to that user action.
YOu can do that in a PF status.
TO handle what is to be done when the user presses enter,
write the code in PAI module, User_command.
In that module,
check for the Sy-ucomm value and if it is
'ENTE' (For enter) write the logic to make your table control's fields to be populated.
Thanks,
ravi
‎2005 Oct 22 3:37 PM
Hi Deepak,
Normally, when the user hits the enter button, the screen is refreshed (ie, the PAI and PBO are executed). Thus, you do not really need to code for this event if all you want to do is populate the internal table. Just make sure that the select is executed in the PBO, so that the values are selected into the internal table. These should reflect in the table control.
If you want to explicitely code for the event, you can do it the way Max has suggested above, or create an OK-CODE for the enter button (in the status) and code for the same.
Sudha
‎2005 Oct 22 6:02 PM
what u need to do is to fill the underlying internal table in the PAI ...that means when u fill the first column, based on that fill your internal table in PAI..even if you don't specify an OK CODE...just write the code to retrieve values for other columns....
once your internal table is populated, the values will be visible once the PBO is executed....
rgds,
PJ
‎2005 Oct 23 8:33 PM
Hi,
When ever ENTER Key is executed, the flows into the PAI of the screen and then it gets the Next screen number from the attributes of the current screen and it goes into the PBO of the next screen number. Usually we give the same number as the current screen number for better control over the flow.
For example, we have the material number as one of the field in the table control which is active, once we enter the material number and press on the ENTER key it should fill the material description in the other field which is in display mode.
The screen fields names on the table table controls are for material(MARA-MATNR) and for Material description(MAKT-MAKTX).
<b>Pseudo logic in flow logic:</b>
<b>PROCESS BEFORE OUTPUT.</b>
MODULE STATUS_0100.
Assignign data to the screen
LOOP AT IT_ITAB CURSOR TC1-CURRENT_LINE .
Module to populate the table control
MODULE SCREEN_MODIFY.
ENDLOOP.
<b>PROCESS AFTER INPUT.</b>
LOOP AT IT_ITAB.
Module to get material description
MODULE GET_MATERIAL_DESCRIPTION.
ENDLOOP.
<b>Code in the above modules</b>
<b>MODULE SCREEN_MODIFY.</b>
MARA-MATNR = IT_ITAB-MATNR.
MAKT-MAKTX = IT_ITAB-MAKTX.
<b>ENDMODULE. " SCREEN_MODIFY OUTPUT</b>
<b>MODULE GET_MATERIAL_DESCRIPTION.</b>
select maktx
into it_itab-maktx
from makt
where matnr = it_itab-matnr and
spras = sy-langu.
if sy-subrc = 0.
To modify data from the table control
MODIFY IT_ITAB INDEX TC1-CURRENT_LINE.
endif.
<b>ENDMODULE. " GET_MATERIAL_DESCRIPTION INPUT.</b>