‎2007 Aug 08 10:55 AM
HI GURU'S.
i want validate selection screen that aloows all values of company codes from table t001.and also .In F4 functionality, List out all the entries in the table TVKO-VKORG by passing above company code value as parameter.
It should validate the entry if the user inputs the value manually.
System should throw error message if entered value is not in the table TVKO.
how can i achive it.
help me.
thanks in advance.
‎2007 Aug 08 11:06 AM
Hi
TABLES: T001, TVKO.
DATA: T_T001 TYPE STANDARD TABLE OF T001,
T_TVKO TYPE STANDARD TABLE OF TVKO.
SELECT-OPTIONS: SO_BUKRS FOR T001-BUKRS,
SO_VKORG FOR TVKO-VKORG.
AT SELECTION-SCREEN.
SELECT * FROM T001 INTO TABLE T_T001 WHERE BUKRS IN SO_BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E208(00) WITH 'No company code'.
ENDIF.
SELECT * FROM TVKO INTO TABLE T_TVKO
FOR ALL ENTRIES IN T_T001
WHERE VKORG IN SO_VKORG
AND BUKRS = T_T001-BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E208(00) WITH 'No orgonization'.
ENDIF.
LOOP AT T_T001 INTO T_T001.
READ TABLE T_TVKO WITH KEY BUKRS = T_T001-BUKRS
TRANSPORTING NO FIELDS.
IF SY-SUBRC <> 0.
DELETE T_T001.
ENDIF.
ENDLOOP.Max
‎2007 Aug 08 10:58 AM
Hi Surendra,
Use AT SELECTION-SCREEN ON VALUE-REQUEST FOR field.
Within the event, select the data from TVKO by passing the company code and assign the value to the field.
Regards,
Yogesh
‎2007 Aug 08 11:01 AM
‎2007 Aug 08 11:04 AM
select-option: s_code for t001-bukrs.
at selection-screen.
select single bukrs from t001 where bukrs in s_code.
if sy-subrc ne 0.
message e000(z00) ' not a valid company code'.
endif.
Reward points if it is helpful.
kiran.M
‎2007 Aug 08 11:06 AM
Hi
TABLES: T001, TVKO.
DATA: T_T001 TYPE STANDARD TABLE OF T001,
T_TVKO TYPE STANDARD TABLE OF TVKO.
SELECT-OPTIONS: SO_BUKRS FOR T001-BUKRS,
SO_VKORG FOR TVKO-VKORG.
AT SELECTION-SCREEN.
SELECT * FROM T001 INTO TABLE T_T001 WHERE BUKRS IN SO_BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E208(00) WITH 'No company code'.
ENDIF.
SELECT * FROM TVKO INTO TABLE T_TVKO
FOR ALL ENTRIES IN T_T001
WHERE VKORG IN SO_VKORG
AND BUKRS = T_T001-BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E208(00) WITH 'No orgonization'.
ENDIF.
LOOP AT T_T001 INTO T_T001.
READ TABLE T_TVKO WITH KEY BUKRS = T_T001-BUKRS
TRANSPORTING NO FIELDS.
IF SY-SUBRC <> 0.
DELETE T_T001.
ENDIF.
ENDLOOP.Max