Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute a BADI in Bapi using sap connector in and C#

Former Member
0 Kudos

Hi,

How to implement badi in sap.

11 REPLIES 11

Former Member
0 Kudos

Go to t-code SE18, give the BADI name and display. In the next screen Implementation->Create.

Regards,

Raju

0 Kudos

Please help me .

how can i pass the parameter in badi.

any example

Former Member
0 Kudos

Hpw to Pass Parameter in badi ACC_DOCUMENT

0 Kudos


Hi,

Badi ACC_DOCUMENT has two methods CHANGE and FILL_ACCIT.

Once you created your implementation you can see the scope of importing and changing parameters(structures) in each methods.

You can use importing parameters and change the values of changing parameters.

Thanks,

Sagar

0 Kudos

Thanks for Reply.

I want to Importing Parameters.Using .Net sap connector

Any Example

0 Kudos

Hi

It doesn't make a sense to call a BADI from another system, a BADI is an exit and it can't stand alone, it has to be called by the program in which it appears

ACC_DOCUMENT is called by BAPIs BAPI_ACC_DOCUMENT_POST/BAPI_ACC_DOCUMENT_CHECK



And you should consider you can see the RFC in SAP Connector, so I don't believe you can call it, of course you can call the BAPI BAPI_ACC_DOCUMENT_POST or BAPI_ACC_DOCUMENT_CHECK, and they'll call the BADI ACC_DOCUMENT


So what do you really need to do?


Max

0 Kudos

Thanks Max.

I call BADI ACC_DOCUMENT in  BAPI BAPI_ACC_DOCUMENT_POST.

How to execute badi in bapi.give solution using RFC in SAP.

0 Kudos

Hi

but you don't need to call the BADI, it'll be called automatically by BAPI_ACC_DOCUMENT_POST.

The BAPI is a RFC so you need to call it, not the BADI

I can't understand why you want to call the BADI

Max

0 Kudos

Max

I want To pass Parameter In Extensions table. for extra parameter.

I want to pass Posting Key.

0 Kudos

Max

please share me some example.

I am very thankful to you.

0 Kudos

Ok

but you can do it only in SAP, you need to create an implementation in SAP (not out of SAP)

The structure of extensions is based on BAPIPAREX:

So in your C program you need only to fill the extensions and transfer them to BAPI

You can use the field STRUCTURE in order to create a control in the BADI (the BAPI can be called by several programs)

You need to transfer the item number (so ITEMNO_ACC) and the posting key in the rest of extensios;

EXTENSION2-SRTUCTURE = '.............'.


* The posting key for the first position could be

EXTENSION2+30(10)            = '0000000001'.

EXTENSION2+40(2)              = '24'.

APPEND EXTENSION2.

* The posting key for the second position could be

EXTENSION2+30(10)            = '0000000002'.

EXTENSION2+40(2)              = '34'.

APPEND EXTENSION2.

In this way you can fill the extensions (of course you need to write the code above based on the language used for SAP Connector)

So in SAP you need to create an implementation of the BADI in order to transfer the data from extensions to internal structure, something like this:

DATA: L_EXTENSION TYPE BAPIPAREX.

DATA: L_ACCIT           TYPE ACCIT.

LOOP AT C_EXTENSION2 INTO L_EXTENSION.

"Here you make sure the BAPI is called by your program

    CHECK L_EXTENSION-STRUCTURE = '........'.

    LOOP AT C_ACCIT INTO L_ACCIT

      WHERE POSNR = L_EXTENSION+30(10).  "Get the item

          L_ACCIT-BSCHL = L_EXTENSION+40(2). "Transfer the posting key

      MODIFY C_ACCIT FROM L_ACCIT.

   ENDLOOP.

ENDLOOP.

You need to use the method CHANGE of BADI ACC_DOCUMENT

Max