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: 

Create Salesorder throw BAPI_SALESORDER_CREATEFROMDATA2 USING EXTENSIOIN

Former Member
0 Kudos

Hi Experts,

Create Salesorder throw BAPI_SALESORDER_CREATEFROMDATA2 USING EXTENSIOIN using this parameter i am added to text .

ok that text ,so plz tell me where add this text . when ever excuted se38(abap editor) they are not displayed. plz help me

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor

Try like this:

It is not much complicated.

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

field.. dataelement... datatype.. length
zz_disp .. zzdisp .. char .. 4

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

field.. dataelement... datatype.. length
zz_disp .. char01... char.. 1

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

field.. dataelement... datatype.. length
zz_disp .. zzdisp .. char .. 4

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

field.. dataelement... datatype.. length
zz_disp .. char01... char.. 1

Now, check this program how to fill the EXTENSION parameter


Report ZTEST_NP.
parameters: p_vbeln like vbak-vbeln.
 
start-of-selection.
 
data: l_vbeln like BAPIVBELN-VBELN,
      l_inx   like BAPISDH1X.
data: it_ret like BAPIRET2 occurs 0 with header line,
      it_ext like BAPIPAREX occurs 0 with header line,
      is_hdr like BAPISDH1.

l_inx-UPDATEFLAG = 'U'.
l_vbeln = p_vbeln.
* fill the table with values to be changed
it_ext-STRUCTURE = 'BAPE_VBAK'.      "Strcture with the fields
it_ext-VALUEPART1+0(10) = l_vbeln.
it_ext-valuepart1+11(4) = 'TEST'.          "<< My ZZ_DISP field
append it_ext.

* mark the fields which you need to change
it_ext-STRUCTURE = 'BAPE_VBAKX'.     " Strcture with the flags
it_ext-VALUEPART1+0(10) = l_vbeln.
it_ext-VALUEPART1+10(1) = 'X'.
it_ext-VALUEPART1+11(1) = 'X'.
append it_ext.

*it_ext-STRUCTURE = 'ZAVBAK'.     " Strcture with the flags
*it_ext-VALUEPART1+24(1) = 'T'.
*append it_ext.
 
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    SALESDOCUMENT               = l_vbeln
    ORDER_HEADER_INX            = l_inx
  TABLES
    RETURN                      = it_ret
    EXTENSIONIN                 = it_ext
          .
  
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             WAIT          = 'X'.

Regards,

Naimesh Patel

Edited by: Naimesh Patel on Oct 1, 2009 9:14 AM - Code formatting due to 2500 character limit

2 REPLIES 2

naimesh_patel
Active Contributor

Try like this:

It is not much complicated.

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

field.. dataelement... datatype.. length
zz_disp .. zzdisp .. char .. 4

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

field.. dataelement... datatype.. length
zz_disp .. char01... char.. 1

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

field.. dataelement... datatype.. length
zz_disp .. zzdisp .. char .. 4

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

field.. dataelement... datatype.. length
zz_disp .. char01... char.. 1

Now, check this program how to fill the EXTENSION parameter


Report ZTEST_NP.
parameters: p_vbeln like vbak-vbeln.
 
start-of-selection.
 
data: l_vbeln like BAPIVBELN-VBELN,
      l_inx   like BAPISDH1X.
data: it_ret like BAPIRET2 occurs 0 with header line,
      it_ext like BAPIPAREX occurs 0 with header line,
      is_hdr like BAPISDH1.

l_inx-UPDATEFLAG = 'U'.
l_vbeln = p_vbeln.
* fill the table with values to be changed
it_ext-STRUCTURE = 'BAPE_VBAK'.      "Strcture with the fields
it_ext-VALUEPART1+0(10) = l_vbeln.
it_ext-valuepart1+11(4) = 'TEST'.          "<< My ZZ_DISP field
append it_ext.

* mark the fields which you need to change
it_ext-STRUCTURE = 'BAPE_VBAKX'.     " Strcture with the flags
it_ext-VALUEPART1+0(10) = l_vbeln.
it_ext-VALUEPART1+10(1) = 'X'.
it_ext-VALUEPART1+11(1) = 'X'.
append it_ext.

*it_ext-STRUCTURE = 'ZAVBAK'.     " Strcture with the flags
*it_ext-VALUEPART1+24(1) = 'T'.
*append it_ext.
 
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    SALESDOCUMENT               = l_vbeln
    ORDER_HEADER_INX            = l_inx
  TABLES
    RETURN                      = it_ret
    EXTENSIONIN                 = it_ext
          .
  
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             WAIT          = 'X'.

Regards,

Naimesh Patel

Edited by: Naimesh Patel on Oct 1, 2009 9:14 AM - Code formatting due to 2500 character limit

0 Kudos

Thank you Naimesh