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

Former Member
0 Likes
387

hi experts,

plz suggest me code for the below given description.

when i write inner join on KONV it is showing error

could u plz suggest.

Contract (PRICE_DESC):

1. Select the document condition (VBRK-KNUMV)

2. Select all records from KONV where document condition in billing document (VBRK-KNUMV) is equal to document condition (KONV-KNUMV) AND where billing document line (VBRP-POSNR) is equal to document condition line (KONV-KPOSN) AND where the condition type (KONV-KSCHA) is equal to ‘ZPR0.’

3. If the access (KONV-KOLNR) is equal to ’40,’ then map the attribute 6 value (KNA1-KATR6) for the Sold-to (KNA1-KUNNR) that is equal to the Sold-to on the billing document (VBRK-KUNAG).

4. Else, map blank value to field.

regards,

siri.

1 REPLY 1
Read only

Former Member
0 Likes
334

Hi

KONV is a cluster table and you can't use this kind of table in a join.

So you should select the data of VBRK and VBRP you need by a join and after get data from KONV separatly.

DATA: BEGIN OF T_BILL OCCURS 0,

VBELN TYPE VBELN,

KNUMV TYPE KNUMV,

KUNAG TYPE KUNAG,

POSNR TYPE POSNR,

KATR6 TYPE KATR6,

END OF T_BILL.

DATA: T_KONV TYPE STANDARD TABLE OF KONV WITH HEADER LINE.

SELECT AVBELN AKNUMV AKUNAG BPOSNR

FROM VBRK AS A INNER JOIN VBRP AS B

ON AVBELN = BVBELN

INTO TABLE T_BILL

WHERE A~VBELN IN SO_VBELN.

IF SY-SUBRC = 0.

SELECT * FROM KONV INTO TABLE T_KONV

FOR ALL ENTRIES IN T_BILL

WHERE KNUMV = T_BILL-KNUMV

AND KPOSN = T_BILL-POSNR

AND KSCHL = 'ZPRO'.

ENDIF.

If the access (KONV-KOLNR) is equal to ’40,’ then map the attribute 6 value (KNA1-KATR6) for the Sold-to (KNA1-KUNNR) that is equal to the Sold-to on the billing document (VBRK-KUNAG).

LOOP AT T_KONV WHERE KOLNR = '40'.

READ TAVLE T_BILL WITH KEY KNUMV = T_KONV-KNUMV

POSMR = T_KONV-KPOSN.

IF SY-SUBRC = 0.

SELECT KATR6 INTO T_BILL-KATR6 FROM KNA1

WHERE KUNNR = T_BILL-KUNAG.

MODIFY T_BILL INDEX SY-TABIX.

ENDIF.

ENDLOOP.

MAX