‎2006 Oct 03 2:17 PM
Hi there. I have 3 fields on a screen (bukrs, anln1, anln2 - From table anla). My question is how can I reach that if I choose a bukrs, in the next field (anln1) only that values will appear which belongs to the given bukrs.
‎2006 Oct 03 2:21 PM
Proceed on the following lines:
1)
process on value-request.
field v_land1 module country_value_help. " Module for Value Request
field v_regio module region_value_help. " Module for Value Request
2)
&----
*& Module country_value_help INPUT
&----
text
----
MODULE country_value_help INPUT.
Internal table for Country and its Description
data: begin of t_t005t occurs 0,
LAND1 like t005t-land1,
LANDX like t005t-landx,
end of t_t005t.
data: v_choice like sy-tabix. " Index of selected row
Internal table for Dynpro fields and their values
data: begin of t_dynpfields occurs 0.
include structure dynpread.
data: end of t_dynpfields.
Get the country codes and their descriptions
select land1
landx
from t005t
into table t_t005t
where spras = 'EN'.
if not t_t005t[] is initial..
Pop up to display the Countries
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 55
ENDPOS_ROW = 40
STARTPOS_COL = 40
STARTPOS_ROW = 20
TITLETEXT = 'Country'
IMPORTING
CHOISE = v_choice
TABLES
VALUETAB = t_t005t
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
if sy-subrc = 0.
if v_activity = 'V'.
read table t_t005t index v_choice.
if sy-subrc = 0.
v_land1 = t_t005t-land1.
clear : v_choice,
t_dynpfields,
t_dynpfields[].
move 'V_LANDX' to t_dynpfields-fieldname.
move t_t005t-landx to t_dynpfields-fieldvalue.
append t_dynpfields.
Update the screen field for Country Description
call function 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
endif.
endif.
endif.
endif.
ENDMODULE. " country_value_help INPUT
&----
*& Module region_value_help INPUT
&----
text
----
MODULE region_value_help INPUT.
Internal table for Region and its Description
data: begin of t_t005u occurs 0,
LAND1 like t005u-land1,
BLAND like t005u-bland,
Bezei like t005u-bezei,
end of t_t005u.
Ranges for Country
ranges: r_land1 for t005u-land1.
Get the country codes and their descriptions
refresh r_land1.
clear r_land1.
refresh t_dynpfields.
move 'V_LAND1' to t_dynpfields-fieldname.
append t_dynpfields.
clear t_dynpfields.
Read the value in the Country field on the screen
call function 'DYNP_VALUES_READ'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
translate_to_upper = 'X'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
read table t_dynpfields with key fieldname = 'V_LAND1'.
if not t_dynpfields-FIELDVALUE is initial.
r_land1-low = t_dynpfields-FIELDVALUE.
r_land1-sign = 'I'.
r_land1-option = 'EQ'.
append r_land1.
clear r_land1.
endif.
Get the Regions to be displayed as F4 Help
select land1
bland
bezei
from t005u
into table t_t005u
where spras = 'EN'
and land1 in r_land1.
if not t_t005u[] is initial..
Popup to display Valid Regions for the selected country
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 60
ENDPOS_ROW = 40
STARTPOS_COL = 40
STARTPOS_ROW = 20
TITLETEXT = 'Region'
IMPORTING
CHOISE = v_choice
TABLES
VALUETAB = t_t005u
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
if sy-subrc = 0.
if v_activity = 'V'.
read table t_t005u index v_choice.
if sy-subrc = 0.
v_regio = t_t005u-bland.
move 'V_BEZEI' to t_dynpfields-fieldname.
move t_t005u-bezei to t_dynpfields-fieldvalue.
append t_dynpfields.
Update the Region description on the screen.
call function 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
endif.
endif.
endif.
endif.
ENDMODULE. " region_value_help INPUT
Regards,
ravi
‎2006 Oct 03 2:19 PM
‎2006 Oct 03 2:41 PM
Hello it's a module pool screen. The layout created with screen painter and I get the fields from the data dictionary anla-bukrs, anla-anln1, anla-anln2. I want to reach that if I choose for example bukrs 1000, then in the next field on the screen (anln1), I can choose only that anln1 which belongs to the given bukrs(1000).
‎2006 Oct 03 2:44 PM
JAKOB,
this code will solve ur issue..
write the code below in
PROCESS ON VALUE-REQUEST.
FIELD SCREEN-BUKRS MODULE GET_BUKRS.
MODULE GET_BUKRS.
DATA : int_dselc LIKE TABLE OF dselc WITH HEADER LINE.
DATA : BEGIN OF int_ref_tab OCCURS 10,
BUKRS LIKE ANLA-BUKRS,
ANLN1 LIKE ANLA-ANLN1,
ANLN2 LIKE ANLA-ANLN2,
END OF int_ref_tab.
SELECT BUKRS ANLN1 ANLN2
FROM ANLA
INTO TABLE int_ref_tab.
int_dselc-fldname = 'F0002'.
int_dselc-dyfldname = 'SCREEN-ANLN1'.
APPEND int_dselc.
int_dselc-fldname = 'F0003'.
int_dselc-dyfldname = 'SCREEN-ANLN2'.
APPEND int_dselc.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BUKRS'
dynpprog = 'PROGRAM NAME'
dynpnr = sy-dynnr
dynprofield = 'SCREEN-BUKRSNAME'
value_org = 'S'
TABLES
value_tab = int_ref_tab
dynpfld_mapping = int_dselc
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.
ENDMODULE.
<b>GIVE POINTS IF HELPFUL</b>
‎2006 Oct 03 2:21 PM
Hi jakob,
1. just define like this
2. and it will come AUTOMATICALLY
3.
report abc.
PARAMETERS : BUKRS LIKE ANLA-BUKRS,
ANLN1 LIKE ANLA-ANLN1,
ANLN2 LIKE ANLA-ANLN2
.
regards,
amit m.
‎2006 Oct 03 2:21 PM
Proceed on the following lines:
1)
process on value-request.
field v_land1 module country_value_help. " Module for Value Request
field v_regio module region_value_help. " Module for Value Request
2)
&----
*& Module country_value_help INPUT
&----
text
----
MODULE country_value_help INPUT.
Internal table for Country and its Description
data: begin of t_t005t occurs 0,
LAND1 like t005t-land1,
LANDX like t005t-landx,
end of t_t005t.
data: v_choice like sy-tabix. " Index of selected row
Internal table for Dynpro fields and their values
data: begin of t_dynpfields occurs 0.
include structure dynpread.
data: end of t_dynpfields.
Get the country codes and their descriptions
select land1
landx
from t005t
into table t_t005t
where spras = 'EN'.
if not t_t005t[] is initial..
Pop up to display the Countries
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 55
ENDPOS_ROW = 40
STARTPOS_COL = 40
STARTPOS_ROW = 20
TITLETEXT = 'Country'
IMPORTING
CHOISE = v_choice
TABLES
VALUETAB = t_t005t
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
if sy-subrc = 0.
if v_activity = 'V'.
read table t_t005t index v_choice.
if sy-subrc = 0.
v_land1 = t_t005t-land1.
clear : v_choice,
t_dynpfields,
t_dynpfields[].
move 'V_LANDX' to t_dynpfields-fieldname.
move t_t005t-landx to t_dynpfields-fieldvalue.
append t_dynpfields.
Update the screen field for Country Description
call function 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
endif.
endif.
endif.
endif.
ENDMODULE. " country_value_help INPUT
&----
*& Module region_value_help INPUT
&----
text
----
MODULE region_value_help INPUT.
Internal table for Region and its Description
data: begin of t_t005u occurs 0,
LAND1 like t005u-land1,
BLAND like t005u-bland,
Bezei like t005u-bezei,
end of t_t005u.
Ranges for Country
ranges: r_land1 for t005u-land1.
Get the country codes and their descriptions
refresh r_land1.
clear r_land1.
refresh t_dynpfields.
move 'V_LAND1' to t_dynpfields-fieldname.
append t_dynpfields.
clear t_dynpfields.
Read the value in the Country field on the screen
call function 'DYNP_VALUES_READ'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
translate_to_upper = 'X'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
read table t_dynpfields with key fieldname = 'V_LAND1'.
if not t_dynpfields-FIELDVALUE is initial.
r_land1-low = t_dynpfields-FIELDVALUE.
r_land1-sign = 'I'.
r_land1-option = 'EQ'.
append r_land1.
clear r_land1.
endif.
Get the Regions to be displayed as F4 Help
select land1
bland
bezei
from t005u
into table t_t005u
where spras = 'EN'
and land1 in r_land1.
if not t_t005u[] is initial..
Popup to display Valid Regions for the selected country
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 60
ENDPOS_ROW = 40
STARTPOS_COL = 40
STARTPOS_ROW = 20
TITLETEXT = 'Region'
IMPORTING
CHOISE = v_choice
TABLES
VALUETAB = t_t005u
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
if sy-subrc = 0.
if v_activity = 'V'.
read table t_t005u index v_choice.
if sy-subrc = 0.
v_regio = t_t005u-bland.
move 'V_BEZEI' to t_dynpfields-fieldname.
move t_t005u-bezei to t_dynpfields-fieldvalue.
append t_dynpfields.
Update the Region description on the screen.
call function 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
endif.
endif.
endif.
endif.
ENDMODULE. " region_value_help INPUT
Regards,
ravi
‎2006 Oct 03 2:21 PM
hi Jacob,
Write your Logic in <b>AT SELECTION-SCREEN OUTPUT</b>.
Regards,
Santosh
‎2006 Oct 03 2:22 PM
parameters: p_bukrs type anla-bukrs,
p_anln1 type anla-anln1,
p_anln2 type anla-anln2.
Check in the selection-screen. once u say F4 for BUKRS then select the next field ..it will give the search help with the selected bukrs. It means its giving the values which comes under the same bukrs.
Pls mark all helpful answers. Thanks
Eswar
‎2006 Oct 03 2:33 PM
Hi, on the screen painter I get this field from the data dictionary. this fields not on a selection screen, they are on a screen which I called with call screen.
‎2006 Oct 03 2:37 PM
Hi jakob,
1. In the screen painter,
if these fields are painted from the ANLA table itself,
2. then automatically such fileration
will happen.
regards,
amit m.
‎2006 Oct 03 2:39 PM
Hi,
you can use logic to similar to below.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ITAB-FIELD1'.
SCREEN-ACTIVE = 0. "Doesn' Display in the screen
ELSE.
SCREEN-ACTIVE = 1. "Display in the screen
ENDIF.
ENDLOOP.
Write the logice similar to above in PBO based on the OKCODE.
Thanks,
Ramakrishna
‎2006 Oct 03 2:41 PM
Jakob,
Get the fields from the DATA DICTIONARY option in the screen(modulepool)..then program will automatically to the validation.
Thnaks
'Eswar
‎2006 Oct 03 2:38 PM
hi,,
try this..
DATA : int_dselc LIKE TABLE OF dselc WITH HEADER LINE.
DATA : BEGIN OF int_ref_tab OCCURS 10,
BUKRS LIKE ANLA-BUKRS,
ANLN1 LIKE ANLA-ANLN1,
ANLN2 LIKE ANLA-ANLN2,
END OF int_ref_tab.
SELECT BUKRS ANLN1 ANLN2
FROM ANLA
INTO TABLE int_ref_tab.
int_dselc-fldname = 'F0002'.
int_dselc-dyfldname = 'SCREEN-ANLN1'.
APPEND int_dselc.
int_dselc-fldname = 'F0003'.
int_dselc-dyfldname = 'SCREEN-ANLN2'.
APPEND int_dselc.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BUKRS'
dynpprog = 'PROGRAM NAME'
dynpnr = sy-dynnr
dynprofield = 'SCREEN-BUKRSNAME'
value_org = 'S'
TABLES
value_tab = int_ref_tab
dynpfld_mapping = int_dselc
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.
<b>GIVE POINTS IF HELPFUL</b>
‎2006 Oct 03 2:46 PM
Hello the problem is that I want to see all the anla1, not only that ones which I had created. Is it a question of authorization?
‎2006 Oct 03 2:52 PM
Jakob
You will be able to see all the alna1,ther is no question of authorisation...
Regards,
Ajith