SAP ABAP IMG Activity _ISUWAEL_000012 (Define Hardware Profile Controls)
Hierarchy
IS-UT (Software Component) SAP Utilities/Telecommunication
   IS-U (Application Component) SAP Utilities
     EE80 (Package) IS-U: Customizing
IMG Activity
ID _ISUWAEL_000012 Define Hardware Profile Controls  
Transaction Code S_KK4_82001419   (empty) 
Created on 20040107    
Customizing Attributes _ISUWAEL_000012   Define Hardware Profile Controls 
Customizing Activity _ISUWAEL_000012   Define Hardware Profile Controls 
Document
Document Class SIMG   Hypertext: Object Class - Class to which a document belongs.
Document Name _ISUWAEL_000012    

Use

You can use this activity to implement the flow control for the externally connected devices. JavaScript (or JScript) is used as the descriptive language. The options provided by this language are not documented here. For each script you must define the parameterless function "Main()" as the access point. This is responsible for the entire flow of the controls and must, if necessary, save all results in the structures provided for this purpose. Furthermore, the success of the execution is to be returned as a boolean value.

2 global class instances are available at the script runtime:

  • Device (corresponds to the device called)
  • Debugger (corresponds to a class for outputting information at the runtime)

Device Methods:

  • Write(AData : string)

    Write ASCII data

  • WriteHS(AData : string)

    Write hexadecimal data

  • WritePacket(AData, AStartSequence, AEndSequence : string)

    Write ASCII data (with sequences for the start and end of the package)

  • WritePacketHS(AData, AStartSequence, AEndSequence : string)

    Write hexadecimal data (with sequences for the start and end of the package)

  • ReadCount(ACount, ATimeOut : Integer)

    Reads n bytes from the device in the buffer

  • ReadPacket(AStartSequence, AEndSequence : string; ATimeOut : Integer)

    Reads a package that starts or ends with the specified ASCII sequence.

    The ATimeOut parameter has a standard value of 2000ms, and is optional.

  • ReadPacketHS(AStartSequence; AEndSequence : string; ATimeOut : Integer)

    Reads a package that starts or ends with the specified hexadecimal sequence.

    The ATimeOut parameter has a standard value of 2000ms, and is optional.

  • CompareBuffer(AValue : string; AbufferIndex : Integer)

    Compares the value in the current buffer, at the index, with the specified ASCII string.

  • CompareBufferHS(AValue : string; ABufferIndex : Integer)

    Compares the value in the current buffer, at the index, with the specified hexadecimal string.

  • GetBuffer(ABufferIndex, ACount : Integer)

    Returns the ASCII characters described by the index and count from the current buffer.

  • GetBufferHS(ABufferIndex, ACount : Integer)

    Returns the hexadecimal characters described by the index and count from the current buffer.

  • SetResult(AName, AValue : string)

    Sets a parameter to the specified value for returning to the ABAP program.

  • SetError(AValue : string)

    Sets an error message, which is evaluated by the client

Device Properties:

  • Buffer : string

    Option to directly read/write the current data buffer.

  • Parameter : string

    Parameter transfer from client (can only be read)

Debugger Methods:

  • Write(AValue : string)

    Gives a text message to the debugger

Requirements

Standard settings

Activities

Example

The following example demonstrates the controls for a vehicle weighing:

function Main()

{

var LResult = false;

var LCount;

var LRepeatRead = 1;

var LWeight;

var LDimension;

Device.WritePacket("q$","\x01","\x17");

Debugger.Write("command send");

do

{

LCount = Device.ReadPacket("\x01","\x17",2000);

if(LCount >= 0)

{

if(Device.CompareBuffer("w5",1))

{

Debugger.Write("scale not in neutral position");

LRepeatRead = 1;

}

else

{

if(Device.CompareBuffer("+",1)) // weight-datagram

{

Debugger.Write("weight-datagram...");

if(Device.CompareBufferHS("21",2)) // weight invalid

{

Debugger.Write("weight valid");

LWeight = parseFloat(Device.GetBuffer(3,9));

LDimension = Device.GetBuffer(12,2);

Device.SetResult("WEIGHT",LWeight);

Device.SetResult("DIMENSION",LDimension);

Debugger.Write("weight:"+LWeight+"("+LDimension+")");

LRepeatRead = 0;

LResult = true;

}

else // scale under- or overloaded

{

Device.SetError("scale under- or overloaded");

Debugger.Write("weight invalid (scale under- or overloaded)");

LRepeatRead = 0;

LResult = false;

}

};

};

}

else

{

LRepeatRead = 0;

Device.SetError("Timeout");

LResult = false;

};

Debugger.Write("ReapeatRead->"+LRepeatRead);

} while(LRepeatRead == 1);

return(LResult);

}

Business Attributes
ASAP Roadmap ID    
Mandatory / Optional 2   Optional activity 
Critical / Non-Critical 1   Critical 
Country-Dependency A   Valid for all countries 
Assigned Application Components
Documentation Object Class Documentation Object Name Current line number Application Component Application Component Name
SIMG _ISUWAEL_000012 0 I500000071 Waste Management 
Maintenance Objects
Maintenance object type C   Customizing Object 
Assigned objects
Customizing Object Object Type Transaction Code Sub-object Do not Summarize Skip Subset Dialog Box Description for multiple selections
EWAWAT002 T - Individual transaction object EWAWAT002  
History
Last changed by/on SAP  20040107 
SAP Release Created in 472