Troubleshooting SAP BAPI / RFC Calls

Problem

If you have configured an SAP BAPI / RFC call in NLINK and it isn't working as expected, here are several steps you can take to verify that your configuration is correct.

Please work through these steps before contacting support.

Solution

NLINK Configuration Tips

Use the Return Variable and Send Message Branch Action Series when working with BAPIs and RFCs. These will help you catch serious problems like ABAP exceptions and communication errors. Be aware that some BAPIs / RFCs use ABAP exceptions even to return good information! In these cases, you will need to analyze the Return Variable in the Send Message Branch Action Series and decide how to proceed.

Be sure to set appropriate Workset Table Key Fields on the Workset Tables associated with any Table parameters. The Wizard will create the Workset Tables for you, but it's up to you to understand the data and flesh out the Workset structure properly with any parent-child relationships and key fields.

Uncheck Input / Output flags on Map Fields for Tables parameters where it makes sense. The Table parameters can technically both send and receive data, so the Wizard sets both the Input and Output flags. However, most RFCs and BAPIs only really use the Table data in one direction. In most cases it doesn't matter, but sometimes you will find that sending or receiving empty records in a Table parameter that you aren't really using that way can cause unexpected results.

Be sure to look at the contents of any RETURN parameter(s). Some BAPIs and RFCs will have both an Export and Table parameter with RETURN structures. If the RETURN structure is in a Table parameter, be sure to set a Workset Table Key Field–otherwise you will only ever get one record of the results.

Consider building in a call to BAPI_MESSAGE_GETDETAIL in your BAPI / RFC error handling Action Series. You can also use it in SE37 for diagnosing RETURN messages.

Don't forget to use the Dump Workset Action and the NLINK Debug Module (NDM) to examine the results of your configuration.

Look for SAP Documentation

Be sure to read any documentation available in the SAP system. Things to look for include: whether you need to include a COMMIT when creating data, required fields or combinations of fields, whether you must call a series of BAPIs / RFCs together (especially common in the ALM functions), non-obvious system values needed for various fields, selection criteria examples, etc.

For BAPIs, look in transaction BAPI to see if it is listed there.


video Find documentation in transaction BAPI

If you cannot find it there, you may be able to get to some documentation through transaction SE37. This is generally less helpful (and often not available in English) but it's worth a try.


video Find documentation in transaction SE37

Test in SE37

Especially for very complicated calls, it's a good idea to verify that the BAPI/RFC works the way you think it does by testing it in SE37. Generally speaking, if you can get it to work in SE37, you can get it to work from NLINK.

See more details here.

Keep in mind that when using the SE37 transaction through the SAPGUI, it is doing some data transformation for you that you will need to handle directly in NLINK. For example, in the SAPGUI you can type in a date in your local format (e.g., MM/DD/YYYY) but when calling from NLINK you usually need to use the internal SAP format (YYYYMMDD). Some BAPIs / RFCs are stricter than others, particularly regarding document numbers (leading zeroes, etc.), so there is a bit of trial-and-error involved.

Verify Data in NLINK Trace File

If you set the Activate Trace flag via the NLINK Management Module (NMM) you can generate a file NLINK SapRfcBapi CoNNector2 Trace.Log in the Logs folder which contains details of the outbound call to SAP. This text file is not very user-friendly, but you can find the Import and Table parameters and see exactly what data NLINK is sending.


video Activate Trace in NMM


Example Contents of NLINK SapRfcBapi CoNNector2 Trace.Log
06-Jan-17 11:04:11 :
  ABAP Name  MATERIAL
   DataType    0 ('RFCTYPE_CHAR')
   Direction   1 ('RFC_IMPORT')
   Decimals    0
   ucLength    36
   nucLength   18
   Default    ''
   Optional   '' ('')
06-Jan-17 11:04:11 :   Data '100-300'


...


06-Jan-17 11:44:40 :
  ABAP Name  MATNRSELECTION
   DataType    5 ('RFCTYPE_TABLE')
   Direction   7 ('RFC_TABLES')
   Decimals    0
   ucLength    78
   nucLength   39
   Default    ''
   Optional   '' ('')
06-Jan-17 11:44:40 :   ABAP Name  SIGN
06-Jan-17 11:44:40 :    DataType    0 ('RFCTYPE_CHAR')
06-Jan-17 11:44:40 :    Decimals    0
06-Jan-17 11:44:40 :    ucLength    2
06-Jan-17 11:44:40 :    ucOffset    0
06-Jan-17 11:44:40 :    nucLength   1
06-Jan-17 11:44:40 :    nucOffset   0
06-Jan-17 11:44:40 :    Data 'I'
06-Jan-17 11:44:40 :   ABAP Name  OPTION
06-Jan-17 11:44:40 :    DataType    0 ('RFCTYPE_CHAR')
06-Jan-17 11:44:40 :    Decimals    0
06-Jan-17 11:44:40 :    ucLength    4
06-Jan-17 11:44:40 :    ucOffset    2
06-Jan-17 11:44:40 :    nucLength   2
06-Jan-17 11:44:40 :    nucOffset   1
06-Jan-17 11:44:40 :    Data 'BT'
06-Jan-17 11:44:40 :   ABAP Name  MATNR_LOW
06-Jan-17 11:44:40 :    DataType    0 ('RFCTYPE_CHAR')
06-Jan-17 11:44:40 :    Decimals    0
06-Jan-17 11:44:40 :    ucLength    36
06-Jan-17 11:44:40 :    ucOffset    6
06-Jan-17 11:44:40 :    nucLength   18
06-Jan-17 11:44:40 :    nucOffset   3
06-Jan-17 11:44:40 :    Data '100-300'
06-Jan-17 11:44:40 :   ABAP Name  MATNR_HIGH
06-Jan-17 11:44:40 :    DataType    0 ('RFCTYPE_CHAR')
06-Jan-17 11:44:40 :    Decimals    0
06-Jan-17 11:44:40 :    ucLength    36
06-Jan-17 11:44:40 :    ucOffset    42
06-Jan-17 11:44:40 :    nucLength   18
06-Jan-17 11:44:40 :    nucOffset   21
06-Jan-17 11:44:40 :    Data '300-300'

Do Not Leave Activate Trace Flag On

Be sure to turn off the Activate Trace flag when you are done! These files can get very large, and also slow down the processing. You definitely do not want to run for an extended period of time with this flag turned on.


Filter by label

There are no items with the selected labels at this time.