Copying Sales Order Line Item Text to Delivery Header Text

Scenario

A customer places a large export order, the majority of the items will ship via Ocean Freight, but one item is required ASAP and needs to go Air Freight.  The item going air freight is sometimes a drop ship to their customer.  Customer service needs to communicate special packing and handling instructions for this single item to the warehouse.  The packing and handling instructions on the delivery are at the header level and print on output.

Issue

Using standard SAP Text control it is not possible to copy from Sales Order line item text Delivery Header text.  It is technically possible to set up an Access Sequence that references the Text Object VBBP for the sales order line item, but doing so does not result in the text being copied to the delivery header.

Solution

A custom data transfer routine can be assigned within the access sequence, as shown below.

The Data Transfer Requirement needs to be developed using the VOFM transaction and the Data transfer –> Texts option.

I have included some basic sample code.  Some additional consideration could be given around what to do if both header and line item text exist and if multiple line items have text.

FORM DATEN_KOPIEREN_90 .
****************************************************
* Ability to add Sales Order Line
* Item Text to the delivery header.
****************************************************
DATA: lv_stxh like stxh.
FIELD-SYMBOLS : <likp>.
FIELD-SYMBOLS: <t_lips> TYPE ANY TABLE,
<lips> TYPE lips.
DATA: lv_fldnHdr(30) VALUE ‘(SAPMV50A)likp’.
DATA: lv_fldnLn(30) VALUE ‘(SAPMV50A)xlips[]’. “Table for lips
DATA: lv_likp LIKE likp.
DATA: lt_lips TYPE STANDARD TABLE OF lips.

ASSIGN (lv_fldnHdr) TO <likp>.
Assign (lv_fldnLn) TO <t_lips>.

*Loop through delivery lines and see if any of the order lines
*had Text assigned. If they did then use for the
*header text. First line found with text wins.
IF <t_lips> IS ASSIGNED.
lt_lips = <t_lips>.
LOOP AT lt_lips ASSIGNING <lips>.
CONCATENATE <lips>-vgbel <lips>-vgpos INTO lv_stxh-tdname.
select single * into lv_stxh from stxh
where TDOBJECT = ‘VBBP’
and TDNAME = lv_stxh-tdname
and TDID = xttxvr-id_von.
IF lv_stxh-tdid IS NOT INITIAL.
“the text exists. create reference.
referenz-tdid = lv_stxh-tdid.
referenz-tdobject = lv_stxh-tdobject.
referenz-tdname = lv_stxh-tdname.
EXIT. “End Loop
ENDIF.
ENDLOOP.
ENDIF.

ENDFORM.

Leave a Reply