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: 

Enhancement framework for Badi

Former Member
0 Kudos

Hi all,

I have created a BAdi as an enhancement assignment.

I am calling this Badi from a module pool porgram where iam passing 2 values corresponding to material(matnr) and plant (werks).

In the Badi method i vaildate whether the plant exists for the material given.

I am getting following error while gonig for consistency check on module pool.

Program ZSRI_TRY

The obligatory parameter "I_MATERIAL" had no value assigned to it.

Program ZSRI_TRY

Incorrect nesting: Before the statement "ENDLOOP", the structure

introduced by "TRY" must be concluded by "ENDTRY" . . . . . . . .

Program ZSRI_TRY

No open "TRY" statement.

Program ZSRI_TRY

Incorrect nesting: Before the end of the program, the structure

introduced by "IF" must be concluded by "ENDIF" . . . . . .

Please help

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Could you post the part of the coding of the module pool where you are calling the BADI?

Regards,

John.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Check the code properly. It appears that there is something wrong with TRY -ENDTRY or IF--ENDIF words.

Regards,

Anji

Former Member
0 Kudos

Hello,

Could you post the part of the coding of the module pool where you are calling the BADI?

Regards,

John.

0 Kudos

Hi John

I am waiting forthe answer.

Former Member
0 Kudos

program ZSRI_TRY.

data: i_material type marc-matnr.

data: i_plant type marc-werks.

data: bd type ref to badi_check.

try.

get badi bd.

call badi bd->Z_GETDATA.

endtry.

0 Kudos

Hello,

The data definition should be:

data: BD TYPE REF TO IF_EX_BADI_CHECK (if your BADI is called BADI_CHECK, which I doubt because custom BADIs should start with Z).

Before you van use any BADI you have to instantiate the object:

data:

zlv_existing type xfeld.

CALL METHOD cl_exithandler=>get_instance

EXPORTING

exit_name = 'BADI_CHECK'

null_instance_accepted = abap_true

IMPORTING

act_imp_existing = zlv_existing

CHANGING

instance = bd.

The call to the method should be: CALL BD->Z_GETDATA

exporting.....

importing....

Regards,

John.