‎2006 Feb 20 1:39 PM
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.
‎2006 Feb 20 1:54 PM
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.
‎2006 Feb 20 2:05 PM
Hi Rahul,
i think Abhijit is right.
Also consider that xvbap is an internal table. Maybe a read table is needed.
Regards, Manuel
‎2006 Feb 20 2:16 PM
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