Copying Sales Orders line to make new orders

johndanter

johndanter

Legendary Poster
Does anyone know of a good way of copying / splitting Sales Orders?

My client here may have an order with mixed line types and therefore certain line types need to be created on a brand new SO

When I'm splitting them they will be in the EDI tables, F47011 F47012, so its a little simpler I hope.

I'm hoping to do this before calling R47011

Does anyone know of a way of doing this please?
Perhaps a skeleton C function that I can dump the file structure into, maybe?

Ta

John
 
John,
Why reinvent the wheel?
There is a UBE (R47011 if I remember correctly) that does it for you. Just copy the records in F47011/2, then launch the UBE.
 
Hi Adrian,

I'm not sure if I've misunderstood you or not but I want to split an existing F47011/12 record into possibly 2 new orders.

I'm trying doing all this before I call the R47011 by 'washing' the inbound data and splitting it up if certain things are met.
 
I guess it is I who misunderstood you, John, and not the other way around
blush.gif

Please clarify where your problem is; splitting and washing may not apply
grin.gif

a) Let's say you get inbound one record.
b) Using the Next Numbers, you get One Sales Order (say number 345) with One Line (say Line 1.000).
c) Next, you insert one set (one record in F47011 and another one in F47012).
Now please continue with your scenario, and please keep using the "Insert" and "Record" terms
wink.gif
 
Thanks Adrian,

What I was trying to do was this:
Inbound EDI SO Order number 1000 with 3 lines
line 1 = line type 'normal'
line 2 = line type 'special'
line 3 = line type 'special'

Will become this:
For each line type 'special' create a new order for each.
So I'll end up with this (Order 1000 with 3 lines becomes 3 orders as follows)
Order 1000. line 1 = line type 'normal'
Order 1001. line 1 = line type 'special' (new order)
Order 1002. line 1 = line type 'special' (new order)

Pain in the butt this, but I've found a BSFN which copies an existing record and creates a new one (B4301440) So I'll copy this and change the file pointers/structures to my F47011/12 files.

I was hoping somebody knew of another way of making new orders from an existing order line, or had a BSFN to do this.

thanks

John
 
I'm just talking data here, but from the sound of it, when you have a line type special, you need to create a new order number and make that line 1. If that's the case, can you try creating a batch job that looks for records in the tables that does the following?

1) Grab the next order number from the next number table.
2) Copy the F47011 record (using a structure, variables, whatever), change the variable for DOCO to the new order number grabbed in (1), and insert that into the F47011.
3) Update the matching record in the F47012 and change the DOCO to the same grabbed in (1) and set the LNID to 1

Maybe I'm oversimplifying, but it sounds like this is all you need to do. The code should be pretty basic to write, and the data selection could work on a business view that's just a join of the F47011/12 where the line type is the special one you mentioned.
 
Thanks Gary
smile.gif

Actually, that is what I have done now anyway. I didn't fancy the long winded UBE variable mapping solution, so I wrote a C+ function to copy the structure from one to another and then amend the EDOC and job done.
(I'll then use this again for other files)

I was just hoping someone else may have had a similar function already as my C isn't the best most of the time

Thanks

John
 
Thank you both for the update
cool.gif

PS JDE List is popular because there are JDE Listers like you, who not only ask interesting questions and give useful answers, but close the posts with selected solutions.
 
Buenas tardes amigos.
Requiero copiar una orden desde el R47011 y que conserve los precios y descuentos (F4074) de la orden original, aunque asocio la orden original (OORN) aplica el precio actual y no el precio de la orden original. si le envio los precios desde la F47012 no realiza registros en la F4074 aunque si mantiene el precio original.

Hay alguna opcion para conservar las caracteristicas de la orden original y que duplique tambien los regsitros en la F4074 de la orden original para la orden nueva?

Gracias por su aporte
 
Back
Top