How to read BAPI table parameter BAPIRET2 in BODS

Hi,
I am creating business partners in SAP CRM using BAPI BAPI_BUPA_FS_CREATE_FROM_DATA2 and it is working fine and crating business partners in SAP crm using BODS.

I want to have log file during data miagration to sap CRM. The success or error log is maintained in BAPI paramer table BAPIRET2.

How to read BAPIRET2 table (RETURN) to have information of log in target file?

Thanks.

Badari Talanki


btalanki (BOB member since 2012-04-28)

You have a return structure from the bapi, define that it is returned, flatten it and write it to a table or file.

P.s. Don’t forget to attach a role to the BP otherwise it is often pretty useless


Johannes Vink :netherlands: (BOB member since 2012-03-20)

Hi Johannes Vink,

Thanks for your response. I am attaching BP ROLE to table ROLES of BAPI and business partners are creating fine with specified role.

BAPI is returning AL_RFC_RETCODE and not returning RETURN table.
Can you please explain more steps on “You have a return structure from the bapi, define that it is returned, flatten it and write it to a table or file.” ?

Thanks
Badari Talanki


btalanki (BOB member since 2012-04-28)

If I want to create business partner in SAP CRM manually, execution of BAPI BAPI_BUPA_FS_CREATE_FROM_DATA2 and BAPI_TRANSACTION_COMMIT.

If I use bapi BAPI_BUPA_FS_CREATE_FROM_DATA2 in BODS, it creates business partner and no need to use BAPI_TRANSACTION_COMMIT. What could be the reason for this behaviour?


btalanki (BOB member since 2012-04-28)

Commit is indeed not required via BODS. I was not aware that a commit was required in SE37? In fact, these should be in line with each other. Are you sure about this? Could it be that after you create a BP in CRM via BODS that you immediately after that attach a role to the BP?

When you modify the BAPI in BODS the first step is the mapping witht the fields and the nested table structures. The next step is that you can chose the output paramters, including a table structure RETURN. It is a nested table with information on the status of the creation. Empty is in order, any other line with a descriptive text is either a warning or an error.


Johannes Vink :netherlands: (BOB member since 2012-03-20)

When we call BAPIs/RFCs we commit ourselves always.


Werner Daehn :de: (BOB member since 2004-12-17)

Maybe it works always with ECC / R/3, but definitely not always works with CRM. I have to throw a BAPI_TRANSACTION_COMMIT with some BAPI’s that do not have a commit included.


Johannes Vink :netherlands: (BOB member since 2012-03-20)

You mean there is a second new-function-call to BAPI commit in your dataflow? Doesn’t make sense, each would run via a separate session, hence the commit BAPI call would not impact the other BAPI.

Are you sure?


Werner Daehn :de: (BOB member since 2004-12-17)

Sometimes we encounter a BAPI where there is no BAPI_TRANSACTION_COMMIT at the end. Then we add in a subsequent query the commit it self. I am sure that it works that way, but I always had to find it out the hard way: most rfc enabled functions have the commit included.

We had some custom rfc enabled functions/wrappers where the commit was missing, but there are also some standard bapi’s:

CRM:
BAPI_BUPA_FRG0100_CREATE
Although I see in the code that there is a commit now…

ECC:
BAPI_CONTRACT_CHANGE
Although the bapi is changed in 2011 and there is commit with a comment that the commit is forced.

So with other words… I am sure it works, but cannot explain it and when I check the code of the functions there is a commit. So that disproves my case a lot… :shock:


Johannes Vink :netherlands: (BOB member since 2012-03-20)

BAPI is returning AL_RFC_RETCODE and not returning RETURN table.

Can you please explain more steps on falteening of RETURN table of BAPI.

I was able to create business partners using BAPI BAPI_BUPA_FS_CREATE_FROM_DATA2. How to read RETURN table after execution of BAPI in to flat table. Can you pleae throw more light on steps for falttening the table.

Thanks.


btalanki (BOB member since 2012-04-28)

Hi

have you resolved this issue?how did u flatten the return table parameter?

Thanks
Jesline


jeslinejohnson (BOB member since 2015-01-27)

Here’s how to unnest in a query transform:- loading... | SAP Help Portal


Nemesis :australia: (BOB member since 2004-06-09)

Thanks for replying.
Have done the same way by unnesting the table .can you please check this post where I have mentioned the issue.

Issue is When calling RFC via SAP Business Object Data Services (BODS) job failed due to it couldn’t populate the return parameter structure when return more than one records from the RFC module.


jeslinejohnson (BOB member since 2015-01-27)