cancel
Showing results for 
Search instead for 
Did you mean: 

Updating ZTABLE via RFC using .NET Connector 3.0

Former Member
0 Kudos

Hi,

I have a ZTABLE named Z_FI_TEST. I have an RFC function that accepts a table input and is supposed to update the current records' status column to X in Z_FI_TEST for matching records in the table that is passed in.

Here is my code

RfcDestination destination = RfcDestinationManager.GetDestination("SAP_ECC");
IRfcFunction function = null;

function = destination.Repository.CreateFunction("Z_FI_UPDATE");
foreach (IRfcStructure row in table)
                    {
                        // S = SUCCESS
                        // R = RETRY
                        // E = ERROR
                        row.SetValue("STATUS", "X");
                    }
function.SetValue("T_DATA", table);
function.Invoke(destination); //make the remote call

When I make the call, I can see from the .NET debug window that input parameters are properly structured and contain values. Here is what I see from the debug window:

{FUNCTION Z_FI_TEST (TABLES PARAMETER T_DATA=TABLE  [STRUCTURE ZTFI_WF_START { FIELD MANDT=400 FIELD ID=0000000001 FIELD REQUEST=?INVOICE=1900000016&CIECODE=2000&FISCY=2011&WORKFLOW=NONPO&ROUTE=SELECTION&ACTION=NEW FIELD TIMESTAMP=20110401084509 FIELD STATUS=X }] [STRUCTURE ZTFI_WF_START { FIELD MANDT=400 FIELD ID=0000000002 FIELD REQUEST=?invoice=1900000017&ciecode=2000&fiscy=2011&workflow=NonPO&route=Selection&action=New FIELD TIMESTAMP=20110401094238 FIELD STATUS=X }])}
    [SAP.Middleware.Connector.RfcFunction]: {FUNCTION Z_FI_TEST (TABLES PARAMETER T_DATA=TABLE  [STRUCTURE ZTFI_WF_START { FIELD MANDT=400 FIELD ID=0000000001 FIELD REQUEST=?INVOICE=1900000016&CIECODE=2000&FISCY=2011&WORKFLOW=NONPO&ROUTE=SELECTION&ACTION=NEW FIELD TIMESTAMP=20110401084509 FIELD STATUS=X }] [STRUCTURE ZTFI_WF_START { FIELD MANDT=400 FIELD ID=0000000002 FIELD REQUEST=?invoice=1900000017&ciecode=2000&fiscy=2011&workflow=NonPO&route=Selection&action=New FIELD TIMESTAMP=20110401094238 FIELD STATUS=X }])}
    AbapClassExceptionMode: OFF
    Metadata: {FUNCTION Z_FI_TEST (TABLES T_DATA:STRUCTURE ZTFI_WF_START)}

The strange thing is, the call did not result in any error. Yet, the records are not updated. I got an ABAP Developer to place a breakpoint when the RFC was called from the connector. When we examine the T_DATA value that is passed in, it is empty.

Can anyone point out what I am doing wrong?

Thank You.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Voon Siong Lum,

I am also facing the same problem. Have you found the answer?

If found the answer, kindly help me to solve this issue.

Regards,

Prabakaran.K

Former Member
0 Kudos

Hi,

Unfortunately, we did not find any solutions. I am thinking that this could be a bug with the connector. We should open an OSS note but we did not. Instead, we just asked the ABAPers to revise their RFC. Instead of passing in the table and update based on the table that was passed in, we are now doing record by record update.

Good Luck.

Former Member
0 Kudos

Hi,

Thanks for your immediate response.

Regards,

Prabakaran.K

Former Member
0 Kudos

Dear Voon Siong Lum,

I found the answer for the problem. In the RFC you have to create the internal table with header line. It will solve your problem.

Regards,

Prabakaran.K

Former Member
0 Kudos

Hi,

Thanks for sharing. I am passing this information to my ABAPer. We'll be testing this out

Former Member
0 Kudos

Thanks to Prabakaran.K, this is now solved. By adding the header line into the internal table, I can now pass tables from .NET back to RFC for updates!

Former Member
0 Kudos

hi

can u give me code to how to update the Table in sap using RFC. i am stuck and don't know how to pass whole table to Sap.

Thanks in Advance

Answers (0)