cancel
Showing results for 
Search instead for 
Did you mean: 

Fill Header Text at Delivery creation (VL01N)

Chris_2311
Participant
0 Kudos

hi everybody,

i have the following request:

1. i create an outbound delivery from a sales order with t-code VL01N.

2. in this step, i want to determine a field value the corresponding sales order from vbak

3. i want to fill this value into a new text element at delivery header level

has anyone an idea for that case?

best regards & TIA

christian

Accepted Solutions (0)

Answers (2)

Answers (2)

suman_sardar2
Active Contributor
0 Kudos

Hi Christian,

I want to understand why you want to store Sales order number in the delivery text field as it can be fetched by the VBFA sales document flow table.

What is the need to store it in the delivery text id.

I think it will be extra unnecessary maintenance.

Thanks,

Suman$

Chris_2311
Participant
0 Kudos

Sorry, but i've seen that i've missed a word in my question ...

I want to determine a special value (a Z field in VBAK) from the corresponding sales order.

This value should be stored in a special customized text in the delivery note.

IMPORTANT:

this has to happen at the creation of the delivery note.

sachin_bhonsle
Explorer
0 Kudos

Hi Christian,

One thing you need to be sure of is to ensure that you always create a delivery for a single order.

SAP allows combination of more than one orders into a delivery, in this event it would be difficult at the time of delivery creation to look back and fetch the z-field from VBAK.

If you have always have one order per delivery than USEREXIT_SAVE_DOCUMENT in MV45AFZ1 may serve the purpose. if not then use CMOD exit V02V0002.

You need to find VBELV from VBFA where VBTYP=C (note there could be contract, quotations, etc, further up in the document flow, hence VBTYP=C is very important).

Once you have VBELV, then use in in VBAK-VBELN to fetch the value of the z-field.

Hope this help.

Regards

Sachin

Chris_2311
Participant
0 Kudos

i think we talk at cross-purposes ...

my requirement:

1. i create a sales order.

2. within that sales order, i fill a new customer field in table "vbak", called "vbak-packdata".

3. now i save this sales order.

4. create delivery note in reference to the sales order.

5. within this delivery note, the value of field "vbak-packdata" (from the sales order) should be transfered into a special header text of the delivery note before saving the delivery note.

i hope you understand me?

Jelena
Active Contributor
0 Kudos

I feel we understand you but you don't understand us. The reference between the sales order and delivery is technically at the line item level (look at LIPS-VGBEL/VGPOS fields). As correctly pointed out, a delivery may contain items from several orders (I'm not sure if this process is possible in your organization, but technically that's how it works). So there might not be 1:1 relationship between a sales order and a delivery.

Also - does this have to be a text? What are you planning to do with it?

andrea_brusarestelletti
Active Contributor
0 Kudos

Hello,

  in include MV50AFZ1, USEREXIT_SAVE_DOCUMENT, you can get the Sales Order number from VBFA-VBELV, and call the function CREATE_TEXT to fill the text ID that you need with the dedired value.

Best regards,
Andrea