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

select without key fields

Former Member
0 Likes
997

Hi,

I have a question, How to select documents when we dont have key fields in the selection

Sales orders

eg If we have 3 fields Material , Customer and Sales Org, which are not key fields in table VBAK, What is the best approach to select Sales Documents based on these 3 fields.

please let me know

Thanks

1 ACCEPTED SOLUTION
Read only

venkata_ramisetti
Active Contributor
0 Likes
675

Hi

Use logic like below.

SELECT vbakVBELN vbakVKORG vbapMATNR vbakKUNNR

INTO TABLE T_VBAK

FROM VBAK INNER JOIN VBAP

ON VBAKVBELN = VBAPVBELN

WHERE VBAK~VKROG IN S_VKORG AND

VBAP~MATNR IN S_MATNR AND

VBAK~KUNNR IN S_KUNNR.

Thanks

Ramakrishna

Message was edited by:

Ramakrishna Ramisetti

3 REPLIES 3
Read only

venkata_ramisetti
Active Contributor
0 Likes
676

Hi

Use logic like below.

SELECT vbakVBELN vbakVKORG vbapMATNR vbakKUNNR

INTO TABLE T_VBAK

FROM VBAK INNER JOIN VBAP

ON VBAKVBELN = VBAPVBELN

WHERE VBAK~VKROG IN S_VKORG AND

VBAP~MATNR IN S_MATNR AND

VBAK~KUNNR IN S_KUNNR.

Thanks

Ramakrishna

Message was edited by:

Ramakrishna Ramisetti

Read only

Former Member
0 Likes
675

Hi

Providing FIELDS in the WHERE condition normally makes sure that you make a limited and required selection. Even though the fields Material , Customer and Sales Org are not key fields in VBAK, placing then in the where condition of the select query will definitely help.

Hope this clarifies.

Regards

Kathirvel

Read only

Former Member
0 Likes
675

Hi,

Use the table VAPMA...

SELECT MATNR VKORG KUNNR

INTO TABLE T_VAPMA

FROM VAPMA

WHERE MATNR = '1212'

AND VKORG = '0100'

AND KUNNR = '212'.

Thanks,

Naren