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 needed while creation/change in Shipment

Former Member
0 Kudos


Hello All,

I need to trigger output type for sales order at end of PGI for all the deliveries.

Say i've attached 80 deliveries to a shipment. After PGI i need to trigger output type to the corresponding sales order of the deliveres assigned.

I've checked few exists but they get triggered for every delivery. I need an exit which triggers after PGI so that i can trigger output types all at once.

Reason not going to trigger output type at each delivery is, i need to lock the objects before NAST update which is causing locking issues.

Please guide me if anyone is aware of this.

Thanks,

K Prabhu Kiran

20 REPLIES 20

Former Member
0 Kudos

did u try the BADI: LE_SHP_GOODSMOVEMENT ?

Also see: LE_SHP_DELIVERY_PROC

0 Kudos

Hello Maju,

LE_SHIP_GOODSMOVEMENT/LE_SHP_DELIVERY_PROC gets triggered just by saving (Without checking the shipment start and end i.e PGI) .

And this BADI gets triggered when reversing throu VL09 Also..


0 Kudos


Hey Manju,

Both these BADI's gets triggered while saving the Shipment but without clicking on shipment start and shipment ends.(ie. PGI).

And also while reversing these get Triggered.

0 Kudos

Hi Prabhu,

I gave those BADI names without fully understanding your requirement. Sorry for that..As you have found out, the BADIs get triggered after each delivery changes to PGI.

However to accomplish your requirement, proceed as per Eduardo/Nabheet comments.

br,

Maju

Former Member
0 Kudos

Hi

You can try DELIVERY_PUBLISH.

0 Kudos


Hello Chamo Chamo,

Delivery_publish also get triggered while doing Reverse goods movement (VL09).

Thank you,

K Prabhu Kiran

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

If you are calling the output in VT02N, maybe you can use the BADI  (see SAP Note 617793 - Documentation on Business Add-In BADI_LE_SHIPMENT). I'd do a function module, called with the option IN UPDATE TASK, and inside I'd call SD70AV1A with a job (with 1 or 2 seconds) with OPEN_JOB, SUBMIT_JOB, CLOSE_JOB and so on). See SAP Note 960611 - FAQ: Output control in Sales and Distribution, question 2.

Other possibility, but I dislike it. Inside a customer VOFM, call the same function module, in the procedure for the output type. In table LIPS you will have the SO. See recommendations in Note 185530 - Performance: Customer developments in SD.

I hope this helps you

Regards

Eduardo

Message was edited by: Eduardo Hinojosa PD: Maybe, you could call it with the SUBMIT inside the smartform for delivery. In global settings / initiailization.

0 Kudos


Hello Edurado,

BADI_LE_SHIPMENT - at_save/before_update/in_update gets triggered before doing PGI itself.

Goto VT02N and without clicking on shipment start and end(PGI) do some changes and try to save.

Thanks,

K Prabhu Kiran

Former Member
0 Kudos

There are many ways to find exits.  Search for that and you get a huge number of links.

Here is my document showing code to find exits:

It code that I worked on in other forums and those who helped are documented.

Neal

0 Kudos

Hello Neal,

Thanks alot! It's useful stuff

Regards,

k Prabhu Kiran

nabheetscn
Active Contributor
0 Kudos

In addition to what Eduardo mentioned you can also call the wrapper FM as a background task. It will be a TRFC call with all locks on orders/deliveries etc released.  You can than update your NAST fm inside it

Nabheet

0 Kudos

Hello Edurado/Nabheet

I have found an exit(which is called while doing the PGI, if PGI is already done to the deliveries then this exist doesn't trigger which is perfect forme) where i can update the NAST table.

But the issue im facing here, PGI process locks the sales order to update some tables. So when im trying to lock this again, it gives me a foreign lock which im aware. So i've uncommented that code. Here im not able to update the NAST table . Because the sales order is locked by some some other transaction(PGI).

Question here is, sales order is already locked in my name, still why am i not able to update this?? Please help

0 Kudos

Hi Prabhu

Since you are inside the delivery the SO is locked and you can not modify it via programming stuff. What you can do in this case is create a Z FM RFC enalbled. Inside it have all your custom code. Call this ZFM as background task. So what will happen when data will get saved this FM will be called when locks on delivery/So will get released and it will update what you want to

Nabheet

0 Kudos

Hello Nabheet,

Thank you for the information. I've tried the same way yest, created a FM and called in background task. Here the issue im facing is since i have 80 deliveries assigned to the shipment.

On my first PGI, it calls the exit and FM runs in background.

Now during PGI, when it tries to lock the sales order. Diz FM which is called in background task locks the sales order causing in shipment creation fauileres

0 Kudos

Hi Prabhu

Can you please explain your requirement what exactly you are trying to achieve in detail looks like something is missing.

Nabheet

0 Kudos

Hello Nabheet,

When ever PGI is done for deliveries we need to trigger an output type to the corresponding sales order. This is the bussiness requirement.

0 Kudos

So this Z FM will be called after everyhting in processed since its called via TRFC and all locks will be released.. Then you can call the NAST fm what error you face..?  How did you found this error

Nabheet

Former Member
0 Kudos

See the exit i placed this code triggers for each delivery.

Now in my case i have 80 deliveries and all have the same sales order.

      SELECT SINGLE *
      FROM vbfa
      INTO xvbfa
      WHERE vbeln = fvbuk-vbeln
      AND vbtyp_v = 'C'.

      i_docnum = xvbfa-vbelv.

      IF sy-subrc = 0.
        CALL FUNCTION 'ZSDE0068_TRIGGER_SO_OP' IN BACKGROUND TASK
          EXPORTING
            i_doctyp       = 'V1'
            i_docnum       = i_docnum
            i_kschl        = 'ZMOS'
            i_nacha        = '6'.
       ENDIF.

So for 1st dcelivery - it hits the FM, it runs in background and works fine

.

.

.

randomly around 30th when the standard is trying to lock the sales order, 29th one has locked the sales order to process it tasks. So like this when im processing 80 deliveries i;m getting an error for 3-5 deliveres saying object is locked by ***(sy-uname).

this is the issue im facing. Itz not happening below 30 deliveres.

If there are more than 30 deliveries, in one shot im not able to proceess all of them

0 Kudos

Yeah now got the issue.. Can we somehow identify when will be the last delivery so that we call this FM only once...which will change stuff in loop.

0 Kudos


Yes exactly! So datz yy i was looking for exit/bADi which will be triggered ONLY once after the DB updates of PGI.