I am trying to pass 2 rows to a BAPI table, but my code is taking only the 2nd row all the times.
I is passing the data as:
6 7 8
6 7 8
instead of:
1 2 3
6 7 8
Here's what I've tried:
IRfcFunction bapiTEST = _rfcDest.Repository.CreateFunction(strBapi);
IRfcStructure structImport = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CLICK").CreateStructure();
structImport.SetValue("NUM1", "000001");
structImport.SetValue("NUM2", "000002");
structImport.SetValue("NUM3", "000003");
IRfcTable tblImport = bapiTEST.GetTable("IMPORT");
tblImport.Insert(structImport);
structImport.SetValue("NUM1", "000006");
structImport.SetValue("NUM2", "000007");
structImport.SetValue("NUM3", "000008");
tblImport.Insert(structImport);
bapiTEST.SetValue("IMPORT", tblImport);
RfcSessionManager.BeginContext(_rfcDest);
bapiTEST.Invoke(_rfcDest);
I think you're reusing structImport, so the second time you're calling SetValue is also affecting the first structImport you inserted. Try calling another CreateStructure() in between.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With