2010 Jun 29 11:50 AM
This is a problem in Dialog Programming. I want to read the DDLB option selected by the user, but am not getting this value in the PAI module.
I have created a screen '200' in my program and set it as a 'Modal Dialog Box'. It has got the following elements.
1. LBL_REASON Text
2. TXT_REASON I/O
3. OK_CODE OK
The element TXT_REASON is a 'Listbox with Key'. Additionally, I have declared the elements as follows in the TOP Include.
type-POOLs : VRM.
DATA: ok_code TYPE sy-ucomm,
txt_reason TYPE char80.
In the PBO, I have set the values in the DDLB as follows.
set the values in the DDLB
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'TXT_REASON'
values = lt_rsn_code_ip.
The passed values are properly available in the DDLB. However, the selected value is not available in the PAI module. The PAI code is given below.
data: dynpfields like dynpread occurs 1 with header line.
dynpfields-fieldname = 'TXT_REASON' .
append dynpfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-cprog "Current program
dynumb = sy-dynnr "Current screen
tables
dynpfields = dynpfields "Relevant screen fields
exceptions
others = 0.
MOVE txt_reason TO gv_sel_reason.
So, I have made two attempts to get the selected value.
1. Used FM 'DYNP_VALUES_READ' to read the field
2. Tried to access the value of txt_reason
Both the internal table dynpfields and the field txt_reason are empty.
Am I missing something? Please help.
Thanks and regards,
Abhinava
2010 Jun 29 12:17 PM
hi,
i am not clear wats ur requirment but wat i understood is tat u have a dropdown list with 3 values for eg 1,2 & 3 thne wen u select 2 u want tat 2 in the pai if tat is ur requirement then assign a fcode to tat field (dropdown field ) in screen painter field attributes .
Hope this help u
This is a problem in Dialog Programming. I want to read the DDLB option selected by the user, but am not getting this value in the PAI module.
I have created a screen '200' in my program and set it as a 'Modal Dialog Box'. It has got the following elements.
1. LBL_REASON Text
2. TXT_REASON I/O
3. OK_CODE OK
The element TXT_REASON is a 'Listbox with Key'. Additionally, I have declared the elements as follows in the TOP Include.
type-POOLs : VRM.
DATA: ok_code TYPE sy-ucomm,
txt_reason TYPE char80.
In the PBO, I have set the values in the DDLB as follows.
set the values in the DDLB
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'TXT_REASON'
values = lt_rsn_code_ip.
The passed values are properly available in the DDLB. However, the selected value is not available in the PAI module. The PAI code is given below.
data: dynpfields like dynpread occurs 1 with header line.
dynpfields-fieldname = 'TXT_REASON' .
append dynpfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-cprog "Current program
dynumb = sy-dynnr "Current screen
tables
dynpfields = dynpfields "Relevant screen fields
exceptions
others = 0.
MOVE txt_reason TO gv_sel_reason.
So, I have made two attempts to get the selected value.
1. Used FM 'DYNP_VALUES_READ' to read the field
2. Tried to access the value of txt_reason
Both the internal table dynpfields and the field txt_reason are empty.
Am I missing something? Please help.
Thanks and regards,
Abhinava
2010 Jun 29 12:17 PM
hi,
i am not clear wats ur requirment but wat i understood is tat u have a dropdown list with 3 values for eg 1,2 & 3 thne wen u select 2 u want tat 2 in the pai if tat is ur requirement then assign a fcode to tat field (dropdown field ) in screen painter field attributes .
Hope this help u
2010 Jun 29 12:48 PM
No, you are not missing anything. I made a test, the following code works fine
TYPE-POOLS : vrm.
DATA: ok_code TYPE sy-ucomm,
txt_reason TYPE char80.
DATA value_tab TYPE vrm_values WITH HEADER LINE.
CALL SCREEN 100.
MODULE pbo OUTPUT.
REFRESH value_tab.
value_tab-key = '1'.
value_tab-text = 'TRUE'.
APPEND value_tab.
value_tab-key = '0'.
value_tab-text = 'FALSE'.
APPEND value_tab.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'TXT_REASON'
values = value_tab[].
ENDMODULE.
MODULE pai INPUT.
DATA: dynpfields LIKE dynpread OCCURS 1 WITH HEADER LINE.
dynpfields-fieldname = 'TXT_REASON' .
APPEND dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog "Current program
dynumb = sy-dynnr "Current screen
TABLES
dynpfields = dynpfields "Relevant screen fields
EXCEPTIONS
OTHERS = 0.
"here field FIELDVALUE of DYNPFIELDS holds value 0 or 1 (key of selected entry)
ENDMODULE.
So it seems very alike to your code. I can only suspect the error comes with screen pbo and pai. Ensure these two are set for this screen modal box. If you use other screen PAI you will not get the values of that field as they simply don't exist there.
But as suggested above there is no reason to use DYNP_VALUES_READ as the txt_reason will receive selected value automatically. Make sure that you have corresponding listbox field txt_reason format set to CHAR as well. All the rest will come as standard.
Also please close duplicating thread
Regards
Marcin
2010 Jun 30 3:16 PM
Visible length of txt_reason was 30 so the value was no coming in the field. Resolved by extending the visible length.
2010 Jun 30 3:18 PM
Visible length of txt_reason was 30 so the value was no coming in the field. Resolved by extending the visible length.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |