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: 

user exit MM06E001 and debug

Former Member
0 Kudos

Hi all,

I use user exit EXIT_SAPLEINM_011 (enhancement: MM06E001) to modify the outbound purchase order IDoc (ORDERS).


data: wa_e1edka1 type e1edka1,
      wa_idoc_data type edidd,
      segNo like edidd-SEGNUM.


  LOOP AT dINT_EDIDD into wa_idoc_data.
    CASE wa_idoc_data-SEGNAM.
      WHEN 'E1EDKA1'.
         MOVE wa_idoc_data-SDATA TO wa_e1edka1.
         if wa_e1edka1-PARVW = 'WE'.
           exit.          .
         endif.
    ENDCASE.
  ENDLOOP.

wa_e1edka1-LIFNR = '1225'.
move wa_e1edka1 to wa_idoc_data-sdata.
modify table dint_edidd from wa_idoc_data.

The above code is used to set the E1EDKA1-LIFNR (vendor number) as '1225' when E1EDKA1-PARVW ='WE' (partner function). But it dosen't work.

Question 1:

What's wrong with my code? I don't have much ABAP experience, please correct me if there is some errors.

Question 2:

How to debug user exit? I use

break-point.

break uerid.

or set breakpoint in the code.

None of them works.

Could anyone give some ideas?

Thanks!

Regards,

Hui

3 REPLIES 3

Former Member
0 Kudos

Hi,

User this code. The only issue with your code that you were updating the idoc data (dint_edidd) outside out loop which you should do inside the loop.

Also, for updating data, i have written two different sets of code. USE ANY ONE OF THEM

*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
DATA: wa_e1edka1 TYPE e1edka1,
      wa_idoc_data TYPE edidd,
      segno LIKE edidd-segnum.

*" Loop at idoc record
LOOP AT dint_edidd INTO wa_idoc_data.
*" check  E1EDKA1
  CASE wa_idoc_data-segnam.
    WHEN 'E1EDKA1'.
*"    move the idoc data    
      MOVE wa_idoc_data-sdata TO wa_e1edka1.
*"    check if partner type is 'WE'
      IF wa_e1edka1-parvw = 'WE'.
*"      update partner number
        wa_e1edka1-lifnr = '1225'.
        MOVE wa_e1edka1 TO wa_idoc_data-sdata.
*"      modify idoc data        
        MODIFY TABLE dint_edidd FROM wa_idoc_data.
        EXIT.          .
      ENDIF.
  ENDCASE.
ENDLOOP.

*"OR user this code
*"-----------------

*" Loop at idoc record where segment is E1EDKA1
LOOP AT dint_edidd INTO wa_idoc_data WHERE segnam = 'E1EDKA1'.
*"move the idoc data
  MOVE wa_idoc_data-sdata TO wa_e1edka1.
*"check if partner type is 'WE'   
  IF wa_e1edka1-parvw = 'WE'.
*"  update partner number  
    wa_e1edka1-lifnr = '1225'.
    MOVE wa_e1edka1 TO wa_idoc_data-sdata.
*"  modify idoc data    
    MODIFY TABLE dint_edidd FROM wa_idoc_data.
    EXIT.          .
  ENDIF.
ENDLOOP.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*

The debugger is not stopping at your break point because this exit triggers in update task. During V2 update. To debug this code you <b>have to turn on "update debuggin"</b>.

<b>Regarding debuggin the code</b> in update task follow this steps.

- Go to ME21N / ME22N and create / change the PO

- Hit the "message" button and go to the screen where you select your output type and add new output for IDOC output.

- Before saving the data, turn on the debuggin using <b>'/h'</b> command

- Now save the document.

- Once you are in debugger, <b>go to tab "Settings".</b> In debuggin you will see this tab. This is in the same line as "Field", "table", "BreakPoint" etc. "Setting" is last tab.

- In "Setting" tab, <b>select the box 'Update debugging'</b>. Hit 'save' button to save the setting.

- Now hit 'F8 ( execute)'. This will open one more session, which is update debugging.

- Once you are in update debuggin you can put a break point with menu "<b>Breakpoint --> Breakpoint at --> Function module</b> and enter the function module name <b>EXIT_SAPLEINM_011</b>. Hit 'Save' button to save your settings.

- Now hit 'F8 ( execute)' and the debugger will stop in this exit.

Let me know if you still have a issue in your code or in debugging.

Regards,

RS

0 Kudos

thanks again RS,

I have awared you some points. i will try it tommorow. today it's too late for me.

0 Kudos

Hi Rs,

I tried your code, but it still dosen't work. Then I followed your way to debug (this was ok), I found

wa_idoc_data

was changed exactlly, but after

MODIFY TABLE dint_edidd FROM wa_idoc_data

The table

dint_edidd 

was not updated.

I guess the reason may be that the data type of the sdata in table dint_edidd is "LCHR", which requires special processing. Do you know this problem?

Thanks!

Regards,

Hui