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

pricing routine error in code

rahulab
Participant
0 Likes
518

hello all..

can u check this code?

this is a routine for calculating condition value.

the error is at itab-matnr = xvbap-matnr " material no.

i m trying to catch material no while creating sales order,

depending on that i get the gold weight, which i use to calculate price through the function module.

thanks in advance.

  • Routine to Calculate Kitco Price.

**************************************************************************

data: kitrate type KONP-KBETR,

goldcts type MARA-LABOR,

finalwt type MARA-NTGEW,

final_value type konp-kbetr.

data: begin of itab occurs 0,

kbetr like xkomv-kbetr,

kunnr like xkomv-kunnr,

matnr like mara-matnr,

labor like mara-labor,

ntgew like mara-ntgew,

end of itab.

itab-kbetr = xkomv-kbetr.

itab-matnr = xvbap-matnr. " material no.

append itab.

loop at itab.

select single labor ntgew from mara into itab-labor itab-ntgew where matnr = itab-matnr.

modify itab.

endloop.

loop at itab.

kitrate = itab-kbert.

goldcts = itab-labor.

finalwt = itab-ntgew.

endloop.

CALL FUNCTION 'ZKITCO_FORMULA'

EXPORTING

KITRATE = kitrate

GOLDCTS = goldcts

FINALWT = finalwt

IMPORTING

CONDITION_VALUE = final_value

EXCEPTIONS

EXCEPTION1 = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • asssign final_value to the required field. for output.

xkwert = final_value.

endform.

3 REPLIES 3
Read only

Former Member
0 Likes
480

Are u sure that the data is available in xvbap or vbap. What u could do is set break point in this routine and in debug mode check in call stack which is the parent routine which has called in this form routine and check for the required field.

Read only

0 Likes
480

Hi Rahul,

i think Abhijit is right.

Also consider that xvbap is an internal table. Maybe a read table is needed.

Regards, Manuel

Read only

Former Member
0 Likes
480

Hi,

Check data type of xvbap-matnr and itan-matnr.

It should work.

Could you pls. mention the structure of xvbap.

Thanks & Regards,

Venkat Ramanan