Application Development 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: 

price w.r.t to condition types

kiran_k8
Active Contributor
0 Kudos

Hi Folks,

I have a problem in picking up the price depending on the condition type.I am gettin only one condition type's price for all.I think it is a problem with the select and endselect statement,can anyone here please let me know where I am going wrong.

x Amount.

*Accounting Doc.No.

SELECT BELNR

AWKEY

FROM bkpf INTO TABLE ITAB3

WHERE blart = 'RE' AND

GJAHR = P_GJAHR AND

BUKRS = P_BUKRS AND

BUDAT IN S_BUDAT.

*Excise Duty and Ed.Cess.

clear itab3.

LOOP AT ITAB3.

move-corresponding itab3 to itab4.

SELECT HWBAS

HWSTE

KBETR

FROM BSET INTO (ITAB4-HWBAS , ITAB4-hwste_x , ITAB4-KBETR)

WHERE BELNR = ITab3-BELNR1 AND

GJAHR = P_GJAHR AND

BUKRS = P_BUKRS and

KSCHL = 'JMO1'.

IF ITAB4-HWSTE_X IS INITIAL.

SELECT SINGLE

HWBAS

HWSTE

KBETR

FROM BSET INTO (ITAB4-HWBAS , ITAB4-HWSTE_X , ITAB4-KBETR)

WHERE BELNR = ITab3-BELNR1 AND

BUKRS = P_BUKRS AND

GJAHR = P_GJAHR AND

KSCHL = 'JMO2'.

*ENDSELECT.

ENDIF.

<b>upto here it is fine,but the moment it is reaching the below select statement the price of JM01 or JM02 is getting overwritten by JEC1 or JEC2.</b>

SELECT SINGLE

HWSTE

KBETR

FROM BSET INTO (ITAB4-HWSTE_Y , ITAB4-KBETR)

WHERE BELNR = ITAB3-BELNR1 AND

GJAHR = P_GJAHR AND

BUKRS = P_BUKRS AND

KSCHL = 'JEC1'.

IF ITAB4-HWSTE_Y IS INITIAL.

SELECT SINGLE

HWSTE

kbetr

FROM BSET INTO (ITAB4-HWSTE_Y, itab4-kbetr)

WHERE BELNR = ITAB3-BELNR1 AND

GJAHR = P_GJAHR AND

BUKRS = P_BUKRS AND

KSCHL = 'JEC2'.

ENDIF.

*ITAB4-HWSTE_Z = ( ITAB4-HWSTE_Y / 3 ) * 2.

*ITAB4-HWSTE_F = ITAB4-HWSTE_Y - ITAB4-HWSTE_Z.

*ITAB4-HWSTE_L = LHWSTEX.

APPEND ITAB4.

ENDSELECT.

*ENDSELECT.

ENDLOOP.

Thanks,

K.Kiran,

2 REPLIES 2

Former Member
0 Kudos

Hi Kiran

Use separate KBETR1, kbetr2,kbtr3 and kbtr4 fields in ITAB4 for different condition types and fetch the data

since you are useing the select single and into the same KBETR it is over writing the value

Regards

Anji

Message was edited by:

Anji Reddy Vangala

Former Member
0 Kudos

Hi Kiran,

BKPF is header table.

Since the a/c document no is single entry, u r using select single statement into bset table where several lines are there for same a/c documents for different condition type like JM01, JM02, JEC1, JEC2, JIP5,JIP6,JiP9 etc.

So in that case u declare an another internal table & use

Select belnr hwbas **** **** **** kschl from bset

into it_bset

for all entries in it_bset

where belnr = it_bkpf-belnr

and ......................

then u get the all tax amt separately.

Rewrd pts if it is helpfull.

Regards

Srimanta