Mapping multiple fields of the same name
Support for mapping multiple fields of the same name is a relatively new capability. Prior to this capability, duplicate fields had been listed side-by-side in field mapping. Duplicate field name support requires the following steps to implement. Conceptual and procedural information is contained below.
Traditional field mapping
If you have multiple fields with the same name (for example, fields FIELD 1 and
FIELD2), the duplicate field names will be stripped out when mapped to corresponding
fields. An example is shown
below:
$SAPMFOD=0100
FIELD1="FOO"
FIELD2
BDC_OKCODE=100
$SAPMFOD=0101
FIELD1
FIELD2
Duplicate field mapping
To preserve the field mapping when you have multiple fields of the same name, you
must prefix a number value to the fields to which they correspond in the Connection
property (ScreenField) of the SAP connection document. An example of how the
traditional field mapping shown above, should be modified is shown
below:
$SAPMFOD=0100
FIELD1="FOO"
1FIELD2
BDC_OKCODE=100
$SAPMFOD=0101
FIELD1="FOO1"
2FIELD2
BDC_OKCODE=100
You need only prefix a field value with an ordering number if you do not immediately hard code a value to the field.
Field mapping in the SAP connection document would be established, for this field, to provide it with values when the activity runs. The Connector can then properly handle these field mappings and transfer the data properly.
This change also applies to HEI Scripted activities. An LC LSX script showing proper
usage of this new functionality is shown below:
Note: In this example, notice that
because of the number prefixes, you know exactly which field is being set. in
thsi sample Call method
script.
Dim sess As New LCSession
Dim r3 As New LCConnection("sap")
Dim fldLstParms As LCFieldList
Dim fldLstResult As LCFieldList
Dim fldParm As LCField
Dim field As LCField
Dim index As Long
Dim count As Long
On Error Goto ErrorHandler
Print "----------------------------------------"
Print "SaveParkInvoiceGUI31_40_2"
Print "----------------------------------------"
sess.connectionpooling = False
r3.Userid = "muster"
r3.Password = "ides"
r3.Destination = "JP1"
r3.Client = "800"
r3.SystemNo = 0
r3.Language = "en"
r3.Server = "imtsap3.yamato.ibm.com"
Print "Connect"
r3.Connect
r3.ModuleType = 1 ' calling an ECC transaction
Set fldLstParms = New LCFieldList(1, 0)
Set fldLstResult = New LCFieldList(1, 0)
'-------------------------------------------------------------------
r3.Procedure = "F-63"
'-------------------------------------------------------------------
'screen fields should have hard coded all values that are
' not dynamic - like BDC_OKCODE and in this case BDC_SUBSCR
r3.ScreenFields = "$SAPLF040=0100," +_
"BKPF-BLDAT," +_
"BKPF-BLART," +_
"BKPF-BUKRS," +_
"BKPF-WAERS," +_
"1RF05V-NEWBS," +_
"2RF05V-NEWKO," +_
"BDC_OKCODE=/00," +_
"$SAPLF040=0302," +_
"1BSEG-WRBTR," +_
"BSEG-MWSKZ," +_
"BSEG-ZLSCH," +_
"2RF05V-NEWBS," +_
"2RF05V-NEWKO," +_
"BDC_OKCODE=/00," +_
"$SAPLF040=0300," +_
"2BSEG-WRBTR," +_
"BDC_SUBSCR=SAPLKACB," +_
"BDC_OKCODE=BP," +_
"$SAPLKACB=0002," +_
"BDC_OKCODE=/EENTE," +_
"$SAPLKACB=0002," +_
"BDC_SUBSCR=SAPLKACB, " +_
"BDC_OKCODE=ENTE"
Set fldParm = fldLstParms.Append("BKPF-BLDAT", LCTYPE_TEXT)
fldParm.Text = "24.08.2003"
Set fldParm = fldLstParms.Append("BKPF-BLART", LCTYPE_TEXT)
fldParm.Text = "KR"
Set fldParm = fldLstParms.Append("BKPF-BUKRS", LCTYPE_TEXT)
fldParm.Text = "5000"
Set fldParm = fldLstParms.Append("BKPF-WAERS", LCTYPE_TEXT)
fldParm.Text = "JPY"
Set fldParm = fldLstParms.Append("1RF05V-NEWBS", LCTYPE_TEXT)
fldParm.Text = "31"
Set fldParm = fldLstParms.Append("1RF05V-NEWKO", LCTYPE_TEXT)
fldParm.Text = "5003"
Set fldParm = fldLstParms.Append("1BSEG-WRBTR", LCTYPE_TEXT)
fldParm.Text = "12340000"
Set fldParm = fldLstParms.Append("BSEG-MWSKZ", LCTYPE_TEXT)
fldParm.Text = "V1"
Set fldParm = fldLstParms.Append("BSEG-ZLSCH", LCTYPE_TEXT)
fldParm.Text = "T"
Set fldParm = fldLstParms.Append("2RF05V-NEWBS", LCTYPE_TEXT)
fldParm.Text = "40"
Set fldParm = fldLstParms.Append("2RF05V-NEWKO", LCTYPE_TEXT)
fldParm.Text = "111110"
Set fldParm = fldLstParms.Append("1BSEG-WRBTR", LCTYPE_TEXT)
fldParm.Text = "45670000"
'-------------------------------------------------------------------
Print "Calling...."
count = r3.Call(fldLstParms, 1, fldLstResult)
Print "Done! (count=" & count & ")"
Print r3.Message
Print "Disconnect"
r3.Disconnect
Print "Done"
Exit Sub
ErrorHandler:
Dim msg As String
Dim msgCode As Long
Dim status As Integer
Dim result As String
If sess.status <> LCSUCCESS Then
status = sess.GetStatus(result, msgcode, msg)
Print "Result: " + result
End If
Print "Error: " & sess.GetStatusText
Exit Sub