Application Development and Automation 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: 
Read only

BAPI_SALESORDER_CREATEFROMDAT2 : Custom fields

Former Member
0 Likes
4,764

Hi SD masters,

Am using BAPI_SALESORDER_CREATEFROMDAT2 to create sales order but the table i use has the CUSTOM FIELDS may be upto 20...so before it creates sales order it asks me to for one field...EX : HAZKEY which is my custom field...

i have gone through the forums...and used the same logic which is given by forum...this is my logic.

these are my steps

1) VBAK: In MY append structure I specifed ZZFIELD with the data type as needed

2) BAPE_VBAK: In the append structure here also added the ZZFIELD with the data type as needed with limitations.

3) BAPE_VBAKX: In the append structure added the field ZZFIELD of type BAPIUPDATE

4) VBAKKOZ: In the append structure here also added the ZZFIELD with the data type as needed with limitations

5) VBAKKOZX: In the append structure added the field ZZFIELD of type BAPIUPDATE

program logic

CLEAR wa_bape_vbak.

wa_bape_vbak-ZZHAZ_KEY = ZHAZARDOUS_TEXT-ZZHAZ_KEY.

wa_extensionin-structure = 'BAPE_VBAK'.

wa_extensionin+30(960) = wa_bape_vbak.

append wa_extensionin to lt_extensionin.

clear wa_extensionin.

now i pass the LT_EXTENSIONIN to BAPI.

It still asks me to pass the KEY.

CAN ANYONE PLEASE LET ME KNOW WHERE I HAVE GONE WORNG...

much appriciated.

thank you,

pasala.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,786

Hi,

Check the below mentioned blog which will give you an elaborate idea.

[http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12152] [original link is broken] [original link is broken] [original link is broken];

Regards

Srini

11 REPLIES 11
Read only

Former Member
0 Likes
2,786

check whether the value of ZHAZARDOUS_TEXT-ZZHAZ_KEY is initial or not then pass it.

Read only

0 Likes
2,786

thank you manjunath....

but their is value in ZHAZARDOUS_TEXT-ZZHAZ_KEY...

after having the value in ZHAZARDOUS_TEXT-ZZHAZ_KEY am passing to INT.TABLE....LT_EXTENSIONIN...and last am passing it to the BAPI.

But still when the BAPI runs it asks for the VBAK-ZZHAZ_KEY.

Thank you,

pasala.

Read only

tushar_shukla
Active Participant
0 Likes
2,786

Check following code .


DATA : wa_bape_vbakx TYPE BAPE_VBAKX .

wa_bape_vbak-VBELN = VBELN           " Order no 
wa_bape_vbak-ZZHAZ_KEY = ZHAZARDOUS_TEXT-ZZHAZ_KEY.
wa_extensionin-structure = 'BAPE_VBAK'.
wa_extensionin-VALUEPART1 = wa_bape_vbak.
append wa_extensionin to lt_extensionin.
clear wa_extensionin.

wa_bape_vbakx-VBELN = VBELN           " Order no 
wa_bape_vbakx-ZZHAZ_KEY = 'X'.
wa_extensionin-structure = 'BAPE_VBAKX'.
wa_extensionin-VALUEPART1 = wa_bape_vbakx.
append wa_extensionin to lt_extensionin.


.

Read only

0 Likes
2,786

hi Tushar,

thank you for the reply...

however....i am creating the sales order...so do we pass the VBELN?

Thank you,

pasala.

Read only

0 Likes
2,786

Hi,

These notes will help you too:

SAP Note 143580 - Information on SD BAPIs and customer enhancement concept

SAP Note 700795 - Enhancement category of BAPI enhancement structures

The last note is useful because it explains you because the numeric fields doesn't work for these enhancements.

Regards

Eduardo

Read only

0 Likes
2,786

For order creation, order no (VBELN) is not required.

Read only

0 Likes
2,786

hi Tushara,

thank you for the reply...

i have worked various ways but none of them seems to be working...IT STILL ASKS ME TO GIVE THE ZZHAZ_KEY before it creates the ORDER.

I have read the document of FM and applied the same thing...am still missing something which i really dont get what it could be...

this is different logic i used again..

data: it_ret like BAPIRET2 occurs 0 with header line,

it_ext like BAPIPAREX occurs 0 with header line,

is_hdr like BAPISDH1.

Data : l_r_brsch TYPE bape_vbak.

it_ext-STRUCTURE = 'BAPE_VBAK'. "Strcture with the fields

l_r_brsch-ZZHAZ_KEY = '01'.

it_ext-valuepart1 = l_r_brsch. "<< My ZZ_DISP field

append it_ext.

your expert knowledge would surely help out of this situation.

thank you,

pasala.

Read only

tushar_shukla
Active Participant
0 Likes
2,786

and check also whether you are passing correct value to update indicator ORDER_HEADER_INX-UPDATEFLAG .

Read only

Former Member
0 Likes
2,787

Hi,

Check the below mentioned blog which will give you an elaborate idea.

[http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12152] [original link is broken] [original link is broken] [original link is broken];

Regards

Srini

Read only

Former Member
0 Likes
2,786

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

Read only

Former Member
0 Likes
2,786

thanks for the contribution.