What's the Problem in my code ?

Hey,
I am interfacing PCI card (IK220) with VBNet using its library.There is one demo application of visual basic 6 for it and i am converting that code in VBnet.the problem is when i debug my .net code step by step it is observed the for Ax=1 <Form load event
For loop>it is showing IKCard(Ax) as 0 whereas when i debug Visual basic 6 code step by step it is showing some values foe Ax=1 in the for loop.
So please suggest me what i am doing wrong in my code.
'----------VB.Net Code -------------------------
Imports System.Runtime.InteropServices
Public Class Form1
Public SignalPeriode(8) As Double
Public IKCard(16) As UInteger
Public S As Boolean
Public Ax As Integer
Public SignalType(8) As Integer
Public EncoderType(8) As Integer
Public OldSta(7) As Long
Public Declare Function IK220Find Lib "IK220DLL.DLL" (ByRef pBuffer16 As Long) As Boolean
Public Declare Function IK220Find256 Lib "IK220DLL.DLL" (ByRef pBuffer256 As Long) As Boolean
Public Declare Function IK220Init Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220Version Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pVersCard As Byte, ByRef pVersDrv As Byte, ByRef pVersDll As Byte) As Boolean
Public Declare Function IK220Reset Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220Start Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220Stop Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220ClearErr Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220Latch Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer) As Boolean
Public Declare Function IK220LatchInt Lib "IK220DLL.DLL" (ByVal Card As Integer) As Boolean
Public Declare Function IK220LatchExt Lib "IK220DLL.DLL" (ByVal Card As Integer) As Boolean
Public Declare Function IK220ResetRef Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220StartRef Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220StopRef Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220LatchRef Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220Latched Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pStatus As Boolean) As Boolean
Public Declare Function IK220WaitLatch Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer) As Boolean
Public Declare Function IK220SetTimeOut Lib "IK220DLL.DLL" (ByVal TimOut As Long) As Boolean
Public Declare Function IK220Set Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal SetVal As Double) As Boolean
Public Declare Function IK220SetPreset Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal PresVal As Double) As Boolean
Public Declare Function IK220GetPreset Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pPresVal As Double) As Boolean
Public Declare Function IK220Read32 Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pData As Long) As Boolean
Public Declare Function IK220Read48 Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pData As Double) As Boolean
Public Declare Function IK220Get32 Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pData As Long) As Boolean
Public Declare Function IK220Get48 Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pData As Double) As Boolean
Public Declare Function IK220CntStatus Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pRefSta As Integer, ByRef pKorr00 As Integer, ByRef pKorr90 As Integer, ByRef pNKorr00 As Integer, ByRef pNKorr90 As Integer, ByRef pSamCnt As Integer) As Boolean
Public Declare Function IK220DoRef Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220CancelRef Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220RefActive Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Boolean) As Boolean
Public Declare Function IK220WaitRef Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220PositionRef Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pData As Double, ByRef pPeriod As Long, ByRef pIntpol As Integer) As Boolean
Public Declare Function IK220PositionRef2 Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pData1 As Double, ByRef pPeriod1 As Long, ByRef pIntpol1 As Integer, ByRef pData2 As Double, ByRef pPeriod2 As Long, ByRef pIntpol2 As Integer) As Boolean
Public Declare Function IK220Status Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pData As Long) As Boolean
Public Declare Function IK220DllStatus Lib "IK220DLL.DLL" (ByRef pStatus As Long, ByRef pInfo As Long) As Boolean
Public Declare Function IK220RefStatus Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pRef1 As Long, ByRef pRef2 As Long, ByRef pDiff As Long, ByRef pCode As Integer, ByRef pFlag As Integer) As Boolean
Public Declare Function IK220SignalStatus Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pFreq As Integer, ByRef pAmin As Integer, ByRef pAact As Integer, ByRef pAmax As Integer) As Boolean
Public Declare Function IK220GetCorrA Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pOfs0 As Integer, ByRef pOfs90 As Integer, ByRef pPha0 As Integer, ByRef pPha90 As Integer, ByRef pSym0 As Integer, ByRef pSym90 As Integer, ByRef pFlag1 As Integer, ByRef pFlag2 As Integer) As Boolean
Public Declare Function IK220GetCorrB Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pOfs0 As Integer, ByRef pOfs90 As Integer, ByRef pPha0 As Integer, ByRef pPha90 As Integer, ByRef pSym0 As Integer, ByRef pSym90 As Integer, ByRef pFlag1 As Integer, ByRef pFlag2 As Integer) As Boolean
Public Declare Function IK220LoadCorrA Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Ofs0 As Integer, ByVal Ofs90 As Integer, ByVal Pha0 As Integer, ByVal Pha90 As Integer, ByVal Sym0 As Integer, ByVal Sym90 As Integer) As Boolean
Public Declare Function IK220OctStatus Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pOct0 As Integer, ByRef pOct1 As Integer, ByRef pOct2 As Integer, ByRef pOct3 As Integer, ByRef pOct4 As Integer, ByRef pOct5 As Integer, ByRef pOct6 As Integer, ByRef pOct7 As Integer, ByRef pSamCnt As String) As Boolean
Public Declare Function IK220ChkSumPar Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pChkSum As Integer) As Boolean
Public Declare Function IK220ChkSumPrg Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pChkSum1 As Integer, ByRef pChkSum2 As Integer) As Boolean
Public Declare Function IK220WritePar Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal ParNum As Integer, ByVal ParVal As Integer) As Boolean
Public Declare Function IK220ReadPar Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal ParNum As Integer, ByRef pParVal As Integer) As Boolean
Public Declare Function IK220ResetEn Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220ConfigEn Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Integer, ByRef pType As Integer, ByRef pPeriod As Long, ByRef pStep As Long, ByRef pTurns As Integer, ByRef pRefDist As Integer, ByRef pCntDir As Integer) As Boolean
Public Declare Function IK220ReadEn Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Integer, ByRef pData As Double, ByRef pAlarm As Integer) As Boolean
Public Declare Function IK220ReadEnInc Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pStatus As Integer, ByRef pDataEn As Double, ByRef pAlarm As Integer, ByRef pDataInc As Double) As Boolean
Public Declare Function IK220ModeEnCont Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByVal Mode As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220ReadEnIncCont Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Integer, ByRef pDataEn As Double, ByRef pAlarm As Integer, ByRef pDataInc As Double, ByRef pSigSta As Double) As Boolean
Public Declare Function IK220AlarmEn Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Integer, ByRef pAlarm As Integer) As Boolean
Public Declare Function IK220WarnEn Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Integer, ByRef pWarn As Integer) As Boolean
Public Declare Function IK220ReadMemEn Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Range As Integer, ByVal MemAdr As Integer, ByRef pMemData As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220WriteMemEn Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Range As Integer, ByVal MemAdr As Integer, ByRef MemData As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220ReadSSI Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pStatus As Integer, ByRef pData As Double) As Boolean
Public Declare Function IK220ReadSsiInc Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Latch As Integer, ByRef pStatus As Integer, ByRef pDataSsi As Double, ByRef pDataInc As Double) As Boolean
Public Declare Function IK220SetTimer Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal SetVal As Long, ByRef pTimVal As Long) As Boolean
Public Declare Function IK220ModeTimer Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220ModeRam Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220ResetRam Lib "IK220DLL.DLL" (ByVal Axis As Integer) As Boolean
Public Declare Function IK220GetRam Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pData As Double, ByRef pRead As Integer, ByRef pWrite As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220BurstRam Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal maxCount As Integer, ByRef pData As Double, ByRef Count As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220GetSig Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pPeriod As Integer, ByRef pAmp0 As Integer, ByRef pAmp90 As Integer, ByRef pRead As Integer, ByRef pWrite As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220BurstSig Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal maxCount As Integer, ByRef pPeriod As Integer, ByRef pAmp0 As Integer, ByRef pAmp90 As Integer, ByRef Count As Integer, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220Led Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220SysLed Lib "IK220DLL.DLL" (ByVal Card As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220GetPort Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pPortInfo As Integer, ByRef pRising As Integer, ByRef pFalling As Integer) As Boolean
Public Declare Function IK220InputW Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Adr As Integer, ByRef pData As Integer) As Boolean
Public Declare Function IK220InputL Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Adr As Integer, ByRef pData As Long) As Boolean
Public Declare Function IK220Output Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Adr As Integer, ByVal Data As Integer) As Boolean
Public Declare Function IK220RamRead Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Adr As Integer, ByRef pData As Integer) As Boolean
Public Declare Function IK220RamWrite Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Adr As Integer, ByVal Data As Integer) As Boolean
Public Declare Function IK220DownLoad Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pPgmData As Integer, ByVal PgmSize As Long) As Boolean
Public Declare Function IK220SetEnClock Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal State As Boolean, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220SetEnData Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal State As Boolean, ByRef pStatus As Integer) As Boolean
Public Declare Function IK220ReadEnData Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pState As Boolean) As Boolean
Public Declare Function IK220RefEval Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220SetBw Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220SetTrm Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220SetOpMode Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220GetOpMode Lib "IK220DLL.DLL" (ByVal Axis As Integer, ByRef pMode As Integer) As Boolean
Public Declare Function IK220SetLatInt Lib "IK220DLL.DLL" (ByVal Card As Integer, ByVal Mode As Integer) As Boolean
Public Declare Function IK220SetLatExt Lib "IK220DLL.DLL" (ByVal Card As Integer, ByVal Mode As Integer) As Boolean
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim Axis As TextBox() = ControlArrayUtils.getControlArray(Me, "TextBox")
Dim check As CheckBox() = ControlArrayUtils.getControlArray(Me, "CheckBox")
If IK220Find(IKCard(0)) = 0 Then Debug.Print("IK220Find returns error")
For Me.Ax = 0 To 7
SignalPeriode(Ax) = 0.02
If (IKCard(Ax) <> 0) Then
If IK220Init(Ax) = 0 Then Debug.Print("IK220Init returns error")
If (IK220ReadPar(Ax, 1, EncoderType(Ax)) = 0) Then Debug.Print("IK220ReadPar returns error")
If (IK220ReadPar(Ax, 2, SignalType(Ax)) = 0) Then Debug.Print("IK220ReadPar returns error")
check(Ax).Checked = True
End If
Next Ax
End Sub
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Dim Axis As TextBox() = ControlArrayUtils.getControlArray(Me, "TextBox")
Dim Count As Double
Dim EnStatus As Integer
Dim EnAlarm As Integer
For Me.Ax = 0 To 7
If (IKCard(Ax) <> 0) Then
' Read incremental value
If (EncoderType(Ax) = 0) Then
If (IK220Read48(Ax, 0, Count) = 0) Then
Debug.Print("IK220Read48 returns error")
Axis(Ax).Text = " E r r o r"
Else
Count = Count * SignalPeriode(Ax)
Axis(Ax).Text = Format(Count, "0.000000")
End If
End If
' Read EnDat value
If (EncoderType(Ax) = 1) Then
If (IK220ReadEn(Ax, EnStatus, Count, EnAlarm) = 0) Then
Debug.Print("IK220ReadEn returns error")
Axis(Ax).Text = " E r r o r"
Else
Count = Count * SignalPeriode(Ax)
Axis(Ax).Text = Format(Count, "0.000000")
End If
End If
End If
Next Ax
DoStatus()
End Sub
Public Sub DoStatus()
Dim StatusTXT As Label() = ControlArrayUtils.getControlArray(Me, "Label")
Dim Stat As Long
Dim Ax As Integer
Stat = 0
For Ax = 0 To 7
If (IKCard(Ax) <> 0) Then
If IK220Status(Ax, Stat) Then
If OldSta(Ax) <> Stat Then
OldSta(Ax) = Stat
StatusTXT(Ax).Text = ""
If (Stat And &H1) <> 0 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "Latch 0, "
If (Stat And &H2) <> 0 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "Latch 1, "
If (Stat And &H4) <> 0 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "Latch 2 ,"
If (Stat And &H20) <> 0 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "started, " Else StatusTXT(Ax).Text = StatusTXT(Ax).Text + "stopped, "
If (Stat And &H40) <> 0 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "REF function active, "
If (Stat And &H80) <> 0 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "Frequency Error, "
If (Stat And &HC000) = &H0 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "No REF"
If (Stat And &HC000) = &H4000 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "Wait 1. REF"
If (Stat And &HC000) = &H8000 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "Wait 2. REF"
If (Stat And &HC000) = &HC000 Then StatusTXT(Ax).Text = StatusTXT(Ax).Text + "REF"
End If
Else
StatusTXT(Ax).Text = " --- Status Error ---"
Debug.Print("IKStatus returns error")
End If
Else
StatusTXT(Ax).Text = "No IK 220 installed"
End If
Next Ax
End Sub
End Class
'-----------------Visual Basic 6 Code --------------------
Public SignalPeriode(8) As Double
Public IKCard(15) As Long
Public S As Boolean
Public Ax As Integer
Public SignalType(8) As Integer
Public EncoderType(8) As Integer
Private Sub Form_Load()
If IK220Find(IKCard(0)) = 0 Then Debug.Print "IK220Find returns error"
For Ax = 0 To 7
SignalPeriode(Ax) = 0.02
If (IKCard(Ax) <> 0) Then
If IK220Init(Ax) = 0 Then Debug.Print "IK220Init returns error"
If (IK220ReadPar(Ax, 1, EncoderType(Ax)) = 0) Then Debug.Print "IK220ReadPar returns error"
If (IK220ReadPar(Ax, 2, SignalType(Ax)) = 0) Then Debug.Print "IK220ReadPar returns error"
Check(Ax) = 1
End If
Next Ax
End Sub
Private Sub Timer1_Timer()
Dim Count As Double
Dim EnStatus As Integer
Dim EnAlarm As Integer
For Ax = 0 To 7
If (IKCard(Ax) <> 0) Then
' Read incremental value
If (EncoderType(Ax) = 0) Then
If (IK220Read48(Ax, 0, Count) = 0) Then
Debug.Print "IK220Read48 returns error"
Form1.Axis(Ax) = " E r r o r"
Else
Count = Count * SignalPeriode(Ax)
Form1.Axis(Ax) = Format(Count, "0.000000")
End If
End If
' Read EnDat value
If (EncoderType(Ax) = 1) Then
If (IK220ReadEn(Ax, EnStatus, Count, EnAlarm) = 0) Then
Debug.Print "IK220ReadEn returns error"
Form1.Axis(Ax) = " E r r o r"
Else
Count = Count * SignalPeriode(Ax)
Form1.Axis(Ax) = Format(Count, "0.000000")
End If
End If
End If
Next Ax
DoStatus
End Sub
Public OldSta(7) As Long
Public Sub DoStatus()
Dim Stat As Long
Dim Ax As Integer
Stat = 0
For Ax = 0 To 7
If (IKCard(Ax) <> 0) Then
If IK220Status(Ax, Stat) Then
If OldSta(Ax) <> Stat Then
OldSta(Ax) = Stat
Form4.StatusTXT(Ax) = ""
If (Stat And &H1) <> 0 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "Latch 0, "
If (Stat And &H2) <> 0 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "Latch 1, "
If (Stat And &H4) <> 0 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "Latch 2 ,"
If (Stat And &H20) <> 0 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "started, " Else Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "stopped, "
If (Stat And &H40) <> 0 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "REF function active, "
If (Stat And &H80) <> 0 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "Frequency Error, "
If (Stat And &HC000) = &H0 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "No REF"
If (Stat And &HC000) = &H4000 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "Wait 1. REF"
If (Stat And &HC000) = &H8000 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "Wait 2. REF"
If (Stat And &HC000) = &HC000 Then Form4.StatusTXT(Ax) = Form4.StatusTXT(Ax) + "REF"
End If
Else
Form4.StatusTXT(Ax) = " --- Status Error ---"
Debug.Print "IKStatus returns error"
End If
Else
Form4.StatusTXT(Ax) = " --- No IK 220 installed ---"
End If
Next Ax
End Sub
Please Help.Thanks in advance
 

I don't know much about this. But VB6 does not run 64 bit only 32 bit although VB6 apps can run on 64 bit systems they just can't use 64 bit capabilities. Like
Long data type in VB.Net which is 64 bit.
I did find a link to an English copy of the .PDF from Heidenhain for the IK220 PCI counter card which for some reason a NASA Infrared Telescope Facility in Hawaii has a link to on the internet.
NASA Infrared Telescope Facility Hawaii Edu
You can see in the below image the types VB6 uses (VB6 Longs I think are 32 bit which is Integer or UInteger I suppose in VB.Net). Perhaps all you need to do is evaluate the types the VB6 code says to use and alter that so your code equates to the appropriate
data type.
Data Type Summary (Visual Basic)
La vida loca

Similar Messages

  • What's the problem in this code

    import java.lang.reflect.*;
    import java.awt.*;
    class ABC
         public Integer i;
         ABC()
         public void setInt(Integer t)
              i = t;
    public class SampleName {
    public static void main(String[] args)
    ABC g1 = new ABC();
    g1.setInt(new Integer(10));
    printFieldNames(g1);
    static void printFieldNames(Object o) {
    Class c = o.getClass();
    Field[] publicFields = c.getDeclaredFields();
    for (int i = 0; i < publicFields.length; i++)
    try {
    Object ref = publicFields.get(c);
    System.out.println(" ref.toString() : " + ref.toString());
         }catch(Exception e)
                   e.printStackTrace();
    What is the problem with this code,at run time Iam getting this exception
    java.lang.IllegalArgumentException: object is not an instance of declaring class
    How can we get the value of field of an object

    Now it got this exception
    java.lang.IllegalAccessException
    at java.lang.reflect.Field.get(Native Method)That's strange - I didn't! ;-)
    Are you running exactly the same code as the code you posted (except for the one line I said to change)?

  • Please tell me what is the problem with this code

    Hai,
    Iam new to Swings. can any one tell what is the problem with this code. I cant see those controls on the frame. please give me the suggestions.
    I got the frame ,but the controls are not.
    this is the code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ex2 extends JFrame
    JButton b1;
    JLabel l1,l2;
    JPanel p1,p2;
    JTextField tf1;
    JPasswordField tf2;
    public ex2()
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("Another example");
    setSize(500,500);
    setVisible(true);
    b1=new JButton(" ok ");
    p1=new JPanel();
    p1.setLayout(new GridLayout(2,2));
    p2=new JPanel();
    p2.setLayout(new BorderLayout());
    l1=new JLabel("Name :");
    l2=new JLabel("Password:");
    tf1=new JTextField(15);
    tf2=new JPasswordField(15);
    Container con=getContentPane();
    con.add(p1);
    con.add(p2);
    public static void createAndShowGUI()
    ex2.setDefaultLookAndFeelDecorated(true);
    public static void main(String ar[])
    createAndShowGUI();
    new ex2();
    }

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ex2 extends JFrame
        JButton b1;
        JLabel l1,l2;
        JPanel p1,p2;
        JTextField tf1;
        JPasswordField tf2;
        public ex2()
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setTitle("Another example");
            b1=new JButton(" ok ");
            p1=new JPanel();
            p1.add(b1);
            p2=new JPanel();
            p2.setLayout(new GridLayout(2,2));
            l1=new JLabel("Name :");
            l2=new JLabel("Password:");
            tf1=new JTextField(15);
            tf2=new JPasswordField(15);
            p2.add(l1);
            p2.add(tf1);
            p2.add(l2);
            p2.add(tf2);
            Container con=getContentPane();
            con.add(p1, BorderLayout.NORTH);
            con.add(p2, BorderLayout.CENTER);
            pack();
            setVisible(true);
        public static void createAndShowGUI()
            ex2.setDefaultLookAndFeelDecorated(true);
        public static void main(String ar[])
            createAndShowGUI();
            new ex2();
    }

  • Vector, what is the problem with this code?

    Vector, what is the problem with this code?
    63  private java.util.Vector data=new Vector();
    64  Vector aaaaa=new Vector();
    65   data.addElement(aaaaa);
    74  aaaaa.addElement(new String("Mary"));on compiling this code, the error is
    TableDemo.java:65: <identifier> expected
                    data.addElement(aaaaa);
                                   ^
    TableDemo.java:74: <identifier> expected
                    aaaaa.addElement(new String("Mary"));
                                    ^
    TableDemo.java:65: package data does not exist
                    data.addElement(aaaaa);
                        ^
    TableDemo.java:74: package aaaaa does not exist
                    aaaaa.addElement(new String("Mary"));Friends i really got fed up with this code for more than half an hour.could anybody spot the problem?

    I can see many:
    1. i assume your code snip is inside a method. a local variable can not be declare private.
    2. if you didn't import java.util.* on top then you need to prefix package on All occurance of Vector.
    3. String in java are constant and has literal syntax. "Mary" is sufficient in most of the time, unless you purposly want to call new String("Mary") on purpose. Read java.lang.String javadoc.
    Here is a sample that would compile...:
    public class QuickMain {
         public static void main(String[] args) {
              java.util.Vector data=new java.util.Vector();
              java.util.Vector aaaaa=new java.util.Vector();
              data.addElement(aaaaa);
              aaaaa.addElement(new String("Mary"));
    }

  • What is the problem with this code ? Race condition??

    Guys,
    The idea behind the attached code is quite simple.
    I have a 2D parent array. First, I print a subset of this array into a table control (based on a sensor selection). Now, I want edit the numbers in the table. I need the changes to be reflected in the table and the parent 2D array. (In simple terms, this is like replacing the the edited array subset into the parent 2D array)
    The problem is when I change(edit) any entry in the table, the entry changes back to its original value. The change doesnt seem to be reflecting on the parent 2D array and the table. .
    Can anyone tell me where the problem is?
    Thanks
    Ravi
    Solved!
    Go to Solution.
    Attachments:
    Alarm threshold test.vi ‏14 KB

    I agree with Chris, here's an idea (of whatI think your code does):
    The case structure in your code was unnecessary, all the cases were the same so I removed them.
    The sequence structure was unnecessary.
    Ton
    Message Edited by TonP on 11-20-2008 07:52 PM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Alarm threshold test_BD.png ‏19 KB

  • Can any one tell what is the problem in this code?

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.geom.*;
    import java.util.*;
    public class AppletTest2 extends JApplet implements ActionListener,MouseMotionListener,WindowListener{
    JFrame fr = new JFrame("Visual Tool -- Work Flow Editor");
         JPanel panel1 = new JPanel();
         JPanel panel2 = new JPanel();
         JButton sButton = new JButton("Source");
         JButton rButton = new JButton("Redirection");
         JButton dButton = new JButton("Destination");
         JButton connect = new JButton("Connect");
         BasicStroke stroke = new BasicStroke(2.0f);
         int flag = 1 ;
         Vector lines = new Vector();
         JButton sBut,rBut,dBut;
    int x1 = 0 ;
         int y1 = 0 ;
         int x2 = 0 ;
         int y2 = 0;
         int x3 = 0;
         int y3 = 0;
         int i=0;
         int j=0;
         int k=0;
         int l = 100;
    int b = 50;
    public void init(){
              /*********Frame ******************/
    fr.getContentPane().setLayout(new BorderLayout());
         fr.setSize(700,500);
              fr.getContentPane().add(panel1,BorderLayout.CENTER);
              fr.getContentPane().add(panel2,BorderLayout.SOUTH);
              fr.addWindowListener(this);
              /*****************PANEL 1*********************/
              panel1.setLayout(null);
    panel1.setBounds(new Rectangle(0,0,400,400));
              panel1.setBackground(new Color(105,105,205));
    /************************PANEL 2 *************/
              panel2.setLayout(new FlowLayout());
              panel2.setBackground(new Color(105,205,159));
              panel2.add(sButton);
              panel2.add(rButton);
              panel2.add(dButton);
              panel2.add(connect);
              connect.setToolTipText("Use this button after selecting From and To position to connect");
              /***************************LISTENER********************/
    sButton.addActionListener(this);
              rButton.addActionListener(this);
              dButton.addActionListener(this);
              connect.addActionListener(this);
              fr.setVisible(true);     
              fr.setResizable(false);
         } // init clse
    /************************** START METHOD **********************************************/
              public void start(){                                 
                   System.out.println("inside start");
                   paint(panel1.getGraphics());
    /*******************************APPLET METHODS **************************************************/
              public void stop(){}
              public void destroy(){}
    /******************************MOUSE MOTION LISTENERS METHOD*************************************/
              public void mouseMoved(MouseEvent e){System.out.println("moved");}
              public void mouseDragged(MouseEvent e){System.out.println("dragged");}
    /***************************************ACTION EVENT IMPLEMENTAION *******************************/
         public void actionPerformed(ActionEvent e){
              if (e.getSource().equals(sButton)){          
              sourceObject("Source Object");          
              else if (e.getSource().equals(rButton)){          
              redirectionObject("Redirection");
              i = i+1;
              else if (e.getSource().equals(dButton)){
              destinationObject("Destination");
                   j= j+1;
              else if (e.getSource().equals(connect)){
                   System.out.println("am inside connect");                
                   paint(panel1.getGraphics());               
    else if(e.getSource().equals(sBut)){
                   System.out.println("am s button");                
                   x1 = sBut.getX() + l;
                   y1 = sBut.getY() + (b/2);
              else if(e.getSource().equals(rBut)){
                   System.out.println("am r button");               
                   x2 = rBut.getX() ;
                   y2 = rBut.getY()+ b/2;
                   System.out.println("x2 : " + x2 + "y2 :" +y2 );
              else if(e.getSource().equals(dBut)){
                   System.out.println("am d button");                
                   x3 = dBut.getX();
    y3 = dBut.getY()+ b/2;
    } // action close
    /**********************Main **********************************/     
         public static void main(String args[]){
         JApplet at = new AppletTest2();
              at.init();
              at.start();
    /********************my methods starts here *******************/
         public void sourceObject(String name){     
    sBut = new JButton(name);
         panel1.add(sBut);
         sBut.setBounds(new Rectangle(20,208,l,b));     
         sBut.addActionListener(this);
    System.out.println("am inside the source object") ;
         public void redirectionObject(String name){     
         rBut = new JButton(name);
         panel1.add(rBut);
         rBut.setBounds(new Rectangle(290,208,l,b));     
    rBut.addActionListener(this);
    System.out.println("am inside the redirection :" + j) ;
    public void destinationObject(String name){     
         dBut = new JButton(name);
         panel1.add(dBut);     
    System.out.println("am inside the destination object") ;
    if (j == 0)
                   dBut.setBounds(new Rectangle(566,60,l,b));                    
                   System.out.println("am inside the destination:" + j) ;
                   } else if (j == 2)
                        dBut.setBounds(new Rectangle(566,208,l,b));     
                        System.out.println("am inside the destination :" + j) ;
                   } else if (j == 1)
    dBut.setBounds(new Rectangle(566,350,l,b));     
                        System.out.println("am inside the destination :" + j) ;
    dBut.addActionListener(this);
    /* public void connectObject(Object obj1,Object obj2){
    System.out.println("nothing");
    /************************************* PAINT **************************/
    public void paint(Graphics g){
         System.out.println("inside paint");
         Graphics2D g2 = (Graphics2D) g;
         g2.setStroke(stroke);
    if(flag == 1){
    System.out.println("inside flag");
    int np = lines.size();
                        System.out.println(np);
                             for (int I=0; I < np; I++) {                       
         Rectangle p = (Rectangle)lines.elementAt(I);
                             System.out.println("width" + p.width);
                             g2.setColor(Color.red);
                             g2.drawLine(p.x,p.y,p.width,p.height);
                             System.out.println(p.x +"" +""+ p.y + ""+ ""+ p.width+ "" + ""+ p.height);
    flag = -1;
    }else if(flag == -1){
         if(x1 != 0 && y1 != 0 && x2 != 0 && y2 != 0 ){
    // Graphics2D g2 = (Graphics2D) g;
         // g2.setStroke(stroke);
    g2.setColor(Color.red);
         g2.drawLine(x1,y1,x2,y2);
         lines.addElement(new Rectangle(x1,y1,x2,y2));     
         x1 = 0 ;y1 = 0 ;
         x2 = 0 ;y2 = 0 ;
    //     g2.drawLine(100,100,200,200);
    else if (x2 != 0 && y2 != 0 && x3 != 0 && y3 != 0 )
              // Graphics2D g2 = (Graphics2D) g;
                   // g2.setStroke(stroke);
              g2.setColor(Color.green);
                        g2.drawLine(x2,y2,x3,y3);
                        lines.addElement(new Rectangle(x2,y2,x3,y3));
                        x2 = 0; y2 = 0 ;
                        x3 = 0 ; y3 = 0 ;                    
    else if (x1 != 0 && y1 != 0 && x3 != 0 && y3 != 0)
                   //     Graphics2D g2 = (Graphics2D) g;
                   // g2.setStroke(stroke);
                   g2.setColor(Color.red);
                   g2.drawLine(x1,y1,x3,y3);
                        lines.addElement(new Rectangle(x1,y1,x3,y3));                              
                        x1 = 0; y1 = 0 ;
                        x3 = 0 ; y3 = 0 ;                    
    // repaint();
    /********************************WINDOW LISTENER IMPLEMENTATION *****************************/
    public void windowActivated(WindowEvent we) { 
              flag = 1;
              paint(panel1.getGraphics());
    System.out.println("windowActivated -- event 1");
         //start();               
         public void windowClosed(WindowEvent we) {
                                                                System.out.println("windowClosed -- 2");
         public void windowClosing(WindowEvent we){
                                                                System.out.println("windowClosing -- 3");
    public void windowDeactivated(WindowEvent we) {
                                                                     System.out.println("windowDeactivated -- 4");
    public void windowDeiconified(WindowEvent we) {
                                                                     flag = 1;
                                                                     System.out.println("windowDeiconified -- 5");          
                                                                     paint(panel1.getGraphics());           
    public void windowIconified(WindowEvent we) {           
                                                           System.out.println("windowIconified -- 6");
                                                           //paint(panel1.getGraphics());
    public void windowOpened(WindowEvent we) {             
                                                      //     flag = 1;
                                                      //     paint(panel1.getGraphics());
                                                           System.out.println("windowopened -- 7");     
    The problem am facing here is that when i minimize the frame and maximize , my old lines are getting disappared.
    For avoiding that i am storing the old coordinates and
    try to redraw , when maximize.
    but the lines are coming for flash of second and disappearing once again ?
    can any one help?
    thanks all

    Very interestingly the same code is repainting in
    Linux SUSE,jdk1.3.
    but not in WINNT , jdk 1.3
    Any reason ?
    Is the swing 100 % platform independenet ?????
    Does swing also uses native thread ???

  • What is the problem with this code?

    dear sirs...
    i have a page that does not contain any binding, it contains the following event:
    public void onCheck(DataActionContext ctx)
    ViewObject V=ctx.getBindingContext.findDataControl("AppModuleDataControl").getApplicationModule.findViewObject("empview1");
    V.setWhereClause("");
    V.executeQuery();
    V.first();
    note that the above code works if the table emp is on the page, however, if the page is not bound to the page (it does not contains the table) the statement in the bold will fire an exception saying that there is no binding. i am sure the V is not set to null.
    another problem appears, if i put the table and execute it within jdeveloper, it works correctly, however, if i run if i deploy the application into application server, the code never runs as if there is some kind of an error.
    i hope that you can anser me about the following;
    1- if the code above correct?
    2- how can i view the log for the application?
    3- System.out.println("test"); in jdeveloper works okay, in the application server, does it cause some kind of an error?
    thanks for any help & best regards

    If you don't close the ResultSet, different things happen based on which database you're running. You can keep read locks that you don't need. It wastes resources, and as different databases react differently to it, you might have weird bugs down the road that result from your practices of not properly closing ResultSets, PreparedStatements, and Connections. Put this in a loop like you've got here, and the effects may or may not get amplified.
    I write a close() for a ResultSet just as soon as I open it, just to make sure I don't forget. In a situation like this one, I would write something like so:
    for(int i = 0;i<someValue;i++)
    try
    //some code
    rs = pstmt.executeQuery();
    //some code that uses rs
    catch(Exception e)
    finally
      if (rs != null)
        rs.close();
      if (pstmt != null)
        pstmt.close();
    }

  • What is the problem in this code (problem in select query)

    Just need your help in solving one issue. In the below code one query which is highlighted
    Select statement not working means cursor directly goes to the endselect .means these two statements not executed.
    CLASS cl_abap_container_utilities DEFINITION LOAD.
    CALL METHOD cl_abap_container_utilities=>read_container_c
    I am attaching that code with this mail. Please do the needful help.
    *& Report  ZEOU_RG1                                                   *
    REPORT  zeou_rg1 LINE-SIZE 400.
    Purpose : RG1 Report driver
    Remarks :
    constants
    INCLUDE j_2icons.
    type declerations
    INCLUDE j_2isdef.
    table definitions and internal tables
    INCLUDE j_2iddef.
    INCLUDE <icon>.
    DATA: $plant  TYPE bp_addr_typ,
          $lincnt LIKE sy-linct,
          m_date LIKE j_1ipart2-budat,
          m_chapid LIKE j_1iexcdtl-chapid,
          m_matform LIKE j_1irg1-matform,
          m_bedrate LIKE j_1irg1-bedrate,
          tot_op_bal LIKE j_1irg1-menge,
          tot_qty_mnfr LIKE j_1irg1-menge,
          tot_total_qty_mnfr LIKE j_1irg1-menge,
          tot_remv_home LIKE j_1irg1-menge,
          tot_remv_hval LIKE j_1irg1-exbas,
          tot_remv_expr LIKE j_1irg1-menge,
          tot_remv_eval LIKE j_1irg1-exbas,
          tot_remv_expb LIKE j_1irg1-menge,
          tot_remv_othr LIKE j_1irg1-menge,
          tot_remv_opur LIKE j_1irg1-menge,
          tot_duty_amt  LIKE j_1irg1-exbed,
          tot_cb_fr     LIKE j_1irg1-exbed,
          tot_cb_br     LIKE j_1irg1-exbed.
    DATA: t_rg1_cons TYPE rg1_typ OCCURS 0 WITH HEADER LINE.
    FIELD-SYMBOLS: <x_extrctdata> TYPE c,
                   <x_rg1> TYPE rg1_typ,
                   <x_part1typ> TYPE part1_typ.
    DATA : it_j_1iexchdr TYPE j_1iexchdr OCCURS 0 WITH HEADER LINE,
           wa_j_1iexchdr TYPE j_1iexchdr,
           it_j_1iexcdtl TYPE j_1iexcdtl OCCURS 0 WITH HEADER LINE,
           wa_j_1iexcdtl TYPE j_1iexcdtl.
    selection screen
    PARAMETERS: p_exgrp LIKE j_1iexchdr-exgrp OBLIGATORY MEMORY ID j2i,
                p_stdate   LIKE sy-datum OBLIGATORY,
                p_endate   LIKE sy-datum OBLIGATORY.
    *SELECTION-SCREEN SKIP 1.
    *SELECTION-SCREEN BEGIN OF BLOCK 4 WITH FRAME TITLE TEXT-001.
    *SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN POSITION 01.
    *PARAMETERS: P_INDI RADIOBUTTON GROUP 57F4 DEFAULT 'X'.
    *SELECTION-SCREEN COMMENT (25) TEXT-002.
    *SELECTION-SCREEN END OF LINE.
    *SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN POSITION 01.
    *PARAMETERS: P_CONS RADIOBUTTON GROUP 57F4.
    *SELECTION-SCREEN COMMENT (25) TEXT-003.
    *SELECTION-SCREEN END OF LINE.
    *SELECTION-SCREEN END OF BLOCK 4.
    INITIALIZATION.
    AT SELECTION-SCREEN.
      SELECT SINGLE *
      FROM j_1iexgrps
      WHERE j_1iexcgrp = p_exgrp.
      IF sy-subrc NE 0.
        MESSAGE e399(8i) WITH p_exgrp.
      ENDIF.
    *check company code
      SELECT SINGLE *
      FROM t001k
      WHERE bwkey = j_1iexgrps-j_1iwerks.
      IF sy-subrc NE 0.
        MESSAGE e518(8i) WITH 'the' 'plant' j_1iexgrps-j_1iwerks.
      ENDIF.
    <b>START-OF-SELECTION.
      CLEAR: j_1irg1, j_2icomp.
    retrieve layout name and details
    SELECT SINGLE *
    FROM J_2ILAYCTR
    WHERE BUKRS    = T001K-BUKRS
    AND   REGISTER = C_RG1
    AND   LAYOUTNR = 1.
    IF SY-SUBRC NE 0.
       MESSAGE E635(8I) WITH T001K-BUKRS C_RG1.
    ENDIF.
    SET COUNTRY 'IN'.
      REFRESH t_reciepts.
    report driver logic
      SELECT *
      FROM j_2iextrct
      WHERE exgrp  = p_exgrp
      AND budat   >= p_stdate
      AND budat   <= p_endate
      AND register = c_rg1
      ORDER BY budat keyid.
       assign J_2IEXTRCT-EXTRCTDATA to <x_extrctdata> casting.
       assign T_RG1 to <x_rg1> casting.
       <x_rg1> = <x_extrctdata>.
        CLASS cl_abap_container_utilities DEFINITION LOAD.
        CALL METHOD cl_abap_container_utilities=>read_container_c
          EXPORTING
            im_container           = j_2iextrct-extrctdata
          IMPORTING
            ex_value               = t_rg1
          EXCEPTIONS
            illegal_parameter_type = 1
            OTHERS                 = 2.
       MOVE J_2IEXTRCT-EXTRCTDATA TO T_RG1.
        APPEND t_rg1.
      ENDSELECT.
      DESCRIBE TABLE t_rg1 LINES $lincnt.
      IF $lincnt = 0.
        MESSAGE e548(8i) WITH p_stdate p_endate.
      ENDIF.</b>
    PERFORM PLANT_AND_EXCISE_DTLS USING P_WERKS.
      PERFORM plant_and_excise_dtls USING j_1iexgrps-j_1iwerks.
      MOVE : 'ZJ_2I_RG1' TO j_2ilayctr-layoutname.
      SORT t_rg1 BY  chapid matnr cpudt .
    open form
      PERFORM open_form USING  j_2ilayctr-layoutname j_2ilayctr-noofcopies    "J_2ILAYCTR-LAYOUTNAME
                              j_2ilayctr-outdevice  true.
    process extract data and write
    IF P_INDI = 'X'.
      PERFORM get_data_and_write.
    ELSEIF P_CONS = 'X'.
       PERFORM RG1_PRINT_CONS.
       PERFORM GET_DATA_AND_WRITE_CONS.
    ENDIF.
    close form
      PERFORM close_form.
                              F O R M S
      INCLUDE j_2ilayo.
    *&      Form  GET_DATA_AND_WRITE
    Purpose : Logic to print RG1 report
    FORM get_data_and_write.
      DATA: save_matnr LIKE mara-matnr.
      CLEAR: j_1irg1, j_2icomp, save_matnr.
      SELECT * FROM j_1iexchdr INTO TABLE it_j_1iexchdr
      WHERE  exgrp  = p_exgrp
      AND budat   >= p_stdate
      AND budat   <= p_endate.
      SORT it_j_1iexchdr BY cpudt docno.
      LOOP AT it_j_1iexchdr.
        SELECT * FROM j_1iexcdtl INTO wa_j_1iexcdtl
        WHERE docno = it_j_1iexchdr-docno.
          APPEND wa_j_1iexcdtl TO it_j_1iexcdtl.
        ENDSELECT.
      ENDLOOP.
      clear wa_j_1iexcdtl.
      SORT it_j_1iexcdtl BY chapid  matnr cpudt docno.
      LOOP AT t_rg1.
        CLEAR: j_1irg1, j_2icomp.
    assign header fields
        j_2icomp-stdate = p_stdate.
        j_2icomp-endate = p_endate.
        IF save_matnr NE t_rg1-matnr.
    fill header line with matnr, description, chapterid and unit
          j_1irg1-chapid = t_rg1-chapid.
          mara-matnr  = t_rg1-matnr.
          marav-maktx = t_rg1-maktx.
          mara-meins  = t_rg1-meins.
          save_matnr  = t_rg1-matnr.
          IF sy-tabix NE 1.
            j_2icomp-new_page = true.
          ELSE.
            j_2icomp-new_page = false.
          ENDIF.
        ELSE.
          j_2icomp-new_page = false.
        ENDIF.
        PERFORM write_form USING element-spac function-set
                                  typ-body window-main .
    determine line to display viz. manufacture entry/removal entry
        IF t_rg1-matform  = c_packed.
          j_2icomp-rg1_p_l = c_packed.
        ELSEIF t_rg1-matform  = c_loose.
          j_2icomp-rg1_p_l = c_loose.
        ENDIF.
        j_1irg1-cpudt    = t_rg1-cpudt.
        j_2icomp-op_qty  = t_rg1-op_bal.
        j_2icomp-mf_qty  = t_rg1-qty_mfr.
        j_2icomp-to_qty  = t_rg1-total.
        j_2icomp-cl_fin  = t_rg1-cl_bal_fn.
        j_2icomp-cl_bon  = t_rg1-cl_bal_bn.
        j_2icomp-remarks = t_rg1-remarks.
        j_2icomp-h_menge = t_rg1-h_menge.
        j_2icomp-h_value = t_rg1-h_value.
        j_2icomp-e_menge = t_rg1-e_menge.
        j_2icomp-e_value  = t_rg1-e_value.
        j_2icomp-e_menge_bn = t_rg1-e_menge_bond.
        j_2icomp-o_menge    = t_rg1-o_menge.
        j_2icomp-o_purpose  = t_rg1-o_purpose.
        j_2icomp-o_pur_meng = t_rg1-o_pur_menge.
        j_1irg1-bedrate  = t_rg1-bedrate.
        j_1irg1-exbed    = t_rg1-bedamt.
        j_2icomp-cl_fin  = t_rg1-cl_bal_fn.
        j_2icomp-cl_bon  = t_rg1-cl_bal_bn.
        j_2icomp-remarks = t_rg1-remarks.
       READ TABLE it_j_1iexcdtl WITH KEY cpudt = t_rg1-cpudt
                                         chapid = t_rg1-chapid
                                         matnr = t_rg1-matnr.
    IF sy-subrc = 0.
    get duties for issues only.
        IF t_rg1-rcptissrsn = 'IPD'
        OR t_rg1-rcptissrsn = 'IWD'
        OR t_rg1-rcptissrsn = 'IDH'
        OR t_rg1-rcptissrsn = 'IDE'
        OR t_rg1-rcptissrsn = 'IWE'
        OR t_rg1-rcptissrsn = 'IWT'
        OR t_rg1-rcptissrsn = 'IWO'.
          READ TABLE it_j_1iexchdr WITH KEY exnum = t_rg1-rdoc1
                                            trntyp = 'DLFC'
                                            cpudt = t_rg1-cpudt.
          READ TABLE it_j_1iexcdtl WITH KEY docno = it_j_1iexchdr-docno
                                            cpudt = it_j_1iexchdr-cpudt
                                            trntyp = 'DLFC'
                                            matnr = t_rg1-matnr.
      docyr = it_j_1iexchdr-docyr
          IF IT_j_1iexchdr-expind <> 'B'
          and  it_j_1iexchdr-expind <> 'U'
          and  it_j_1iexchdr-expind <> 'D'
          and  it_j_1iexchdr-expind <> 'N'
          AND  T_RG1-h_menge > 0.
         and  it_j_1iexchdr-expind IS INITIAL.
            IF it_j_1iexchdr-censtat = 'P'.
              wa_j_1iexcdtl-ecs = it_j_1iexcdtl-ecs.
            ENDIF.
            IF it_j_1iexchdr-censtat = 'C'.
              wa_j_1iexchdr-exbed = it_j_1iexchdr-exbed.
              wa_j_1iexchdr-ecs = it_j_1iexchdr-ecs.
              wa_j_1iexchdr-censtat = it_j_1iexchdr-censtat.
              wa_j_1iexchdr-cpudt = it_j_1iexchdr-cpudt.
              wa_j_1iexcdtl-rgplaser = it_j_1iexcdtl-rgplaser.
              wa_j_1iexcdtl-rg23aser = it_j_1iexcdtl-rg23aser.
            ENDIF.
          ENDIF.
         endif.
        ENDIF.
        PERFORM write_form USING element-d function-append
                                typ-body window-main .
        CLEAR :  wa_j_1iexchdr, wa_j_1iexcdtl.
      ENDLOOP.
    ENDFORM.                               " GET_DATA_AND_WRITE
    *&      Form  GET_DATA_AND_WRITE_CONS
          text                                                           *
    -->  p1        text
    <--  p2        text
    FORM get_data_and_write_cons.
      DATA: save_chapid LIKE j_1iexcdtl-chapid.
      CLEAR: j_1irg1, j_2icomp, save_chapid.
      LOOP AT t_rg1_cons.
        CLEAR: j_1irg1, j_2icomp.
    assign header fields
        j_2icomp-stdate = p_stdate.
        j_2icomp-endate = p_endate.
        IF save_chapid NE t_rg1_cons-chapid.
    fill header line with chapterid
          j_1irg1-chapid = t_rg1_cons-chapid.
          save_chapid  = t_rg1_cons-chapid.
          IF sy-tabix NE 1.
            j_2icomp-new_page = true.
          ELSE.
            j_2icomp-new_page = false.
          ENDIF.
        ELSE.
          j_2icomp-new_page = false.
        ENDIF.
        PERFORM write_form USING element-spac function-set
                                  typ-body window-main .
    determine line to display viz. manufacture entry/removal entry
        IF t_rg1_cons-matform  = c_packed.
          j_2icomp-rg1_p_l = c_packed.
        ELSEIF t_rg1_cons-matform  = c_loose.
          j_2icomp-rg1_p_l = c_loose.
        ENDIF.
        j_1irg1-cpudt    = t_rg1_cons-cpudt.
        j_2icomp-op_qty  = t_rg1_cons-op_bal.
        j_2icomp-mf_qty  = t_rg1_cons-qty_mfr.
        j_2icomp-to_qty  = t_rg1_cons-total.
        j_2icomp-cl_fin  = t_rg1_cons-cl_bal_fn.
        j_2icomp-cl_bon  = t_rg1_cons-cl_bal_bn.
        j_2icomp-remarks = t_rg1_cons-remarks.
        j_2icomp-h_menge = t_rg1_cons-h_menge.
        j_2icomp-h_value = t_rg1_cons-h_value.
        j_2icomp-e_menge = t_rg1_cons-e_menge.
        j_2icomp-e_value  = t_rg1_cons-e_value.
        j_2icomp-e_menge_bn = t_rg1_cons-e_menge_bond.
        j_2icomp-o_menge    = t_rg1_cons-o_menge.
        j_2icomp-o_purpose  = t_rg1_cons-o_purpose.
        j_2icomp-o_pur_meng = t_rg1_cons-o_pur_menge.
        j_1irg1-bedrate  = t_rg1_cons-bedrate.
        j_1irg1-exbed    = t_rg1_cons-bedamt.
        j_2icomp-cl_fin  = t_rg1_cons-cl_bal_fn.
        j_2icomp-cl_bon  = t_rg1_cons-cl_bal_bn.
        j_2icomp-remarks = t_rg1_cons-remarks.
        PERFORM write_form USING element-d function-append
                                 typ-body window-main .
    *for grand totals
        tot_remv_hval = tot_remv_hval + t_rg1_cons-h_value.
        tot_remv_eval = tot_remv_eval + t_rg1_cons-e_value.
        tot_duty_amt  = tot_duty_amt  + t_rg1_cons-bedamt.
      ENDLOOP.
    *for grand totals
      j_2icomp-amount1 = tot_remv_hval.
      j_2icomp-amount2 = tot_remv_eval.
      j_2icomp-amount3 = tot_duty_amt.
      PERFORM write_form USING element-t function-append
                                        typ-body window-footer.
    ENDFORM.                               " GET_DATA_AND_WRITE_CONS
    *&      Form  RG1_PRINT_CONS
          text                                                           *
    -->  p1        text
    <--  p2        text
    FORM rg1_print_cons.
      DATA : first_time VALUE on.
      SORT t_rg1 BY chapid cpudt.
      LOOP AT t_rg1.
        IF first_time = on.
          m_chapid = t_rg1-chapid.
          m_date = t_rg1-cpudt.
          m_matform = t_rg1-matform.
          m_bedrate = t_rg1-bedrate.
          first_time = off.
        ENDIF.
        IF m_chapid <> t_rg1-chapid.
          PERFORM chapid_break.
        ELSEIF m_date <> t_rg1-cpudt.
          PERFORM date_break.
        ENDIF.
    Accumulate totals
        tot_op_bal = tot_op_bal + t_rg1-op_bal.
        tot_qty_mnfr = tot_qty_mnfr + t_rg1-qty_mfr.
        tot_total_qty_mnfr = tot_total_qty_mnfr + t_rg1-total.
        tot_remv_home = tot_remv_home + t_rg1-h_menge.
        tot_remv_hval = tot_remv_hval + t_rg1-h_value.
        tot_remv_expr = tot_remv_expr + t_rg1-e_menge.
        tot_remv_eval = tot_remv_eval + t_rg1-e_value.
        tot_remv_expb = tot_remv_expb + t_rg1-e_menge_bond.
        tot_remv_othr = tot_remv_othr + t_rg1-o_menge.
        tot_remv_opur = tot_remv_opur + t_rg1-o_pur_menge.
        tot_duty_amt = tot_duty_amt + t_rg1-bedamt.
        tot_cb_fr = tot_cb_fr + t_rg1-cl_bal_fn.
        tot_cb_br = tot_cb_br + t_rg1-cl_bal_bn.
      ENDLOOP.
      PERFORM chapid_break.
    ENDFORM.                               " RG1_PRINT_CONS
    *&      Form  DATE_BREAK
          text                                                           *
    -->  p1        text
    <--  p2        text
    FORM date_break.
      CLEAR t_rg1_cons.
      t_rg1_cons-chapid = m_chapid.
      t_rg1_cons-cpudt  = m_date.
      t_rg1_cons-op_bal  = tot_op_bal.
      t_rg1_cons-qty_mfr = tot_qty_mnfr.
      t_rg1_cons-total   = tot_total_qty_mnfr.
      t_rg1_cons-h_menge = tot_remv_home.
      t_rg1_cons-h_value = tot_remv_hval.
      t_rg1_cons-e_menge = tot_remv_expr.
      t_rg1_cons-e_value = tot_remv_eval.
      t_rg1_cons-e_menge_bond = tot_remv_expb.
      t_rg1_cons-o_menge      = tot_remv_othr.
      t_rg1_cons-o_pur_menge  = tot_remv_opur.
      t_rg1_cons-bedamt       = tot_duty_amt.
      t_rg1_cons-cl_bal_fn    = tot_cb_fr.
      t_rg1_cons-cl_bal_bn    = tot_cb_br.
      t_rg1_cons-matform      = m_matform.
      t_rg1_cons-bedrate      = m_bedrate.
      APPEND t_rg1_cons.
      tot_op_bal = 0.
      tot_qty_mnfr = 0.
      tot_total_qty_mnfr = 0.
      tot_remv_home = 0.
      tot_remv_hval = 0.
      tot_remv_expr = 0.
      tot_remv_eval = 0.
      tot_remv_expb = 0.
      tot_remv_othr = 0.
      tot_remv_opur = 0.
      tot_duty_amt  = 0.
      tot_cb_fr     = 0.
      tot_cb_br     = 0.
      m_date = t_rg1-cpudt.
      m_matform = t_rg1-matform.
      m_bedrate = t_rg1-bedrate.
    ENDFORM.                               " DATE_BREAK
    *&      Form  CHAPID_BREAK
          text
    -->  p1        text
    <--  p2        text
    FORM chapid_break.
      PERFORM date_break.
      m_chapid = t_rg1-chapid.
    ENDFORM.                               " CHAPID_BREAK

    hi rakesh,
        in your first select single * statement you have given WHERE BUKRS = T001K-BUKRS..but at the point of execution, what will be the value stored in t001k-bukrs...i doubt it will be initial....so,  store bukrs in a variable or hardcode it.....
       in the second select, you hve not given any target work area for the into class...that's y your subrc is 4...specify a target area, where you want the data to be stored...

  • What is the problem in this code

    hi
    im tring to ftech mutliple reords to tabuler form text item
    i write this code but its only fetch values for first record in the text item and do not fetch to other records in the same text item
    Declare
    cursor c is
    select distinct group_a from sc_mast; <here i select all values
    in my database that they are 63 values>
    begin
    for r in c loop
    next_record;
    :visib_groups.group_a:=r.group_a;<it assign vakues only for first record>
    end loop;
    end;

    This?
    Go_block('>your_block<')
    first_record;
    begin
    for r in c loop
    :visib_groups.group_a:=r.group_a;<it assign vakues only for first record>
    next_record;
    end loop;Ros

  • "When_list_changed" what is the problem with this code???????

    DECLARE
         v_group_grade RECORDGROUP;
         v_pop_group NUMBER;
    BEGIN
         v_group_grade := find_group('group_grade');
         IF NOT id_null(v_group_grade) THEN
                   delete_group(v_group_grade);
         END IF;
         IF :CONTROL_LISTS.STAGE = 1 THEN
              v_group_grade := create_group_from_query('group_grade', 'SELECT grade_name FROM grade WHERE grade_name LIKE ''KG%''');
              v_pop_group := populate_group(v_group_grade);
              populate_list('CONTROL_LISTS.GRADE', v_group_grade);
         ELSIF :CONTROL_LISTS.STAGE = 2 THEN
              v_group_grade := create_group_from_query('group_grade', 'SELECT grade_name FROM grade WHERE grade_name LIKE ''Prim%''');
              v_pop_group := populate_group(v_group_grade);
              populate_list('CONTROL_LISTS.GRADE', v_group_grade);
         ELSIF:CONTROL_LISTS.STAGE = 3 THEN
              v_group_grade := create_group_from_query('group_grade', 'SELECT grade_name FROM grade WHERE grade_name LIKE ''Prep%''');
              v_pop_group := populate_group(v_group_grade);
              populate_list('CONTROL_LISTS.GRADE', v_group_grade);
         ELSE
              NULL;
         END IF;
    END;
    when I change the selection of the STAGE list in the runtime this error apear:
    FRM-41334 invalid record group for list population.

    Thanks Faheem,
    I got it it was in the select statement.
    When I create poplist to fetch data from the database I should select at least two charachter columns.

  • When trying to install the \ Creative Cloud without error 1. What's the Problem ?

    When trying to install the \ Creative Cloud without error 1. What's the Problem ?

    Error Code 1: "Failed to install" | Creative Cloud Desktop : https://helpx.adobe.com/creative-cloud/kb/failed-install-creative-cloud-desktop.html

  • What's the problem with my download pages?

    my download page:
    <cfquery name="download" datasource="#xyz#">
    </cfquery>
    <cfoutput query="download">
    <a
    href="download.cfm?DownloadFileName=#URLEncodedFormat(NoticeFileName)#"
    class="FileDown">#NoticeFileName#</a>
    </cfoutput>
    download.cfm
    <cfprocessingdirective suppresswhitespace="yes">
    <cfheader name="Content-Disposition"
    value="attachment;filename=#DownloadFileName#">
    <cfcontent type="Application/Unknown;charset=gb2312"
    file="#DownloadPath##DownloadFileName#" deletefile="no"
    reset="yes">
    </cfprocessingdirective>
    This can be download the file.but after i save the file to my
    disk,i click the menu to jump to an other page,it can not;but after
    i refresh this page and click the menu,it can be jump to the page i
    want .
    what's the problem with my code?thanks a lot.

    UP.

  • CC will not update Code 2 what is the problem ?

    I am trying to update CC and getting error Code 2: - Contact support - what is the problem with the download ....??

    Without any proper system info nobody can tell you anything and it would help to have more info. Click on the "Details" link that comes up with the warning.
    Mylenium

  • I deactivated my mac adobe CS5 on one computer, and now i cannot activate it on another, it says the activation code is not valid, what  is the problem?

    i deactivated my mac adobe CS5 on one computer, and now i cannot activate it on another, it says the activation code is not valid, what  is the problem?

    Please refer:
    http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html
    Click the Chat Now button at the end of the page and talk with a live agent who would resolve it ASAP.
    Regards,
    Ashutosh

  • HT201210 showing code 3014,what is the problem?

    showing code 3014,what is the problem..i cant use my phione...because ur stupid maxis send me to update my version...pls respon me soon..tq                   

    http://support.apple.com/kb/TS3694#error3014

Maybe you are looking for