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: 

Extension for BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Kudos

Hi everybody,

could anyone please help me, I have to create a sales order with BAPI_SALESORDER_CREATEFROMDAT2.

there is 2 customer fields in table VBAK, I checked the documentation for the bapi extensions parameters and I dont understand how should the structures VBAKKOZ and VBAKKOZX be processed.

could anyone explain me about this structures??

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

Follow this steps for the field in the extension:

1. Append one structure in BAPE_VBAK with the fields which need to be changed.

E.g. append strucutre name ZZAPE_VBAK and fields ZZ_Z1 and ZZ_Z2 with its original type.

2. Append one structure in BAPE_VBAKX with the fields with one character fields.

E.g. append strucutre name ZZAPE_VBAKX. Here Fields ZZ_Z1 and ZZ_Z2 must be of type CHAR1.

3. Append the same fields of the structure which was appended in the BAPE_VBAK to VBAKKOZ.

E.g. Append strucutre Name ZZ_VBAKKOZ and fields ZZ_Z1 and ZZ_Z2 with its original type.

4. Append the same structure which was appended in the BAPE_VBAKX to VBAKKOZX.

E.g. Append strucutre Name ZZ_VBAKKOZX. Here Fields ZZ_Z1 and ZZ_Z2 must be of type CHAR1.

To use it in the program:


* Fill the ZZ fields
    t_ext-structure = 'BAPE_VBAK'.      "Structure with the fields
    t_ext-valuepart1+0(10) = v_vbeln.
    t_ext-valuepart1+10(10) = V_ZZ1 .  " value of the ZZ_Z1 field
    append t_ext.

*  Mark for changes
    t_ext-structure = 'BAPE_VBAKX'.     " Structure with the flags
    t_ext-valuepart1+0(10) = v_vbeln.
    t_ext-valuepart1+10(1) = 'X'.
    append t_ext.

Regards,

Naimesh Patel

4 REPLIES 4

naimesh_patel
Active Contributor
0 Kudos

Follow this steps for the field in the extension:

1. Append one structure in BAPE_VBAK with the fields which need to be changed.

E.g. append strucutre name ZZAPE_VBAK and fields ZZ_Z1 and ZZ_Z2 with its original type.

2. Append one structure in BAPE_VBAKX with the fields with one character fields.

E.g. append strucutre name ZZAPE_VBAKX. Here Fields ZZ_Z1 and ZZ_Z2 must be of type CHAR1.

3. Append the same fields of the structure which was appended in the BAPE_VBAK to VBAKKOZ.

E.g. Append strucutre Name ZZ_VBAKKOZ and fields ZZ_Z1 and ZZ_Z2 with its original type.

4. Append the same structure which was appended in the BAPE_VBAKX to VBAKKOZX.

E.g. Append strucutre Name ZZ_VBAKKOZX. Here Fields ZZ_Z1 and ZZ_Z2 must be of type CHAR1.

To use it in the program:


* Fill the ZZ fields
    t_ext-structure = 'BAPE_VBAK'.      "Structure with the fields
    t_ext-valuepart1+0(10) = v_vbeln.
    t_ext-valuepart1+10(10) = V_ZZ1 .  " value of the ZZ_Z1 field
    append t_ext.

*  Mark for changes
    t_ext-structure = 'BAPE_VBAKX'.     " Structure with the flags
    t_ext-valuepart1+0(10) = v_vbeln.
    t_ext-valuepart1+10(1) = 'X'.
    append t_ext.

Regards,

Naimesh Patel

0 Kudos

I am going to create a sales order, so I dont have a value for v_vbeln.

what value should be loaded for v_vbeln?

0 Kudos

Don't pass anything in the VBELN since you are creating the Sales Order.

When you are changing e.g using BAPI_SALESORDER_CHANGE than you have to pass te VBELN.

Regards,

Naimesh Patel

0 Kudos

Helo Gents,

I'm trying to do the same.

Can you maybe explain me what does +0(10) mean below.

valuepart1+0(10)

Because I'm using visual basic script to upload sales order automatically from excel using BAPI.

Everything works fine expect filling in the custom Z* field. I don't know the logic how should be the valuepart1 field in.

Can maybe advice?