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: 

Cannot update Z field in VBAP using BAPI_SALESORDER_CHANGE

Former Member
0 Kudos

Hi,

We have a requirement to change the value of a Z field in VBAP table.

This is a newly created Z field. We are using the BAPI 'BAPI_SALESORDER_CHANGE'.

The BAPI doesn't update this Z field however it updates the other Z fields which were created earlier.

The Z field is included in the following structures:

BAPE_VBAP

BAPE_VBAPX

VBAPKOM

VBAPKOMX

The data type is Char01 for the fields included in structures BAPE_VBAPX and VBAPKOMX, but not in other two structures.

Please let us know if we are missing anything.

Thanks in advance.

6 REPLIES 6

Former Member
0 Kudos

How are the other z fields updated? I'd guess via a sales order exit routine, possibly in MV45AFZZ (or other MV45af**) module?

Former Member
0 Kudos

Most of the standard BAPI provide interface to take care of customer fields. These parameters are named as EXTENTIONIN , if the BAPI is meant to save data, and EXTENTIONOUT, if the BAPI is meant to retrieve data.

Try this-

1. Extend BAPI_TE_MVKE by appending your structure/ fields.

2. Create a corresponding append structure for appending to BAPI_TE_MVKEX.

Note: The field names should be exactly same but the data element should be BAPIUPDATE (CHAR1)

3. Maintain an entry in T130F table for each field and the fields T130F-PSTAT (Maintenance status) and T130F-SFGRU (Special field selection group).

To do this, go to SPRO> Logistics- General>Material Master> Field Selection> Assign Fields to Field Selection Groups.

4. Save the data and come back to the previous screen. Assign the selection group for this field.

Repeat this for the entire field for which we want the BAPI to work for. This step will complete the customization required for the BAPI to work.

5. Now call the BAPI_MATERIAL_SAVEDATA to update the your fields under EXTENTIONIN and EXTENTIONOUT.

Happy Troubleshooting!

former_member191735
Active Contributor
0 Kudos

There is an EXTENSIONIN tables parameter to update the custom fields. However, you need to search how to use them. You have to use userexit with this parameter to update the custom fields.

Former Member
0 Kudos

Hello NinJa650cc ,

As mentioned by Sampath you have to use EXTENSIONINN table parameters and need to pass the strycture name and values for the structure fields .

But no need to code / find any user exits for this functionality. BAPi will take care.

Check the below SAP documentation :

Customer Enhancement for VBAK, VBAP, VBEP
Description
You can use this parameter to transfer user-specific enhancments to a BAPI. The customer has to complete the EXTENSION structure and the system automatically continues processing it. If you have not defined any user-specific fields, then you can transfer a blank EXTENSIONIN structure.

Technical information about Customer Enhancements
The following description uses an example to explain how to proceed with customer enhancements to the SD tables VBAK, VBKD, VBAP and VBEP.

The customer has added their own fields to table VBAP using the INCLUDE structure CUTEST. This structure contains 2 fields:
CFIELD1, CHAR 10
CFIELD2, CHAR 3.

The customer also requires that these two fields can be maintained with the BAPI.

1. Maintain structure CUTEST in table VBAP
2. Because the BAPIs work with checkboxes, you must also define a CUTESTX checkbox for the customer structure. It should be structured like this:

Field name       Data element
CFIELD1            CHAR1
CFIELD2          CHAR1

3. Define these customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
4. Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
5. Adjust the following structures for customer enhancements to table VBAK:
a) VBAKKOZ
b) VBAKKOZX
c) BAPE_VBAK
d) BAPE_VBAKX
6. Adjust the following structures for customer enhancements to table VBEK:
a) VBEPKOZ
b) VBEPKOZX
c) BAPE_VBEP
d) BAPE_VBEPX
7. Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
8. If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
*For example:*
*You want to change customer field VBAP-CFIELD2 for item 20 to "XYZ" in order 4711.*
*The following entries are expected:*

*Import:     BAPIVBELN-VBELN       = '0000004711'  Document number*
            *BAPISDHD1X-UPDATEFLAG = 'U'           UPDKZ for doc header*
*Tables:     BAPISDITM-ITM_NUMBER  = '000020'      Item number*
            *BAPISDITMX-ITM_NUMBER = '000020'      Item number*
          *+ BAPISDITMX-UPDATEFLAG = 'U'           UPDKZ for item*

*You must complete the EXTENSION table as follows:*

*STRUCTURE                          VALUEPART1       1234561234567890123*

*BAPE_VBAP                       0000004711000020                 XYZ*
*BAPE_VBAPX                      0000004711000020       X*

Further information
You can find more information in the BAPI programming guide in the chapter for enhancements to BAPIs.

Notes
You must complete the STRUCTURE field with the name of the relevant enhancement structure (BAPE_VBAK, BAPE_VBAP, BAPE_VBEP). You can complete the remaining fields with the append structures from the enhancement structures.

At the moment, you can use the BAPI to store enhancements in the following structures:


VBAK : An enhancement to header data requires an append structure to BAPE_VBAK and an enhancement to structure VBAKKOZ.
VBAP : An enhancement to item data requires an append structure to BAPE_VBAP and an enhancment to structure VBAPKOZ.
VBEP : An enhancement to schedule line data requires an append structure to BAPE_VBEP and an enhancement to structure VBEPKOZ.
VBKD : If you are using an enhancement for header data, you must add an append structure to BAPE_VBAK. You also need to enhance structure VBAKKOZ. If it is for item data, you need to add an append structure to BAPE_VBAP. You must also enhance structure VBAPKOZ.
If you also want to work with checkboxes, each X-structure must also contain an append structure.

For example:
A customer has created an order and wants to include the material long text (50 digits long).

The EXTENSIONIN structure must be completed with BAPE_VBAP. Two fields have fixed definitions in this structure. These are in the VBAP host key (VBELN, POSNR). The customer sets up an append structure that contains field ZMAT50.

Because the VBELN is normally blank when you create an order, the data can look like this:

STRUCTURE   |BAPE_VBAP

VALUEPART1  |          000010Customermateriallongtext50

              VBELN     POSNR ZMAT50

Thanks,

Greetson

Former Member
0 Kudos

Hi,

Thanks for your replies.

We are using EXTENSIONIN for passing the values to update Z field in VBAP.But still the values are not updated in VBAP.

The remaining Z fields are updated except this new one.

Do we need to make changes in any of the user exits?

Thanks

Former Member
0 Kudos

This field is not included in the screen of VA01/VA02.It is included only in VBAP alone.Is this the reason for the field being not changed?