select field 'B' based on field 'A'
I have a report with selection screen. I want to display the list of possible entries for field 'B' as per the value in field 'A'.
I am doing this on event
<b>"Selection screen on value-request for <B></b>
using functional module
Everything is fine except one problem.
Let's take a example that screen has two fields
<b>parsmeters: p_vbeln like vbap-vbeln.</b>
"Sales order number
<b>parameters: p_posnr like vbap-posnr.</b>
Based on sales order number i have to show an popup with corresponding line item numbers. and i have coded this under,
<b>Selection screen on value-request for POSNR</b>
<u><b>Scenario 1:</b></u> i enter the sales order number in the field p_vbeln <b>and hit enter</b>
when i do F4 on p_posnr, it displays the popup with corresponding line items.
<b>This works fine</b>
<u><b>Scenario 2:</b></u> i just type in the sales order number and <b>do not hit enter or anything)</b>
Now if i do F4 on p_posnr, it doesn't display the line items, since there is not value populated in p_vbeln as entered it but did not press enter.
I hope i am making sense.
So, my problem is how display possible value for field 'B' if user type in the value in field 'A' but do not hit enter.
Please let me know.
Rich Heilman replied
Here is how we usually do it when providing F4 help, you can use this logic for your requirement as well.
report zrich_0002 . parameters: p_vbeln type vbak-vbeln, p_posnr type vbap-posnr. at selection-screen on value-request for p_posnr. data: begin of help_item occurs 0, posnr type vbap-posnr, matnr type vbap-matnr, arktx type vbap-arktx, end of help_item. data: dynfields type table of dynpread with header line. dynfields-fieldname = 'P_VBELN'. append dynfields. call function 'DYNP_VALUES_READ' exporting dyname = sy-cprog dynumb = sy-dynnr translate_to_upper = 'X' tables dynpfields = dynfields exceptions invalid_abapworkarea = 1 invalid_dynprofield = 2 invalid_dynproname = 3 invalid_dynpronummer = 4 invalid_request = 5 no_fielddescription = 6 invalid_parameter = 7 undefind_error = 8 double_conversion = 9 stepl_not_found = 10 others = 11. read table dynfields with key fieldname = 'P_VBELN'. p_vbeln = dynfields-fieldvalue. call function 'CONVERSION_EXIT_ALPHA_INPUT' exporting input = p_vbeln importing output = p_vbeln. select posnr matnr arktx into table help_item from vbap where vbeln = p_vbeln. call function 'F4IF_INT_TABLE_VALUE_REQUEST' exporting retfield = 'POSNR' dynprofield = 'P_POSNR' dynpprog = sy-cprog dynpnr = sy-dynnr value_org = 'S' tables value_tab = help_item.
Please be sure to award points for helpful answers and mark your post as solved when solved completely. Thanks.