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 EXIT_SAPLV50E_004 help

Former Member
0 Kudos

Hi All,

I have been given the task to change the country of dispatch for Intrastat purposes depending on certian criteria. I was told to use EXIT:SAPLV50E_004.

Ok so what needs to be done!

1) I have entries in a customizing table that relate to which ekorg this exit applies to and which field should be updated (EIPO-VERLD), - This works fine

2) The function that should be called in SAPMM06E is Z_SET_CTY_OF_DISP_EIPO. - This is also called correctly when a break point is created the se37 in the exit.

3) First the function checks eine to see of there is a value in ZZVERLD (part of an append structure in EINE (field is maintainable in mm01 and mm02). If a value is present this should be used. if not....

4) Then a custom table needs to be checked /WUE/MM_INST_LOC, using the vendor number and ekorg as the key (along side mandant, this is maintainable is SM30). If no value is set then..

5) Do nothing, no intialisation as there could already be a value for EIPO-VERLD and this should then remain...

So I know the function is be called due debugging, what is wrong is the logic within the function.

Please see the code insert.


FORM z_set_cty_of_disp_eipo USING value TYPE any.

    DATA: lw_verld TYPE land1.

    SELECT SINGLE zzverld
    FROM eine
    INTO lw_verld
    WHERE infnr = ekpo-infnr
    AND   ekorg = ekko-ekorg.
    IF sy-subrc = 0 AND NOT lw_verld IS INITIAL.
        MOVE lw_verld TO value.
    ELSEIF sy-subrc = 4.C
        SELECT SINGLE verld
        FROM /WUE/MM_INST_LOC
        INTO lw_verld
        WHERE ekorg = ekko-ekorg
        AND   lifnr = ekko-lifnr.
        IF sy-subrc = 0 AND NOT lw_verld IS INITIAL.
            MOVE lw_verld TO value.
        ENDIF.
    ENDIF.

ENDFORM.              

Ok,

The thing is, is that basically ekko and ekpo are empty, so the code returns a blank lw_verld as the first select ends fine I have to assume that it would just pull the first eine record it comes across, and this record has no ZZVERLD set.

What I really need is how can I get the relivant data that I can then pass to the select statements?

As I test I also checked the contents of eipo and that was also empty.

If I add


    lw_verld = 'GB'
    MOVE lw_verld TO value

To the end of the function

This works and GB is set as the country of dispatch, so it is just access the PO data in the function that I am having a problem with.

If anyone can help that would be super.

Thanking everyone and anyone in advance.

Ian

5 REPLIES 5

former_member404244
Active Contributor
0 Kudos

Hi,

It seems that it might not be correct exit.. Bu then you can give a try using field-symbols getting the data of EKKO and EKPO.. Please search in any other exit is there to fulfill your requirement.

Regards,

Nagaraj

0 Kudos

It was the correct place, just that the way the exit had been coded for other EIPO mod, it calls a function in SAPMM06E.

What i done was in EXIT_SAPLV50E_004, in the include zxv50u04 (not sure if this is company specific or not)

I added the table ekko (ekpo was already there),

I then moved i_purchase_order_header to ekko and i_purchase_order_line_item to ekpo.

then exported these to a memory id

In my function I then imported the memory id once that was done i free'd the ID

This seems to work really well.

I do not know if this is the correct way but it certianly works.

Ian

Former Member
0 Kudos

Hi

The import parameters are I_PURCHASE_ORDER_LINE_ITEM and I_PURCHASE_ORDER_HEADER, but you have used EKKO and EKPO. Use the below code.


FORM z_set_cty_of_disp_eipo USING value TYPE any.
 
    DATA: lw_verld TYPE land1.
 
    SELECT SINGLE zzverld
    FROM eine
    INTO lw_verld
    WHERE infnr = I_PURCHASE_ORDER_LINE_ITEM-infnr
    AND   ekorg =  I_PURCHASE_ORDER_HEADER-ekorg.
    IF sy-subrc = 0 AND NOT lw_verld IS INITIAL.
        MOVE lw_verld TO value.
    ELSEIF sy-subrc = 4.C
        SELECT SINGLE verld
        FROM /WUE/MM_INST_LOC
        INTO lw_verld
        WHERE ekorg = I_PURCHASE_ORDER_HEADER-EKORG
        AND   lifnr = I_PURCHASE_ORDER_HEADER-lifnr.
        IF sy-subrc = 0 AND NOT lw_verld IS INITIAL.
            MOVE lw_verld TO value.
        ENDIF.
    ENDIF.
 
ENDFORM.  

Shiva

Former Member
0 Kudos

When using an exit, consider carefully the interface! What is available to you going into the exit (named in the call) and what will SAP consider when you leave the exit. If it's not named in the interface, you have to develop an alternative way to get the data you need. While assigning field symbols has worked in the past, SAP Labs team members have assured ASUG meetings that this convenient gap in SAP code will eventually be closed. If the data passed back to SAP is named in the interface, you will have an effect on SAP. If not, SAP will simply ignore what you did. Fortunately, a lot of exit modules pass tables, so you can update contents...

0 Kudos

I think I understand what people are saying here.

The first point is that in my function I_PURCHASE_ORDER_LINE_ITEM-infnr is not available to me, it is before my function is called, that is why I have created a memory ID for the data I require.

I think changing the code to pass I_PURCHASE_ORDER_LINE_ITEM etc, could impact on a whole host of functions that are processed in a simliar manner to mine.

Regarding SAP closing the loop holes, in this case I think I should be fine as I am passing back what SAP says should be passed back, as in I_PURCHASE_ORDER_LINE_ITEM and I_PURCHASE_ORDER_HEADER.

Ian