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: 

Help with User-Exit.

Former Member
0 Kudos

Hi Folks!

I'm kind of new in the area of developing enhancements such as a User Exit. What i'm trying to do is to control that some document clases cannot contain certain account assignment category, especifically the 'T'. The user exit i'm using is EXIT_SAPLMEREQ_008, this is called before a process called post.

The code is the following:

<i>DATA: lt_req_items TYPE mmpur_requisition_items,

ls_req_items LIKE LINE OF lt_req_items.

DATA: TABLA TYPE MMPUR_REQUISITION_ITEMS.

DATA: ZMEREQ_ITEM like MEREQ_ITEM.

DATA: IDMEN(5).

DATA: LINEA TYPE UEBAN.

DATA TABLA2 LIKE MEREQ_ITEM-BNFPO OCCURS 0.

Call method IM_REQ_HEADER->GET_ITEMS

receiving RE_ITEMS = TABLA.

  • CALL METHOD IM_REQ_HEADER->LOOKUP

  • RECEIVING IM_BNFPO = TABLA2.

IMPORT ZMEREQ_ITEM FROM MEMORY ID 'ZM'.

  • LOOP AT TABLA INTO ls_req_items.

  • ls_req_items->ITEM-IM_DATA = ZMEREQ_ITEM.

  • ENDLOOP.

<b>* MODIFICACION REALIZADA POR GLI 27-07-2006 ******

  • Valida que los documentos indicados por el req

  • MM-SOLP-001 no tengan tipo de imputacion T.</b>

LOOP AT IM_EBAN_CHANGES INTO LINEA.

if ( LINEA-BSART = 'G021' or ( LINEA-BSART between 'G201' and 'G219' )

OR LINEA-BSART = 'G660' ) and LINEA-KNTTP = 'T'.

MESSAGE ID 'ZM' TYPE 'E' NUMBER '002'.

endif.

IDMEN = LINEA-BNFPO .

IMPORT ZMEREQ_ITEM FROM MEMORY ID IDMEN.

LINEA-ZZAVANR1 = ZMEREQ_ITEM-ZZAVANR1 .

LINEA-ZZNETWR1 = ZMEREQ_ITEM-ZZNETWR1 .

LINEA-ZZAVANR2 = ZMEREQ_ITEM-ZZAVANR2 .

LINEA-ZZNETWR2 = ZMEREQ_ITEM-ZZNETWR2 .

LINEA-ZZAVANR3 = ZMEREQ_ITEM-ZZAVANR3 .

LINEA-ZZNETWR3 = ZMEREQ_ITEM-ZZNETWR3 .

  • MODIFY IM_EBAN_CHANGES-ZZNETWR3 FROM LINEA-ZZNETWR3.

ENDLOOP.</i>

The problems are:

1. Strangely when I debug this code, the debugger checks the comments. It goes through it, don't really get this behavior.

2. When it gets in:

LOOP AT IM_EBAN_CHANGES INTO LINEA.

It executes like the 3 lines then stops, and it exits and don't execute the message, nor the following code when the if statement is false:

IDMEN = LINEA-BNFPO .

IMPORT ZMEREQ_ITEM FROM MEMORY ID IDMEN.

LINEA-ZZAVANR1 = ZMEREQ_ITEM-ZZAVANR1 .

LINEA-ZZNETWR1 = ZMEREQ_ITEM-ZZNETWR1 .

LINEA-ZZAVANR2 = ZMEREQ_ITEM-ZZAVANR2 .

LINEA-ZZNETWR2 = ZMEREQ_ITEM-ZZNETWR2 .

LINEA-ZZAVANR3 = ZMEREQ_ITEM-ZZAVANR3 .

LINEA-ZZNETWR3 = ZMEREQ_ITEM-ZZNETWR3 .

My questions are:

1. Are there any lines limit for an user-exit, because this behavior is pretty strange for me.

2. Why does this user-exit executes comments? (Just in case, the comments are fine)

I will appreciate your help.

Thanks.

Best Regards,

Gilberto Li

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

It appears that it is running an older version of the code, please make sure that the include program in your user exit is "Active".

REgards,

Rich Heilman

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

It appears that it is running an older version of the code, please make sure that the include program in your user exit is "Active".

REgards,

Rich Heilman

Former Member
0 Kudos

Thanks Reich.

That wasn't the real problem, just didn't knew I had to reinitialize the transaction so he can update the changes made in the user exit. You just gave me an idea of what was going on.

Thanks, that solved.