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: 

Need a BADI for Manipulating Purchase Order Payment Terms?

Former Member
0 Kudos

Anybody know of one? We are on 4.6C....Thank-You.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

**********************************

BAPI bapi_po_change can be used....

There is a documentation available for this BAPI and there is an example (although it is a bit confusing). You need to send the folowing parameters:

Parameter: PURCHASEORDER = <PO number>

Parameter: POHEADER

PMNTTRMS = <payment term value>

Parameter: POHEADERX

PMNTTRMS = X

Declare your structures/tables using the same type as in BAPI - just copy/paste.

***************************************

Regards

vasu

3 REPLIES 3

Former Member
0 Kudos

**********************************

BAPI bapi_po_change can be used....

There is a documentation available for this BAPI and there is an example (although it is a bit confusing). You need to send the folowing parameters:

Parameter: PURCHASEORDER = <PO number>

Parameter: POHEADER

PMNTTRMS = <payment term value>

Parameter: POHEADERX

PMNTTRMS = X

Declare your structures/tables using the same type as in BAPI - just copy/paste.

***************************************

Regards

vasu

Former Member
0 Kudos

Hi TOM,

You can find the BADI your self

Go to Transaction SE24

Enter the Object Type CL_EXITHANDLER and click on Display.

Double Click on method "GET_INSTANCE".

Put a Break-point on

Call method cl_exithandler=>get_class_name_by_interface

Run any Transaction for which you need enhancements.

The execution will stop at the break point. Check the values of variable 'exit_name', it will give you the BADI name called at that time.

This way you will find all the BADIs called on click of any button in any transaction.

Regards

Sudheer

0 Kudos

Hello Sudheer,

This would be great only I do not see "Call method cl_exithandler=>get_class_name_by_interface " to put a break point in the GET_INSTANCE Code....below. Also, I only see one Method in cl_exithandler and it is GET_INSTANCE. I would really like to do what you say but can't figure out where to pit the breakpoint........Thank-You

METHOD get_instance.

CLASS cl_abap_typedescr DEFINITION LOAD.

DATA: exit TYPE REF TO object,

temp TYPE abap_abstypename,

int_ref TYPE REF TO cl_abap_refdescr,

type_ref TYPE REF TO cl_abap_typedescr,

interface TYPE seoitfname,

exit_name TYPE exit_def,

clskey TYPE seoclskey,

mult TYPE seex_boolean,

subrc LIKE sy-subrc,

abs_type_classname TYPE string.

  • The absolte type name of the changing parameter instance

  • is got via dynamic describe

CALL METHOD cl_abap_typedescr=>describe_by_data

EXPORTING

p_data = instance

RECEIVING

p_descr_ref = type_ref.

IF type_ref->type_kind NE type_ref->typekind_oref.

RAISE no_reference.

ENDIF.

CATCH SYSTEM-EXCEPTIONS others = 1.

int_ref ?= type_ref.

ENDCATCH.

IF sy-subrc = 1.

RAISE no_reference.

ENDIF.

CALL METHOD int_ref->get_referenced_type

RECEIVING

p_descr_ref = type_ref.

IF type_ref->type_kind NE type_ref->typekind_intf OR

type_ref->absolute_name NS '\INTERFACE='.

RAISE no_interface_reference.

ENDIF.

  • Get the interface name by the absolute type name

SPLIT type_ref->absolute_name AT '=' INTO temp interface.

  • Get the exit_name for the interface name

SELECT exit_name FROM sxs_inter INTO exit_name

WHERE inter_name = interface.

EXIT.

ENDSELECT.

IF sy-subrc = 4.

RAISE data_incons_in_exit_managem.

ENDIF.

  • Get the name of the exit class

CALL FUNCTION 'SXV_GET_CLIF_BY_NAME'

EXPORTING

name = exit_name

prefix = seex_exit_class_prefix

IMPORTING

clif = clskey-clsname.

CONCATENATE '\CLASS=' clskey-clsname INTO abs_type_classname.

  • Is the given instance initial?

IF NOT instance IS INITIAL.

CALL METHOD cl_abap_typedescr=>describe_by_object_ref

EXPORTING

p_object_ref = instance

RECEIVING

p_descr_ref = type_ref.

CHECK type_ref->absolute_name NE abs_type_classname.

ENDIF.

  • check how many implementations exist for an exit

CALL FUNCTION 'SXC_ACT_IMPS_PER_FLT_VAL'

EXPORTING

exit_name = exit_name

EXCEPTIONS

multiply_active = 1

no_active_implementation = 2

OTHERS = 3.

subrc = sy-subrc.

IF subrc = 1.

  • there are more than one active implementations

  • read the properties of the exit

SELECT SINGLE mltp_use FROM sxs_attr INTO mult

WHERE exit_name = exit_name.

IF sy-subrc = 4.

RAISE data_incons_in_exit_managem.

ELSEIF mult = seex_false. " singular exit

RAISE single_exit_multiply_active.

ENDIF.

ENDIF.

  • act_imp_existing

IF subrc = 2.

act_imp_existing = seex_false.

ELSE.

act_imp_existing = seex_true.

ENDIF.

  • ok, then do your job

CREATE OBJECT exit TYPE (abs_type_classname).

CATCH SYSTEM-EXCEPTIONS move_cast_error = 1.

instance ?= exit.

ENDCATCH.

IF sy-subrc = 1.

RAISE cast_error.

ENDIF.