‎2009 Mar 16 12:36 PM
hi all,
I tryed many things, but with no succesful.
I need to show a F4 in a field of a screen, the problem are the values. I need to return 2 keys.
Example:
cod1 text1 cod2 text
1 texto1-01 1 texto2-01
2 texto1-02 1 texto2-01
3 texto1-03 1 texto2-01
1 texto1-01 2 texto2-02
2 texto1-02 2 texto2-02
How we can see, if we choice the first line and if return only the field cod1, I cannot know if is the Line 1 or the Line 4...
I tried FM F4IF_FIELD_VALUE_REQUEST, but I can pass one field at SHLPPARAM parameter.
I have a help search, but show only 1 fields as primary key.
Thanks for advanced.
Allan Cristian
‎2009 Mar 16 12:39 PM
Hello ,
try this :
buils table for DYNPFLD_MAPPING for this FM.
e.g : ls_loto-fldname = 'CARRID'.
ls_loto-dyfldname = 'ABC'.
APPEND ls_loto to loto.
CLEAR ls_loto.
ls_loto-fldname = 'CONNID'.
ls_loto-dyfldname = 'ABCD'.
APPEND ls_loto to loto.
Then pass this table to FM:
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SFLIGHT'
retfield = 'CARRID'
* PVALKEY = ' '
DYNPPROG = sy-repid
DYNPNR = sy-dynnr
DYNPROFIELD = 'ABC'
VALUE_ORG = 'S'
tables
value_tab = it_sflight
FIELD_TAB = lot
RETURN_TAB = ret
DYNPFLD_MAPPING = loto.
Hoep this helps.
‎2009 Mar 16 12:39 PM
Hello ,
try this :
buils table for DYNPFLD_MAPPING for this FM.
e.g : ls_loto-fldname = 'CARRID'.
ls_loto-dyfldname = 'ABC'.
APPEND ls_loto to loto.
CLEAR ls_loto.
ls_loto-fldname = 'CONNID'.
ls_loto-dyfldname = 'ABCD'.
APPEND ls_loto to loto.
Then pass this table to FM:
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SFLIGHT'
retfield = 'CARRID'
* PVALKEY = ' '
DYNPPROG = sy-repid
DYNPNR = sy-dynnr
DYNPROFIELD = 'ABC'
VALUE_ORG = 'S'
tables
value_tab = it_sflight
FIELD_TAB = lot
RETURN_TAB = ret
DYNPFLD_MAPPING = loto.
Hoep this helps.
‎2009 Mar 16 12:48 PM
‎2009 Mar 16 12:41 PM
you can not achive this until you have a distingusihing key filed in the F4 internal table, you can add a dummy filed to the internal table whcih would act as a key.
you need to have this dummy filed in target internal table too, then only you can map the same.
‎2009 Mar 16 12:48 PM
HI,
Check this Code....
PARAMETES : p_werks type ...
PARAMETES : p_plnnr type ....
PARAMETES : p_plnal type....
AT SELECTION-SCREEN ON P_PLNNR.
data:
lg_condition type string.
data:
lwa_ddshretval type ddshretval,
lwa_dselc type dselc,
lwa_dynpread type dynpread.
data:
li_f4_insp type standard table of t_f4_insp,
li_ddshretval type standard table of ddshretval,
li_dselc type standard table of dselc,
li_dynpread type standard table of dynpread.
lwa_dynpread-fieldname = 'P_WERKS'.
append lwa_dynpread to li_dynpread.
clear lwa_dynpread.
* Read Screen Field Values.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-repid
dynumb = sy-dynnr
tables
dynpfields = li_dynpread.
* Read the first record as only one record will be present
read table li_dynpread into lwa_dynpread index 1.
p_werks = lwa_dynpread-fieldvalue.
if p_werks is initial.
move 'PLNTY EQ ''Q''' to lg_condition.
else.
move 'WERKS EQ P_WERKS AND PLNTY EQ ''Q''' to lg_condition.
endif.
* Fetch Data
select werks
plnnr
plnal
plnty
ktext
into table li_f4_insp
from plko
where (lg_condition).
lwa_dselc-fldname = 'F0002'.
lwa_dselc-dyfldname = 'PLNNR'.
append lwa_dselc to li_dselc.
clear lwa_dselc.
lwa_dselc-fldname = 'F0003'.
lwa_dselc-dyfldname = 'PLNAL'.
append lwa_dselc to li_dselc.
clear lwa_dselc.
* FM For F4 Help
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'PLNNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'PLNNR'
value_org = 'S'
tables
value_tab = li_f4_insp
return_tab = li_ddshretval
dynpfld_mapping = li_dselc
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc eq 0.
refresh li_dynpread.
read table li_ddshretval into lwa_ddshretval index 1.
if sy-subrc eq 0.
move lwa_ddshretval-fieldval to p_plnnr.
lwa_dynpread-fieldname = 'P_PLNNR'.
lwa_dynpread-fieldvalue = lwa_ddshretval-fieldval.
append lwa_dynpread to li_dynpread.
clear lwa_dynpread.
endif. " IF sy-subrc EQ 0.
read table li_ddshretval into lwa_ddshretval index 2.
if sy-subrc eq 0.
move lwa_ddshretval-fieldval to p_plnal.
lwa_dynpread-fieldname = 'P_PLNAL'.
lwa_dynpread-fieldvalue = lwa_ddshretval-fieldval.
append lwa_dynpread to li_dynpread.
clear lwa_dynpread.
endif. " IF sy-subrc EQ 0.
endif. " IF sy-subrc EQ 0.
* Set Screen Field Values.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-repid
dynumb = sy-dynnr
tables
dynpfields = li_dynpread
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
check sy-subrc eq 0.