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

EXTENSIONIN in bapi SD_SALESDOCUMENT_CREATE

Former Member
0 Likes
10,531

Hi I am using the BAPI sd_salesdocument_create to create sales orders and need to pass the field Tax Number 1 (STCD1) for the case of a customer CPD. I'm using the table EXTENSIONIN as follows but not recorded the field.

EXTENSIONIN-STRUCTURE = 'VBPA3KOM'

EXTENSIONIN-VALUEPART1 = '         000000AG10406707933'

Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
4,890

The coding for extension to SD_SALESDOCUMENT_CREATE goes like below. Here, I am populating a new field VBAK-ZZ_FIELD with a value. Later I will pass EXTENSIONIN table to SD_SALESDOCUMENT_CREATE.

You need to do similar coding for the field STCD1 for your structure.

DATA: extensionin LIKE bapiparex OCCURS 0 WITH HEADER LINE.
DATA: ls_bape_vbak            LIKE bape_vbak,
      ls_bape_vbakx           LIKE bape_vbakx.

CLEAR extensionin.
MOVE 'BAPE_VBAK'           TO extensionin-structure.
ls_bape_vbak-zz_field = 'Value'.
MOVE ls_bape_vbak          TO extensionin-valuepart1.
APPEND extensionin.

CLEAR extensionin.
MOVE 'BAPE_VBAKX'          TO extensionin-structure.
MOVE 'X'                   TO ls_bape_vbakx-zz_field.
MOVE ls_bape_vbakx         TO extensionin-valuepart1.
APPEND extensionin.

Read only

madhu_vadlamani
Active Contributor
4,890

Hi,

This is discussed no of times in the forum.Please go through this note 143580 .It is in detail.

Regards,

Madhu.

Read only

0 Likes
4,890

The Note 143580 is for enhancement customer fields, in my case the field Tax Number 1 (SCTD1) exists in the CPD customer screen when registering a sales order. The Tax Number 1 field is stored in the table VBPA3, as I can record this field by SD_SALESDOCUMENT_CREATE BAPI?

Thanks.

Read only

Former Member
0 Likes
4,890

Daniel, i have a similar problem, using the bapi.: BAPI_SALESORDER_CREATEFROMDAT2

I use the EXTENSIONIN table as follows, but the data for the fields that we need are empty.

This is my code to fill the EXTENSIONIN table:

Do you see something wrong?

"dato de CPD - si corresponde.

   tBapiEXT-structure = 'VBPA3KOM'.

   clear tvbpa3kom.

   tvbpa3kom-stcd1 = lineas-stcd1.

   tvbpa3kom-stkzn = lineas-stkzn.

   MOVE tvbpa3kom TO tbapiEXT-valuepart1.

   append tBapiExt.

   clear tBapiExt.

do yo resolve your problem?

can you help me?

best regards.

Joel

Read only

0 Likes
4,890

According to documentation parameter EXTENSIONIN can be used to fill fields that belong to tables: VBAK, VBAP, VBEP and VBKD - so it's no surprise that it's not working for other structures.

But the workaround I used to fill fields of VBPA3 when calling SD order BAPIs is as follows:

1. Before calling BAPI fm in your program: export your data - that you want to set in VBPA3 - to ABAP memory - with statement like: "export ... to memory id ..."

2. Implement user exit USEREXIT_SAVE_DOCUMENT_PREPARE in include MV45AFZZ - or if you wish you can implement BAdI instead (BADI_SD_SALES, method SAVE_DOCUMENT_PREPARE).

Within your code of the exit import the data you have exported before ("import ... from memory id ...") and use these data to fill required fields in internal table XVBPA - this internal table contains fields of VBPA3 among others.

That's all.

regards