Application Development and Automation 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: 
Read only

Reject a Requisition

Former Member
0 Likes
1,572

Hello,

I need help programatically rejecting a requisition. I know there is no BAPI or FM out there that will accomplish this.

Any help here would be great. Maybe a series of steps that need to be taken through workflow functions, etc? Samples would be greatly appreciated!

Thanks in advance!

EnriqueL

Hello,

I need help programatically rejecting a requisition. I know there is no BAPI or FM out there that will accomplish this.

Any help here would be great. Maybe a series of steps that need to be taken through workflow functions, etc? Samples would be greatly appreciated!

Thanks in advance!

EnriqueL

9 REPLIES 9
Read only

Former Member
0 Likes
1,462

I believe that this is possible using OO ABAP. However, I'm not very good in this area... hoping someone w/ OO knowledge can help out here.

As I understand it the if_releaseable_mm interface which is incorporated by the IF_PURCHASE_REQUISITION object has a REJECT method. I am uncertain however how to fill the IF_PURCHASE_REQUISITION object with an existing requisition so I may subsequently execute the method. Please, any help would be greatly appreciated, deadline looming!

DATA mmpur_yes TYPE c VALUE 'X'.

DATA: l_releasable TYPE REF TO if_releasable_mm.

DATA: l_purch_req TYPE REF TO IF_PURCHASE_REQUISITION.

mmpur_dynamic_cast l_releasable '0010001834'.

IF l_releasable->is_rejection_allowed( ) EQ mmpur_yes.

CALL METHOD l_releasable->reject

EXPORTING

im_reset = ''

EXCEPTIONS

failed = 1.

IF sy-subrc EQ 1.

MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

Read only

0 Likes
1,462

Hi,

I am stuck with the same problem. Did you find the solution then?

Thanks.

Read only

Former Member
0 Likes
1,462

There are two function modules you can use together to update the BANPR field.

ME_UPDATE_REQUISITION

ME_UPDATE_REQUISITION_CHNGDOC

I have checked, and they are not simply DB updates. They work well for what I needed them for -> rejecting a purchase requisition.

Hope this helps!

Read only

Former Member
0 Likes
1,462

hi Enrique Leon,

World is small!!!

I also need same functionality.

Could just help me in doing this ?

Which way u adopted?

using oops concept or using those two Function Modules.

Could just give me the sample code...........

It would be great favor.

Best Regards,

Vinod.

Read only

Former Member
0 Likes
1,462

Hi,

I have the same problem, I hope they find a solution and distributed in the post.

Sincerely,

JM

Read only

0 Likes
1,462

This is the code that implements MF.

Regards,

JM

FUNCTION zmfmm_requisition_reject .

*"----


""Interfase local

*" IMPORTING

*" VALUE(NUMBER) TYPE BAPI2009OB-PREQ_NO

*" VALUE(REL_CODE) TYPE BAPIMMPARA-REL_CODE

*" VALUE(ITEM) TYPE BAPI2009OB-PREQ_ITEM

*" TABLES

*" MESSAGE_LINES STRUCTURE SWR_MESSAG OPTIONAL

*" MESSAGE_STRUCT STRUCTURE SWR_MSTRUC OPTIONAL

*"----


DATA: container LIKE TABLE OF swr_cont WITH HEADER LINE,

xeban LIKE TABLE OF ueban WITH HEADER LINE,

xebkn LIKE TABLE OF uebkn WITH HEADER LINE,

yeban LIKE TABLE OF ueban WITH HEADER LINE,

yebkn LIKE TABLE OF uebkn WITH HEADER LINE,

object_key TYPE swr_struct-object_key,

item_numc TYPE numc05.

SELECT *

INTO CORRESPONDING FIELDS OF TABLE xeban

FROM eban

WHERE banfn = number

AND bnfpo = item.

SELECT *

INTO CORRESPONDING FIELDS OF TABLE xebkn

FROM ebkn

WHERE banfn = number

AND bnfpo = item.

yeban[] = xeban[].

yebkn[] = xebkn[].

READ TABLE xeban INDEX 1.

xeban-kz = 'U'.

xeban-banpr = '08'.

MODIFY xeban INDEX 1.

CALL FUNCTION 'ME_UPDATE_REQUISITION'

TABLES

xeban = xeban

xebkn = xebkn

yeban = yeban

yebkn = yebkn.

CALL FUNCTION 'ME_UPDATE_REQUISITION_CHNGDOC'

TABLES

xeban = xeban

xebkn = xebkn

yeban = yeban

yebkn = yebkn.

container-element = 'RELEASECODE'.

container-value = REL_CODE.

APPEND container.

item_numc = item.

CONCATENATE number item_numc INTO object_key.

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

object_type = 'BUS2009'

object_key = object_key

event = 'REJECTED'

TABLES

input_container = container

message_lines = message_lines

message_struct = message_struct.

ENDFUNCTION.

Read only

0 Likes
1,462

Hi Jhonny,

First of all I'd like to thank you for the code you've posted.

I've done what you said and the reject of the PR worked perfectly. But now i am having the following problem:

when i run the FM that i developed with your sample code, even if the PR is already released, it becomes rejected.

I'd like to know if is there a way to verify if the PR can be rejected.

Thanks,

Fabio

Read only

0 Likes
1,462

Hi Jhonny,

Thanks to your post it works in SAP ECC 6.0 .

Rgds,

Christophe

Read only

Former Member
0 Likes
1,462

hi Jhonny Muñoz ,

Many thanks for the code.

Sweet n simple solution.

Best Regards,

Vinod.