i m able to connect through sap but can not map the data as same as in bapi parameter
bapi reaired parameter is
BAPI Name : Y_BAPI_VALIDATE_LEAVE
Import parameters :
Parameter name Data type length
EMPLOYEENUMBER Number 8
START_DATE Date 8 (Format YYYYMMDD)
START_FULL_DAY Char 1 (1 for full day and blank for half day)
END_DATE Date 8 (Format YYYYMMDD)
END_FULL_DAY Char 1 (1 for full day and blank for half day)
LEAVE_TYPE Number 4
Export parameters :
Parameter name Data type length
LEAVE_DAYS Number 8 (will not give any data at this point of time)
OK_TAG Char 1 (‘Y’ for successful validation, ‘N’ for error)
TEXTLINE Char 255 (User message)
and my code is
Sub Initialize
On Error Goto errorhandler
Dim session As New lcsession
Dim target As New LCConnection("sap")
target.Database = "Y_BAPI_VALIDATE_LEAVE"
'Here is the BAPI that we want to access.
target.Userid = "P00149513"
target.Password = "RUPANTAR"
target.Client="120"
target.Destination="RQA.TATASTEEL.COM"
target.SystemNo=00
target.Language="EN"
target.Server="133.0.1.85"
target.Connect
'If this line executes without error, then we are successfully logged in to the
'SAP system.
Dim fldLst As New LCFieldList
Dim fldresult As New LCFieldList
Dim field As LCField
Dim number As New LCNumeric
target.Metadata = "*"
number.text = "00149513"
Set field = fldLst.Append("EMPLOYEENUMBER",LCTYPE_NUMERIC)
Call field.setnumeric (1, number)
'Dim flddate As New LCDatetime (2006,11,04)
Dim flddate As New LCDatetime (2006,11,04)
Set field = fldLst.Append("START_DATE", LCTYPE_DATETIME)
Call field.setdatetime (1, temp)
Set field = fldLst.Append("START_FULL_DAY",LCTYPE_TEXT)
field.text = "1"
Dim flddate1 As New LCDatetime (2006,11,20)
Set field = fldLst.Append("END_DATE", LCTYPE_DATETIME)
Call field.setdatetime (1, flddate1)
Set field = fldLst.Append("END_FULL_DAY", LCTYPE_TEXT)
field.text = "1"
number.text = "0052"
Set field = fldLst.Append("LEAVE_TYPE",LCTYPE_NUMERIC)
Call field.setnumeric (1, number)
Dim count, counter2 As Integer
target.MapByName = True
count = target.call(fldLst, 1, fldresult)
Dim index As Long
Call target.Fetch (fldresult, 1, 1)
Set field = fldresult.lookup("OK_TAG", index)
If field.text(0) <> ""Then
Print "OK_TAG = " & field.text (0)
End If
Set field = fldresult.lookup("TEXTLINE", index)
If field.text(0) <> "" Then
Print "TEXTLINE= " & field.text (0)
End If
Exit Sub
errorhandler:
Dim Msg As String
Dim Msgcode As Long
Dim status As Integer
Dim result As String
If session.status <> LCSUCCESS Then
status = session.GetStatus(result, Msgcode, Msg)
End If
Msgbox result
End Sub
here error message come ,i thing it becase of
i can not convert data in yyyymmdd formate
and also number 0052 is converted to 52 so no maping there
plz help me and give Guide line for that its very argent plz help me…
thanks friends