Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SELECTION

Former Member
0 Likes
1,087

HI GURU'S.

i want validate selection screen like this.

i have one parameter related to company code , it accepts every value from table t001. and i have select-options for sales organisation. it accepts values from table TVKOV which r related to company code which we provided aboue otherwise it display error that 'check the sals organisation'.

how can i do this.

thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,053

hi

use ur code like this

what ever condition u want put in where condition

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.

  • IF S_OBJID IS NOT INITIAL.

SELECT OTYPE OBJID FROM HRP1000

INTO TABLE IT_OBJID_SH

WHERE OTYPE = 'D'.

IF SY-SUBRC EQ 0.

  • SEARCH HELP FOR QUALIFICATION.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'OBJID'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'S_OBJID'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = IT_OBJID_SH

  • FIELD_TAB =

  • RETURN_TAB = RETURN_TAB

  • DYNPFLD_MAPPING =

  • 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.

ENDIF.

reward if usefull

8 REPLIES 8
Read only

Former Member
0 Likes
1,053

u can validate the selection screen fields using AT SELECTION-SCREEN ON FIELD event.write the logic for ur requirement in htis event.

Read only

0 Likes
1,053

Hi,

Wat you can do is,

In this event.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field>

You use . DYNP_VALUES_READ to read the value on screen.

afer that select that data on the basis of data you get from screen.

then call FM.F4IF_INT_TABLE_VALUE_REQUEST.

it will work then.

Hope you got it now.

Regards

Azad.

Reward if helpful.

Read only

Former Member
0 Likes
1,053

hi,

AT SELECTION-SCREEN.

DATA l_bukrs TYPE t001-bukrs.

SELECT SINGLE bukrs

INTO l_bukrs

FROM t001

WHERE bukrs = p_bukrs.

IF sy-subrc <> 0.

write:/invalid.

endif.

AT SELECTION-SCREEN.

DATA l_vkorg TYPE tvko-vkorg.

SELECT SINGLE vkorg

INTO l_vkorg

FROM tvko

WHERE vkorg IN s_vkorg.

IF sy-subrc <> 0.

write:/invalid.

endif.

Reward if helpful.

Read only

Former Member
0 Likes
1,053

Hi Surendra,

Use a join on the two fields in the event.

AT SELECTION-SCREEN.

select single a~VKORG

b~BURKS

from TKVOV as a

JOIN T001 as b

on a(field) = b(field)

into table i_tab

where vkorg in s_code

and burks = p_burks.

IF sy-sybrc <> 0.

Message 'check the sals organisation'.

endif.

Rewards points if helpful

regards

Sourabh Verma

Read only

Former Member
0 Likes
1,053

Hi Raju

chk this one

parameter: p_code like t001-bukrs.

select-options: s_vkork for tvkov-vkorg.

at selection-screen.

select single bukrs from t001 where bukrs eq p_code.

if sy-subrc ne 0.

raise error.

endif.

AT SELECTION SCREEN ON VALUE REQUEST FOR S_VKORG.

SELECT VKORG FROM TVKOV INTO TABLE IT_VKORG WHERE BUKRS EQ P_CODE.

reward if it is helpful.

kiran.M

Message was edited by:

KIRAN KUMAR

Read only

Former Member
0 Likes
1,053

You can do coding like this.

DATA : I_TVOK LIKE TVOK OCCURS 100 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK B_1 WITH FRAME TITLE TEXT-010.

PARAMETERS : V_BUKRS LIKE T001-BUKRS. "company code

SELECT-OPTIONS : V_VKORG FOR TVOK-VKORG. " Sales org

SELECTION-SCREEN END OF BLOCK B_1.

Instead of table TVKOV use TVOK which has sales organization and BUKRS both.

at selection screen.

SELECT * into I_TVOK

FROM TVKO

WHERE VKORG IN V_VKORG

AND BUKRS = V_BUKRS.

endselect.

if sy-subrc ne 0.

message 'check the sales organization' TYPE 'E'.

endif.

Hope this will help you.

anu

Read only

Former Member
0 Likes
1,053

Hi,

Try This.

Hope it will help u.

TABLES: vbak.

TYPES : BEGIN OF ty_vbak,

vkorg TYPE vbak-vkorg,

END OF ty_vbak.

DATA : dyfields LIKE dynpread OCCURS 1 WITH HEADER LINE ,

i_vbak TYPE TABLE OF ty_vbak WITH HEADER LINE .

DATA: BEGIN OF value_tab OCCURS 0,

vkorg LIKE vbak-vkorg,

END OF value_tab.

DATA :field_tab LIKE dfies OCCURS 0 WITH HEADER LINE.

DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

PARAMETERS :kunnr TYPE vbak-kunnr .

SELECT-OPTIONS:vkorg FOR vbak-vkorg.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR vkorg-low.

CHECK NOT kunnr IS INITIAL .

CLEAR: dyfields[], dyfields.

dyfields-fieldname = 'KUNNR'.

APPEND dyfields.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = dyfields.

READ TABLE dyfields INDEX 1.

SELECT vkorg

INTO TABLE i_vbak

FROM vbak

WHERE kunnr EQ kunnr. "'0000022670'. "dyfields-fieldvalue.

SORT i_vbak BY vkorg.

DELETE ADJACENT DUPLICATES FROM i_vbak.

REFRESH value_tab[].

REFRESH field_tab[].

REFRESH return_tab[].

field_tab-fieldname = 'VKORG'.

field_tab-tabname = 'VBAK'.

APPEND field_tab.

LOOP AT i_vbak .

value_tab-vkorg = i_vbak-vkorg.

APPEND value_tab.

ENDLOOP.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = field_tab-fieldname

TABLES

value_tab = value_tab

field_tab = field_tab

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc = 0.

vkorg = return_tab-fieldval.

ENDIF.

Make same for vkorg-high.

Read only

Former Member
0 Likes
1,054

hi

use ur code like this

what ever condition u want put in where condition

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.

  • IF S_OBJID IS NOT INITIAL.

SELECT OTYPE OBJID FROM HRP1000

INTO TABLE IT_OBJID_SH

WHERE OTYPE = 'D'.

IF SY-SUBRC EQ 0.

  • SEARCH HELP FOR QUALIFICATION.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'OBJID'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'S_OBJID'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = IT_OBJID_SH

  • FIELD_TAB =

  • RETURN_TAB = RETURN_TAB

  • DYNPFLD_MAPPING =

  • 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.

ENDIF.

reward if usefull