‎2008 Feb 29 8:24 AM
Hi,
As per my requirement,my selection screen contains company code and purchase org fields.
Depending on company code i enter, search help for purchase org field should be displayed ie., for eg., if i enter company code 1000, then purchase org which comes under co.code 1000 should be displayed in search help of purchase org field.
Pls check my below code...
TYPES : BEGIN OF ty_ekorg,
ekorg TYPE ekorg,
END OF ty_ekorg.
DATA : wa_ekorg TYPE ty_ekorg,
t_ekorg LIKE TABLE OF wa_ekorg.
PARAMETERS : compcode(4) TYPE c DEFAULT '1000' OBLIGATORY,
ekorg type ekorg OBLIGATORY.
DATA : dynpro_values TYPE TABLE OF dynpread,
progname TYPE sy-repid,
dynum TYPE sy-dynnr.
at selection-screen on value-request for ekorg.
select ekorg from ekko into table t_ekorg where bukrs = compcode.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = progname
dynumb = dynum
translate_to_upper = 'X '
TABLES
dynpfields = dynpro_values
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.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'EKORG'
dynpprog = progname
dynpnr = dynum
dynprofield = 'EKORG'
value_org = 'S'
TABLES
value_tab = t_ekorg
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I have coded as above and got search help in field ekorg. But when i select any value from search help its not getting displayed in ekorg field in selection screen.
pls help me to know whats wrong in my code and what should i do to get value displayed in field when i select value from search help.
Thanks in advance,
Akshaya
‎2008 Feb 29 8:31 AM
hi,
before you call FM F4IF_INT_TABLE_VALUE_REQUEST, t_ekorg has to be filled up by values by you.
hope this helps
ec
‎2008 Feb 29 9:50 AM
Hi Eric and Swati,
Thanks for your reply.
Please find that i have written the select query before FM DYNP_VALUES_READ and populated the itab t_ekorg already. I am getting values in search help and when i select any values from the search help, its not getting displayed in selection screen field.
For eg., if i have selected company code as 1000 and for that co.code, if porg is 1000 and if i select that 1000 from search help,its not getting displayed in field ekorg.
‎2008 Feb 29 8:42 AM
Hi Akshaya,
Before CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' populate your internal table t_ekorg using select query.
e.g.
SELECT ekorg
INTO TABLE t_ekorg
FROM <table_name>
WHERE <company_code> = dynfields-fieldvalue.
SORT itab_mtart BY mtart .
DELETE ADJACENT DUPLICATES FROM itab_mtart.
‎2008 Feb 29 8:44 AM
Hi Akshaya,
sorry for incomplete earlier post.
Before CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' populate your internal table t_ekorg using select query.
e.g.
SELECT ekorg
INTO TABLE t_ekorg
FROM <table_name>
WHERE <company_code> = dynfields-fieldvalue.
SORT t_ekorg BY ekorg.
DELETE ADJACENT DUPLICATES FROM t_ekorg.
<REMOVED BY MODERATOR>
Thanks,
Swati
Edited by: Alvaro Tejada Galindo on Feb 29, 2008 5:32 PM
‎2008 Feb 29 10:10 AM
Hi Akshaya,
Try with following code..
Get the return value in return tab.
Update the value in the screen manualy.
Regards
Suthan
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'EKORG'
dynpprog = progname
dynpnr = dynum
dynprofield = 'EKORG'
value_org = 'S'
TABLES
value_tab = t_ekorg
RETURN_TAB = lt_return_tab
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
ls_dynpfields-fieldname = 'EKORG'.
READ TABLE lt_return_tab INTO ls_return_tab
WITH KEY fieldname = 'EKORG'.
IF sy-subrc = 0.
ls_dynpfields-fieldvalue = ls_return_tab-fieldval.
ENDIF.
APPEND ls_dynpfields TO lt_dynpfields_upd.
Update screen
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = lt_dynpfields_upd
EXCEPTIONS
OTHERS = 0.
ENDIF.
Edited by: Suthan Thanappan on Feb 29, 2008 11:13 AM
‎2008 Feb 29 8:48 AM
Hi,
before calling the function module 'F1IF_....', populate the internal table with the data.
‎2008 Feb 29 11:46 AM
Hi Akshaya,
You should assign values to the variable progname and dynum before calling the fm F4IF_INT_TABLE_VALUE_REQUEST like this,
progname = sy-repid.
dynum = sy-dynnr.
use this code .
TYPES : BEGIN OF ty_ekorg,
ekorg TYPE ekorg,
END OF ty_ekorg.
DATA : wa_ekorg TYPE ty_ekorg,
t_ekorg LIKE TABLE OF wa_ekorg.
PARAMETERS : compcode(4) TYPE c DEFAULT '1000' OBLIGATORY,
ekorg type ekorg OBLIGATORY.
DATA : dynpro_values TYPE TABLE OF dynpread,
progname TYPE sy-repid,
dynum TYPE sy-dynnr.
at selection-screen on value-request for ekorg.
select ekorg from ekko into table t_ekorg where bukrs = compcode.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = progname
dynumb = dynum
translate_to_upper = 'X '
TABLES
dynpfields = dynpro_values
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.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
progname = sy-repid.
dynum = sy-dynnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'EKORG'
dynpprog = progname
dynpnr = dynum
dynprofield = 'EKORG'
value_org = 'S'
TABLES
value_tab = t_ekorg
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
Regards,
Charumathi.B