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: 

Add Custom Fields to Shipment Processing (VT01N-VT03N)

kyle_mccarter
Participant
0 Kudos

We have a requirement to add 10 new fields to the shipment processing transactions (VT01N, VT02N, & VT03N). They will all be header level attributes that will be included as part of table VTTK. It appears SMOD enhancement MV56AINI (function module exit EXIT_SAPMV56A_004) may be the only way that SAP has provided for this kind of enhancement to the shipment maintenance transactions.

I have reviewed the suggested approach supplied via our community pages (https://answers.sap.com/questions/2695020/vt01-extension---add-custom-fields.html), and do not have a clear understanding of how best to proceed. It seems as though the solution outlined is missing some critical details. Can anyone provide a link to more detailed information with regards to how to implement MV56AINI?

Kind Regards

1 ACCEPTED SOLUTION

kyle_mccarter
Participant

Hello Bert and all... I am sorry I failed to see your question earlier. There is a lot to my solution, and I am omitting a fair amount for the sake of brevity. What I am providing below is what I feel to be minimally required in order to create a viable enhancement. If you have additional questions, please feel free to inquire, and I will do my best to get back to you as quickly as possible.

First I created a function group (example - ZCUSTOM_FG) to hold my custom screen, as well as the flow logic. Here I also maintained a GUI status and Title for my custom screen. Additionally, I created a copy of the title and status (TRA_OVERVIEW and TRA_MAIN) from SAPMV56 1020. The copy of TRA_MAIN was necessary so that I could add a custom push button (and function code) to the 'Application Toolbar'. This push button will appear on the Shipment Document Overview screen. The reason for a copy of the title was to add an additional text so the user knows they are seeing an enhanced version of the SAP delivered overview screen.

Next in SAP customer-exit 'EXIT_SAPMV56A_004' (Include ZXV56U40) I did two things...

1) Re-point Overview Screen to Enhanced GUI Status / Title

READ table C_CUA_CONTROL

assigning field-symbol(<ZCUA>)

with key PROGRNAME = 'SAPMV56A'

DYNPRO = '1020'

TRTYP = '*'.

if sy-subrc = 0.

<ZCUA>-STATPROG = 'SAPLZCUSTOM_FG'.

<ZCUA>-STATUS = 'TRA_MAIN'.

<ZCUA>-TITLE = 'TRA_OVERVIEW'.

unassign <ZCUA>.

"Add my copy of SAP's title, and GUI status, along with my screen #

clear LS_CUA_CONTROL.

LS_CUA_CONTROL-PROGNAME = 'SAPMV56A'.

LS_CUA_CONTROL-DYNPRO = '9000'.

LS_CUA_CONTROL-TRTYP = '*'.

LS_CUA_CONTROL-KOPGR = 'T'.

LS_CUA_CONTROL-STATPROG = 'SAPLZCUSTOM_FG'.

LS_CUA_CONTROL-STATUS = 'STATUS_9000'.

LS_CUA_CONTROL-TITLE = 'TITLE_9000'.

read table C_CUA_CONTROL

with key PROGNAME = LS_CUA_CONTROL-PROGNAME

DYNPRO = LS_CUA_CONTROL-DYNPRO

TRTYP = LS_CUA_CONTROL-TRTYP

KOPGR = LS_CUA_CONTROL-KOPGR

transporting no fields.

if SY-SUBRC = 4.

insert LS_CUA_CONTROL into C_CUA_CONTROL index SY-TABIX.

elseif SY-SUBRC = 8.

append LS_CUA_CONTROL to C_CUA_CONTROL.

endif.

endif.

2) "Add call to subroutine 'ZCUSTOM_ROUTINE' when function code ZCUSTOM_FCODE is triggered. This FORM 'ZCUSTOM_ROUTINE'... ENDFORM subroutine will contain the logic that calls my custom screen from SAP include user-exit MV56AFZY.

clear LS_TA_CONTROL.

move:

'SAPMV56A' to LS_TA_CONTROL-PROGNAME, "Current Program

'1020' to LS_TA_CONTROL-DYNPRO, "Current Screen

'*' to LS_TA_CONTROL-TRTYP, "Current Transaction Type

'T' to LS_TA_CONTROL-KOPGR, "Screen Sequence Header Group

'ZCUSTOM_FCODE' to LS_TA_CONTROL-FCODE, "Current Function Code

'F' to LS_TA_CONTROL-CALL_MODE, "Call Mode - F = Process form routine with subsequent F-code

'SAPMV56A' to LS_TA_CONTROL-NEXT_PROGNAME, "Next Program

' ' to LS_TA_CONTROL-NEXT_DYNPRO, "Next Screen

'ZCUSTOM_ROUTINE' to LS_TA_CONTROL-NEXT_FORM, "Subroutine to be called in Include 'MV56AFZY'

'MM_RSTR' to LS_TA_CONTROL-NEXT_FCODE. "Next Function Code

insert LS_TA_CONTROL into table C_TA_CONTROL.

Regarding FORM ZCUSTOM_ROUTINE:

I use the value of T180-TRTYP to determine the mode I call my screen (create/update/display). The function I created that ultimately calls my custom screen and flow logic passes back resulting changes made by the user. My solution updates extended fields of the shipment header (VTTK). So I need to decide whether any changes were made for those fields. If yes, then I update SAP internal tables XVTTK and YVTTK (new and old entries) accordingly.

3. Finally, I implemented BADI_LE_SHIPMENT for some specific requirements we had prior to saving the shipment to the database.

I hope this is helpful for you or others.

Be well... KM

7 REPLIES 7

brilflink
Discoverer
0 Kudos

Hey Kyle,

Did you figure out how to achieve this? I have a similar request.

Thanks,

Bert

kyle_mccarter
Participant

Hello Bert and all... I am sorry I failed to see your question earlier. There is a lot to my solution, and I am omitting a fair amount for the sake of brevity. What I am providing below is what I feel to be minimally required in order to create a viable enhancement. If you have additional questions, please feel free to inquire, and I will do my best to get back to you as quickly as possible.

First I created a function group (example - ZCUSTOM_FG) to hold my custom screen, as well as the flow logic. Here I also maintained a GUI status and Title for my custom screen. Additionally, I created a copy of the title and status (TRA_OVERVIEW and TRA_MAIN) from SAPMV56 1020. The copy of TRA_MAIN was necessary so that I could add a custom push button (and function code) to the 'Application Toolbar'. This push button will appear on the Shipment Document Overview screen. The reason for a copy of the title was to add an additional text so the user knows they are seeing an enhanced version of the SAP delivered overview screen.

Next in SAP customer-exit 'EXIT_SAPMV56A_004' (Include ZXV56U40) I did two things...

1) Re-point Overview Screen to Enhanced GUI Status / Title

READ table C_CUA_CONTROL

assigning field-symbol(<ZCUA>)

with key PROGRNAME = 'SAPMV56A'

DYNPRO = '1020'

TRTYP = '*'.

if sy-subrc = 0.

<ZCUA>-STATPROG = 'SAPLZCUSTOM_FG'.

<ZCUA>-STATUS = 'TRA_MAIN'.

<ZCUA>-TITLE = 'TRA_OVERVIEW'.

unassign <ZCUA>.

"Add my copy of SAP's title, and GUI status, along with my screen #

clear LS_CUA_CONTROL.

LS_CUA_CONTROL-PROGNAME = 'SAPMV56A'.

LS_CUA_CONTROL-DYNPRO = '9000'.

LS_CUA_CONTROL-TRTYP = '*'.

LS_CUA_CONTROL-KOPGR = 'T'.

LS_CUA_CONTROL-STATPROG = 'SAPLZCUSTOM_FG'.

LS_CUA_CONTROL-STATUS = 'STATUS_9000'.

LS_CUA_CONTROL-TITLE = 'TITLE_9000'.

read table C_CUA_CONTROL

with key PROGNAME = LS_CUA_CONTROL-PROGNAME

DYNPRO = LS_CUA_CONTROL-DYNPRO

TRTYP = LS_CUA_CONTROL-TRTYP

KOPGR = LS_CUA_CONTROL-KOPGR

transporting no fields.

if SY-SUBRC = 4.

insert LS_CUA_CONTROL into C_CUA_CONTROL index SY-TABIX.

elseif SY-SUBRC = 8.

append LS_CUA_CONTROL to C_CUA_CONTROL.

endif.

endif.

2) "Add call to subroutine 'ZCUSTOM_ROUTINE' when function code ZCUSTOM_FCODE is triggered. This FORM 'ZCUSTOM_ROUTINE'... ENDFORM subroutine will contain the logic that calls my custom screen from SAP include user-exit MV56AFZY.

clear LS_TA_CONTROL.

move:

'SAPMV56A' to LS_TA_CONTROL-PROGNAME, "Current Program

'1020' to LS_TA_CONTROL-DYNPRO, "Current Screen

'*' to LS_TA_CONTROL-TRTYP, "Current Transaction Type

'T' to LS_TA_CONTROL-KOPGR, "Screen Sequence Header Group

'ZCUSTOM_FCODE' to LS_TA_CONTROL-FCODE, "Current Function Code

'F' to LS_TA_CONTROL-CALL_MODE, "Call Mode - F = Process form routine with subsequent F-code

'SAPMV56A' to LS_TA_CONTROL-NEXT_PROGNAME, "Next Program

' ' to LS_TA_CONTROL-NEXT_DYNPRO, "Next Screen

'ZCUSTOM_ROUTINE' to LS_TA_CONTROL-NEXT_FORM, "Subroutine to be called in Include 'MV56AFZY'

'MM_RSTR' to LS_TA_CONTROL-NEXT_FCODE. "Next Function Code

insert LS_TA_CONTROL into table C_TA_CONTROL.

Regarding FORM ZCUSTOM_ROUTINE:

I use the value of T180-TRTYP to determine the mode I call my screen (create/update/display). The function I created that ultimately calls my custom screen and flow logic passes back resulting changes made by the user. My solution updates extended fields of the shipment header (VTTK). So I need to decide whether any changes were made for those fields. If yes, then I update SAP internal tables XVTTK and YVTTK (new and old entries) accordingly.

3. Finally, I implemented BADI_LE_SHIPMENT for some specific requirements we had prior to saving the shipment to the database.

I hope this is helpful for you or others.

Be well... KM

0 Kudos

Add new fields to VT01N SAP

In the link above, there is a code with a solution based on Kyle's answer(additional info to alvarogarrido@hotmail.com)

vimoralesg
Explorer
0 Kudos

Hi Kyle,

Quick question, on your function, how did you call your screen.

I had been able to add additional functionalities to these transactions but now I already create an append structure on VTTK and I'm updating the extra fields but the transaction always showed me "No changes were made...." and the transaction it is not saving the changes on the custom fields I created.

Any input will be great,

Happy holidays,

0 Kudos

Hello Virgilio,

I'm not sure I mentioned it earlier, but I created a function module to contain my custom screen processes. With that in mind...

If you implemented something like what I described in my post from Nov 21, 2021, search my post for 'ZCUSTOM_ROUTINE'. You will notice that I maintain control table C_TA_CONTROL with the subroutine 'ZCUSTOM_ROUTINE'. This ensures my custom subroutine will be executed when a user presses my custom push button. This routine must be coded in SAP exit include MV56AFZY. Inside my subroutine, I call my custom function module (that issues statement CALL SCREEN to my custom screen). I am passing the existing state of my VTTK record and a few other attributes. I am also returning the VTTK record with any changes made by the user while in my custom screen. I compare the existing and new VTTK records to identify whether a change occurred. If yes, (from inside my subroutine in include MV56AFZY) I do something like...

"Update XVTTK (New VTTK)

read table XVTTK assigning <XVTTK> index 1.

if <XVTTK> is assigned.

if <XVTTK>-UPDKZ is initial.

<XVTTK>-UPDKZ = 'U'.

endif.

"Update custom VTTK attribute values

move-corresponding LS_CI_VTTK_NEW to <XVTTK>. "LS_CI_VTTK_NEW is typed as my append structure for VTTK

"Update YVTTK (Old VTTK)

read table YVTTK assigning <YVTTK> index 1.

if <YVTTK> is assigned.

<YVTTK>-UPDKZ = <XVTTK>-UPDKZ.

else.

move-corresponding <XVTTK> to YVTTK.

"Reset the Old custom VTTK attribute values

move-corresponding LS_CI_VTTK_OLD to YVTTK.

YVTTK-UPDKZ = <XVTTK>-UPDKZ.

append YVTTK.

endif.

endif.

I hope this helps. Please let me know if I can be of further assistance.

Gratefully,

Kyle M

0 Kudos

Try with BADI_LE_SHIPMENT


Also try in the below routines
MV56AINI Initialization of transaction control for transportation
V56AFCCH Shipment processing: Check function code allowed
V56AGTAR User Exit for Filtering Shipping Unit Calculation
V56ARCHV Customer-spec. checks for archiving shipments
V56ATKTX Change the number of lines for text input in shipment
V56BMOD Transportation processing: Field modification
V56DISTZ Shipment Processing: Determine Distance
V56FCOPY Shipment processing: Copy delivery data
V56FSTAT Shipment processing: Activities when setting a status
V56L0001 Status of Shipments for a Delivery
V56LDELI Read Delivery Data for Shipment Processing
V56LOCID Shipment Processing: Determine Location Identification
V56MVT04 Extensions for Collective Processing of Shipments
V56SLDET Shipment processing: Leg determination
V56TDLIF Filter Delivery Items for Shipment
V56UCHCH Shipment processing: Check whether changes were made
V56UCHCO Check shipments are complete
V56UDLUP Obsolete as of 4.6C: Delivery Update on Delivery Routines
V56UNUMB Shipment number allocation
V56USTAT User-individual definition of transportation planning status
V56USVDO Update new objects for transport
V56USVDP Preparation for updating new objects for transport?

0 Kudos

VT03N is a transaction code in SAP LE application with the description — Display Shipment.

How do I add custom fields in VA01?Add A New Field in VA01 Header
  1. Step1: Append a new field where the data has to be stored. ...
  2. Step2: If we want to add any fields, we can use the screen number 8309 in program name SAPMV45A for header.
  3. Step3: In the layout, you can design the screen how it has to be displayed.
VT01N is a transaction code in SAP Logistics Execution application with the description — Create Shipment.Define a Custom field which should be used on the PO screen
  1. Go to tcode SE51.
  2. Enter program SAPLXM06 and screen number 0111.
  3. Click on create / change.
  4. Select maintain in original language. Machine liker apk
How do I add a custom field in SAP?Procedure
  1. Start SAP CRM and select the application that you want to enhance.
  2. Start the view configuration in the application.
  3. Click Show Enhancements to display or create a new field. ...
  4. Select an enhanced object, if several enhanced objects are available.
  5. Enable or disable the expert mode.