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

COMPANY CODE

Former Member
0 Likes
772

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
668

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

4 REPLIES 4
Read only

Former Member
0 Likes
668

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

Read only

Former Member
0 Likes
668

use AT SELECTION-SCREEN event for validation.

Sameer

Read only

Former Member
0 Likes
668

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

Read only

Former Member
0 Likes
669

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