‎2013 Sep 30 4:10 PM
Hello guys.
Inside a method can not use Perform(message error) . Should I replace a method>
How I will create a method ? How I will call it?
I am in IF_EX_ME_HOLD_PO~IS_ALLOWED.
See attached.
Thanks.
‎2013 Sep 30 4:15 PM
Hi,
It seems that you have BAdI implementation class. Just create required method in class and in place of perform call. your new method should have logic of PERFORM and have required signature for data input/output.
Regards,
Chandra
‎2013 Sep 30 4:15 PM
Hi,
It seems that you have BAdI implementation class. Just create required method in class and in place of perform call. your new method should have logic of PERFORM and have required signature for data input/output.
Regards,
Chandra
‎2013 Sep 30 4:27 PM
‎2013 Sep 30 4:46 PM
Mentioned below is an example of how to do this in a local class defined in a report program. If you are using a BADI then just define the new method in class which is created in BADI implementation as mentioned by chandra.
Way of calling the method new method from IF_EX_ME_HOLD_PO~IS_ALLOWED is same as shown below for METHOD m2.
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS: m1 IMPORTING p1 TYPE string
p2 TYPE I
EXPORTING p3 TYPE d
p4 TYPE f
EXCEPTIONS ex1
ex2,
m2.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD m1.
...
ENDMETHOD.
METHOD m2.
DATA: text TYPE string,
number TYPE i,
date TYPE d,
amount TYPE f.
...
m1( EXPORTING p1 = text
p2 = number
IMPORTING p3 = date
p4 = amount
EXCEPTIONS ex1 = 10
ex2 = 20
OTHERS = 30 ).
CASE sy-subrc.
WHEN 10.
...
WHEN 20.
...
WHEN 30.
...
ENDCASE.
ENDMETHOD.
ENDCLASS.
‎2013 Sep 30 5:09 PM
Hi I create the method valida past and i use call method.
IF t_ekko-bsart = 'PEST'.
CALL METHOD valida_pest.
* PERFORM f_valida_pest.
EXIT.
ENDIF.
will it go work?
Its correct.?
Thanks for help.
‎2013 Sep 30 5:31 PM
Hi Ronaldo,
You can create a method valida_pest in the BADI implementation class with required import/ export parameters (You can get the Implementing class name in the header details of the BADI imlementation).
And then you can try to call this method inside the BADI method IF_EX_ME_HOLD_PO~IS_ALLOWED by calling me->valida_pest(). To get exact syntax use pattern option in editor.
If you need to store any global data make sure you declare attributes in the same class and then store the data in the attributes.
Thanks,
Ajay
‎2013 Oct 07 5:16 PM