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 extension - error

Former Member
0 Likes
1,274

hi experts,

I have a requirement to update certain custom fields in material master, that is in sales data, so i was trying to executethis in bapi_material_save data.

but when I tried that it says that the material has extended, but no changes were made to the data.meaning i passing certain input values to mvke table which need tp be updated.

it says that"the material caanot be maintained since no maintable data is to be transferred".

I am nnot clear where iam goin wrong..

could anyone of please guide me?

thanks

rinky

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,095

Hi,

Try this..This is working for the custom fields in my system in the table MVKE...The lines that are marked in bold you have change it accordingly...

PARAMETERS: P_MATNR TYPE MATNR.

DATA: HEADDATA LIKE BAPIMATHEAD.

HEADDATA-MATERIAL = P_MATNR.

HEADDATA-SALES_VIEW = 'X'.

DATA: EXTENSION LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.

DATA: EXTENSIONX LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.

DATA: EXT_MVKE LIKE BAPI_TE_MVKE.

DATA: EXT_MVKEX LIKE BAPI_TE_MVKEX.

  • EXTENSION

EXTENSION-STRUCTURE = 'BAPI_TE_MVKE'.

<b>EXT_MVKE-SALES_ORG = '1000'.

EXT_MVKE-DISTR_CHAN = '10'.

EXT_MVKE-YYFIELD = 'ABC'.</b>

EXTENSION-VALUEPART1 = EXT_MVKE.

APPEND EXTENSION.

  • EXTENSIONX

EXTENSIONX-STRUCTURE = 'BAPI_TE_MVKEX'.

<b>EXT_MVKEX-SALES_ORG = '1000'.

EXT_MVKEX-DISTR_CHAN = '10'.

EXT_MVKEX-YYFIELD = 'X'.</b>

EXTENSIONX-VALUEPART1 = EXT_MVKEX.

APPEND EXTENSIONX.

DATA: RETURN TYPE BAPIRET2.

DATA: SALESDATA TYPE BAPI_MVKE.

DATA: SALESDATAX TYPE BAPI_MVKEX.

<b>SALESDATA-SALES_ORG = '1000'.

SALESDATA-DISTR_CHAN = '10'.

SALESDATAX-SALES_ORG = '1000'.

SALESDATAX-DISTR_CHAN = '10'.</b>

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = HEADDATA

SALESDATA = SALESDATA

SALESDATAX = SALESDATAX

IMPORTING

RETURN = RETURN

TABLES

EXTENSIONIN = EXTENSION

EXTENSIONINX = EXTENSIONX

.

COMMIT WORK.

Thanks,

Naren

3 REPLIES 3
Read only

Former Member
0 Likes
1,096

Hi,

Try this..This is working for the custom fields in my system in the table MVKE...The lines that are marked in bold you have change it accordingly...

PARAMETERS: P_MATNR TYPE MATNR.

DATA: HEADDATA LIKE BAPIMATHEAD.

HEADDATA-MATERIAL = P_MATNR.

HEADDATA-SALES_VIEW = 'X'.

DATA: EXTENSION LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.

DATA: EXTENSIONX LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.

DATA: EXT_MVKE LIKE BAPI_TE_MVKE.

DATA: EXT_MVKEX LIKE BAPI_TE_MVKEX.

  • EXTENSION

EXTENSION-STRUCTURE = 'BAPI_TE_MVKE'.

<b>EXT_MVKE-SALES_ORG = '1000'.

EXT_MVKE-DISTR_CHAN = '10'.

EXT_MVKE-YYFIELD = 'ABC'.</b>

EXTENSION-VALUEPART1 = EXT_MVKE.

APPEND EXTENSION.

  • EXTENSIONX

EXTENSIONX-STRUCTURE = 'BAPI_TE_MVKEX'.

<b>EXT_MVKEX-SALES_ORG = '1000'.

EXT_MVKEX-DISTR_CHAN = '10'.

EXT_MVKEX-YYFIELD = 'X'.</b>

EXTENSIONX-VALUEPART1 = EXT_MVKEX.

APPEND EXTENSIONX.

DATA: RETURN TYPE BAPIRET2.

DATA: SALESDATA TYPE BAPI_MVKE.

DATA: SALESDATAX TYPE BAPI_MVKEX.

<b>SALESDATA-SALES_ORG = '1000'.

SALESDATA-DISTR_CHAN = '10'.

SALESDATAX-SALES_ORG = '1000'.

SALESDATAX-DISTR_CHAN = '10'.</b>

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = HEADDATA

SALESDATA = SALESDATA

SALESDATAX = SALESDATAX

IMPORTING

RETURN = RETURN

TABLES

EXTENSIONIN = EXTENSION

EXTENSIONINX = EXTENSIONX

.

COMMIT WORK.

Thanks,

Naren

Read only

0 Likes
1,095

Hi Naren,

Thanks a lot for your timely help.Its working fine.

Read only

Former Member
0 Likes
1,095

HI,

for updating using FM.

we need to populate the two basic tables data.

1. data table

2. Update information table , Flags need to be set in order to update the corresponding field in the data table.

the custome field will not have , corresponding field in data table and corresponding flag in update information table .

please locate some custoemr Enhancements for the material change. Populate the value in the enhancement.

jaffer vali shaik

Message was edited by: jaffer vali shaik