cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member386063
Participant

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member365886
Contributor
0 Kudos

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

former_member386063
Participant
0 Kudos

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

former_member365886
Contributor

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

former_member365886
Contributor

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

It works perfect!!!.

Regards,

Avik

former_member386063
Participant

Hello Avik,

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

Regards,

Titiksha

Answers (1)

Answers (1)

JL23
Active Contributor
0 Kudos

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?

former_member386063
Participant
0 Kudos

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

JL23
Active Contributor
0 Kudos

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.