Skip to Content
1

Set EKPO-BSGRU while PO create through BADI/User exit

Jun 19, 2017 at 12:16 PM

206

avatar image
Former Member

Hello Experts,

I a really stuck up with a problem of setting an Advance returns management Field EKPO-BSGRU while PO creation. I want to create a return STO. While creating Return STO manually through ME21N, I need to set the field Return reason (EKPO-BSGRU) to Z** (Example: Z77) when material, quantity and site is given in line item and enter is pressed before save.

I have tried setting this value through BADI 'ME_PROCESS_PO_CUST' and 'MSR_TRC' but these BADIs are not helping me out. Kindly let me know how to fulfill this requirement or I am getting wrong somewhere.

This field is made mandatory from configuration and user requirement is to set this field through ABAP code.

1) When I implemented ME_PROCESS_PO_CUST, process_item method, I am facing below issue.

Standard SAP is not allowing us to change reason code via BADI and message log is returning below information message:

Change reason for order could not be effected.

On further analysis of standard code, I found that standard SAP is checking the field status for BSGRU field.

If it is “-“ which means suppressed, it is overwriting changed value(Z**) with old value (blank) coming from transaction.

2) When I implemented MSR_TRC, GET_DEFAULT method of interface IF_EX_MSR_TRC, the value Z** is replaced with BLANK.

Kindly help, its really urgent for client. Correct answer will be rewarded.

Regards,

Titiksha

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Avik Mazumder Jun 20, 2017 at 04:35 AM
0

Hi Titiksha,

Any update on Advanaced returns management scenario or in general FOR PO header (EKKO)or PO item(EKPO) is interesting case.

We faced similar issue and what you found out deep inside debugging , is the configuration Principle for field selection group inside standard code checking. The '+' / ' -' etc combination.Ans how SAP treats some fields as display only and some as input enabled.

Actually the trick is you should not write any code in this case inside BADI.

Place your business logic- Code inside EXIT only. This should work perfectly fine. We have done it for many requirements.(e.g.Override Returns Item and Confirmation Control for returns order- based om some logic)

SMOD enhancement : MM06E005

Implement EXIT ->EXIT_SAPMM06E_016

Use call stack method: VALUE '(SAPLMEPO)EKPO' inside above exit implementation to assign the PO item reference.

Regards,

Avik

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello Avik,

Could you please elaborate on this a lil more. Using EXIT_SAPMM06E_016, I have modified table TEKPO which is the tables parameter. But it is not updating the field EKPO-BSGRU on screen.

Please help.

Regards,

Titiksha

0

Hi Titiksha,

I assume that you created CMOD project and it is active.Also you should not write code for this same filed inside BADI,otherwise as per SAP design it will overwrite,which you have already faced.

Inside exit try below code.

FIELD-SYMBOLS : <ls_ekpo> TYPE ekpo.

CONSTANTS : lc_field TYPE char20 VALUE '(SAPLMEPO)EKPO'.

ASSIGN (lc_field) TO <ls_ekpo>.

IF <ls_ekpo> IS ASSIGNED.

<ls_ekpo>-bsgru = 'Z7'.

ENDIF.

Regards,

Avik

1

For your assurance,I have tried to emulate the same requirement you have and used my pseudo code above.

It works perfect!!!.

Regards,

Avik

1
Former Member

Hello Avik,

Thanks a lot for your help. That is a correct answer. God bless! :)

Regards,

Titiksha

1
Jürgen L
Jun 19, 2017 at 12:53 PM
0

your information is contradictory

first you said: This field is made mandatory from configuration

and then you said: I found that standard SAP is checking the field status for BSGRU field. If it is “-“ which means suppressed....

How can it be mandatory and suppressed at once?

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello,

Your post from 5th sep 2014 says below. Kindly refer below link.

https://archive.sap.com/discussions/thread/3615306

Field selection combination is ( mandatory + suppressed = suppressed)

In this way, it is finally suppressed. Kindly let me know your thoughts on this.

Regards,

Titiksha

0

Exact that is like it is - suppressed wins over mandatory - hence you must not wonder that your values from the BAdI don't make it to the database.

0