SAP Function /DSD/BAPI_VP_CHANGEFROMDATA - Change Visit Plan

Parameter Reference Type Length Default Optional Text
SIMULATION BAPIFLAG-BAPIFLAG C 1 X Simulation Indicator
VISITPLAN_ID /DSD/BAPI_VC_VP-VISITPLAN_ID C 10 Visit Plan ID
VPHX /DSD/BAPI_VC_VPHX u 20 X Header Data (Change Parameter)
VPH_IN /DSD/BAPI_VC_VPH u 177 X Visit Plan: Header Data
VPID_FOR_CRULE /DSD/BAPI_VC_VP-VISITPLAN_ID C 10 X Copy Template ID for Date Rules Item
VPID_FOR_HRULE /DSD/BAPI_VC_VP-VISITPLAN_ID C 10 X Copy Template ID for Date Rule Header

Parameter Reference Type Length Text
VPH_OUT /DSD/BAPI_VC_VPHOUT u 184 Visit Plan: Header Data (Export)

Parameter Reference Length Optional Text
EXTENSIONIN BAPIPAREX 990 X Customer Enhancements for Visit Plan
RETURN BAPIRET2 548 X Error Messages
VPPX /DSD/BAPI_VC_VPPX 13 X Customer Data (Change Parameter)
VPP_IN /DSD/BAPI_VC_VPP 70 X Visit Plan: Customer Data (Import)
VPTEXT_IN /DSD/BAPI_VC_VP_TEXT 157 X Visit Plan: Texts (Import)

Functionality
You can make the following changes to a visit plan using this method:

  • You can change general data at header and item level. You cannot change
  • the visit plan type of the visit plan in the header data.
    • You can use the import parameter VPID_FOR_HRULE to copy a header date
    • rule from another visit plan to the visit plan you want to change. Thisoverwrites the existing header date rule.
      • You can add new customers or remove customers from the visit plan using
      • the import structure VPP_IN. You can also change other customer data,such as the sequence of visits. You cannot change customer numbers.
        • You can use the import parameter VPID_FOR_CRULE to copy item date rules
        • from another visit plan to the visit plan you want to change. Thisoverwrites the existing item date rules.
          Changes you make to individual fields are only taken into account by thesystem if the following prerequisites are fulfilled:
          • You have specified in the update indicator for each item in the visit
          • plan whether the entered values are new (I) or changed (U)
            ,or if the existing values are to be deleted (D).
            • In the relevant change parameter for the parameter, you have flagged all
            • fields that are change-relevant with an 'X'. If you want to changespecific fields in the header data (parameter VPH_IN), for example, youmust select these fields in parameter VPHX.
              You can use the SIMULATION parameter to specify that you only want thechanges to be simulated, and that the changed visit plan data should notinitially be written to the database.
              Customer Enhancements
              To add customer fields to the tables for the visit plan, you can use thefollowing BAPI Table Extensions:
              • Structure /DSD/BAPI_VC_TE_VPH for additional fields at header level

              • Structure /DSD/BAPI_VC_TE_VPHX to flag the new fields at header level

              • Structure /DSD/BAPI_VC_TE_VPP for additional fields at item level

              • If customer fields are added to the item data table, these fields mustalso be added to the structure /DSD/VC_VP_TREE.
                • Structure /DSD/BAPI_VC_TE_VPPX to flag the new fields at item level

                • You can assign the relevant values to customer fields with theEXTENSIONIN table.
                  All data transferred to the BAPI is checked for consistency beforefurther processing. By implementing the BAdI methodVP_CHECK_CONSISTENCY, you can add your own checks or check theconsistency of customer fields in the visit plan tables.
                  Return messages
                  Messages are returned in the RETURN parameter. See the parameterdocumentation for the return values and their meanings.

                  Notes
                  The following authorization object is checked with the activity 02(Change): /DSD/VC_VP

                  Further information
                  For more information, see the parameter documentation.

                  Description
                  This export parameter outputs the changed header data of the visit plan.
                  INCLUDE BAPI_DATAELEMENT OBJECT DOKU ID TX

                  Description
                  This parameter indicates whether or not a visit plan should initially bechanged in simulation mode. If the indicator is set, the changed visitplan data is not written to the database.

                  Value range
                  Blank = Changed document is saved.
                  x = Changed document is not saved.

                  Description
                  This import parameter contains the ID of the visit plan for which youwant to change data.

                  Description
                  You can use this import parameter to specify which parameter VPH_IN
                  fields are change-relevant. Only changes in fields that have an 'X'in the checkbox are considered relevant.
                  Note
                  Since you cannot change the visit plan type, the system ignores newassignments of visit plan types in parameter VPH_IN, even if youhave flagged the visit plan type as change-relevant.

                  Description
                  You can use this import parameter to change visit plan header data, suchas route and validity period. You cannot change the visit plan type ofan existing visit plan, however.
                  INCLUDE BAPI_DATAELEMENT OBJECT DOKU ID TX

                  Description
                  This import parameter contains the ID of the visit plan you use as atemplate to change the Date Rule - Item in the vist plan that iscurrently being processed. If you enter an ID here, the system comparesthe customer list of the template with that of the current visit plan,and copies the relevant Date Rule - Item from the template forall customers in the current visit plan. If date rules have already beenassigned to some customers, they are overwritten by the date rule fromthe template.
                  The system does not copy any other data from the template to the currentvisit plan.
                  Note
                  A customer's date rule is only copied to the current visit plan if youhave flagged the RULEID_CUST field in parameter VPPX aschange-relevant.

                  Description
                  This import parameter contains the ID of the visit plan you use as atemplate to change the Date Rule - Header in the visit plan thatis currently being processed. If you enter an ID here, the system copiesthe Date Rule - Header to the new visit plan and overwrites anydate rule that has already been assigned. The system does not copy anyother data from the template to the current visit plan.
                  Note
                  The new date rule is only copied to the current visit plan if you haveflagged the RULEID field in parameter VPHX aschange-relevant.

                  Description
                  The ExtensionIn table allows you to enhance the BAPI import parameterswithout making modifications.
                  If you have added your own fields to the header or item data of thevisit plan, you can change the values of these fields with theExtensionIn table.

                  Description
                  INCLUDE BAPI_TABLE OBJECT DOKU ID TX

                  Value range
                  Type, ID,, Number,, Message
                  E,, BAPI,, 100,, One or more errors occurred when the BAPI was called
                  Messages relating to the consistency checks are also output.

                  Description
                  You can use this import structure to determine which fields in importstructure VPP_IN are change-relevant. Only changes in fields thathave an 'X' in the checkbox are considered relevant.
                  Note
                  Since you cannot change the customer number, the system does not takeaccount of customer changes in import structure VPP_IN, even ifyou have flagged the CUSTOMER_VC field with an 'X'.

                  Description
                  You can use this import structure to change customer data in the visitplan, such as the sequence in which the customers are visited or thetravel duration. You can also use an indicator to flag specificcustomers as "inactive" or remove the indicator, thus determiningwhether or not the customers are taken into account when visit lists arecreated.
                  Note
                  You cannot change customer numbers with this parameter. You can removecustomers from the visit plan, however, or add new customers to theexisting visit plan.

                  Value range
                  If you add new customers to the visit plan and want to assign texts tothe relevant items with the import structure VPTEXT_IN, assign atemporary item number with the value 800 or higher in theVISITPLAN_POS field. You then assign the item number to therelevant text ID in the import structure VPTEXT_IN. The temporaryitem numbers are only used to assign texts to items. The item numbersare always assigned by the system when new visit plan items are created.
                  If you want to change the sequence in which the customers are visited,change the relevant value in the VISIT_SEQUENCE field. Toindicate that a customer should be the third customer visited on a tour,for example, assign the value 003 in the VISIT_SEQUENCEfield. The system adjusts the values of this field accordingly for thesubsequent items. If you add a new customer to the visit plan and do notenter a value for the new item in the VISIT_SEQUENCE field, thenew customer is visited at the end of the tour.

                  Description
                  You can use this import structure to change visit plan texts at headeror item level.