2006 Jun 27 12:59 PM
I have two select-options in my selection screen- a)VBAP-VBELN b)VBAP-MATNR.
My requirement is that if i enter Sales Doc(VBAP-VBELN) in first combo ,Material Number combo(VBAP-MATNR)will be populated with Material numbers for that corresponding Sales Doc only. Not all Material number.
Please help.
2006 Jun 27 1:04 PM
Hi,
check this example...
REPORT ZTEST_F4HELP .
*---Report with selection screen and to display the list of
possible entries for field 'B' as per the value in field 'A'.
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.
Cheers,
SImha.
2006 Jun 27 1:03 PM
<b>just look at this thread..
</b><b>ex---</b>TABLES : ztable
PARAMETERS : p_name(10) TYPE c.
DATA : BEGIN OF itab OCCURS 0,
name TYPE znames,
code TYPE zcodes,
END OF itab.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_name.
SELECT name code
FROM ztable
INTO TABLE itab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'NAME'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_NAME'
value_org = 'S'
TABLES
value_tab = itab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
2006 Jun 27 1:04 PM
Hi,
check this example...
REPORT ZTEST_F4HELP .
*---Report with selection screen and to display the list of
possible entries for field 'B' as per the value in field 'A'.
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.
Cheers,
SImha.
2006 Jun 27 1:06 PM
Hi deepon,
1. just copy paste
2.
report abc.
TYPE-POOLS : vrm.
DATA : v TYPE vrm_values.
DATA : vw LIKE LINE OF v.
tables : vbap.
data : itab like table of vbap with header line.
*----
parameters : vbeln like vbap-vbeln.
parameters : matnr like vbap-matnr as listbox visible length 10.
*----
at selection-screen.
select * from vbap
into table itab
where vbeln = vbeln.
*----
clear v.
loop at itab.
vw-key = itab-matnr.
vw-text = itab-matnr.
append vw to v.
endloop.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'MATNR'
values = v
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
regards,
amit m.
2006 Jun 27 1:08 PM
Hi,
check the following code.
PARAMETERS : VBELN LIKE VBAP-VBELN,
MATNR LIKE VBAP-MATNR.
AT SELECTION-SCREEN on VBELN.
data: lt_vbeln type table of vbap,
WA LIKE LINE OF LT_VBELN,
WA1 LIKE LINE OF MATNR.
SELECT *
FROM VBAP INTO lt_vbeln WHERE VBELN IN VBELN.
LOOP AT LT_VBELN INTO WA.
WA1-LOW = WA-MATNR.
APPEND WA1 TO MATNR.
ENDLOOP.
HOPE THIS HELPS.
Regards,
Kinshuk
2006 Jun 27 1:12 PM
Hi Deepon,
I hope u can do it like this...
*After entering VBAP-VBELN
at selection-screen on value-request for p_vbap_matnr.
select matnr from vbap
into table tb_temp
where vbeln = p_vbap_vbeln.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'P_p_vbap_matnr'
dynpprog = progname
dynpnr = dynnum
dynprofield = l_field
window_title = 'sales doc'(045)
value_org = 'S'
TABLES
value_tab = tb_temp
EXCEPTIONS
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc <> 0.
endif.
else.
message s999 with 'No values found'(040).
endif.
Regards,
Kiran B