cancel
Showing results for 
Search instead for 
Did you mean: 

Use of BAPI -> BAPI_PRDSRVAPS_SAVEMULTI2

Former Member
0 Kudos

Hi,

I am using standard BAPI - BAPI_PRDSRVAPS_SAVEMULTI2 to update product master data i.e. transaction /SAPAPO/MAT1.

Here, i am supposed to update certain fields which have been customized and added through screen exit under EXTRA tab in the MAT1 transaction.

BAPI - BAPI_PRDSRVAPS_SAVEMULTI2 does not have any table parameters to support updating these fields in the MAT1 transaction.

I tried using the table parameter EXTENSION_IN by adding the structure it refers to - i,e, structure BAPI_TE_SAPAPO_MATLOC

- Auxiliary structure for customer enhancement for database table "/SAPAPO/MATLOC". This structure must be compatible with customer include "CI_MATLOC".

CI_MATLOC has the custom fields added which are ZAB_RATIO, ZAB_ACCEPT_EXCESS, ZAB_PRIORITY and ZAB_RELEVANT.

I am using a custom report to update the MAT1 transaction.

Please suggest me how to update these custom fields.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Sorry for the late reply.if you have added custom fields into the structure CI_MATLOC then please add the same fields in CI_MATLOCX structure also with the char 1 data type (To save 'X' in it).

Then pass the structure name BAPI_TE_SAPAPO_MATLOC in the EXTENSION_IN-STRUCTURE field.

In VALUEPART1 pass the fieldname ZAB_RATIO

Similalrly in VALUEPART2 pass ZAB_ACCEPT_EXCESS and so on....

Regards,

saurabh

Former Member
0 Kudos

Thank you for this nice answer.

I transmit the structure, the new fields,

But how to transmit the values contained on those fields ??

Thank you !!

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I have the same need. I have the specifical field in /SAPAPO/matloc. I add this field with the append structure CI_MATLOC.

I would like used the bapi BAPI_PRDSRVAPS_SAVEMULTI2 to update this field with table EXTENSION_IN.

I test the solution of Saurabh A. Kulkarni. But it not working. My field are in the structure CI_MATLOC not BAPI_TE_SAPAPO_MATLOC.

My coding:

ls_extension_in-structure = 'BAPI_TE_SAPAPO_MATLOC'.

ls_matloc-ZZLEVEL1_1 = 'test'.

ls_matloc-ZZLEVEL1_2 = 'test'.

ls_extension_in-valuepart1 = ls_matloc.

APPEND ls_extension_in to li_extension_in.


I analyzed the bapi. I see in this ligne below(ligne 2021 include L10001F02) , it not possible to retrieve the data "test test":

DATA:......

     wa_te_matkey TYPE bapi_te_sapapo_matkey,

......

* -> extract customer extension for /sapapo/matkey out of extension_in parameter

   LOOP AT it_extensionin ASSIGNING <fs_extnin>.

     CASE <fs_extnin>-structure.

       WHEN 'BAPI_TE_SAPAPO_MATKEY'.

         CLEAR wa_te_matkey.

         MOVE <fs_extnin>+30 TO wa_te_matkey.                "#EC ENHOK

         APPEND wa_te_matkey TO lt_te_matkey.

       WHEN 'BAPI_TE_SAPAPO_MATKEY_X'.

         CLEAR wa_te_matkey_x.

         MOVE <fs_extnin>+30 TO wa_te_matkey_x.              "#EC ENHOK

         APPEND wa_te_matkey_x TO lt_te_matkey_x.

     ENDCASE.

   ENDLOOP.

.....


In structure bapi_te_sapapo_matkey, there are not specifical fields so i can't retrieve my data.


I don't understand how update my specifical fields by the bapi BAPI_PRDSRVAPS_SAVEMULTI2.


Thank you for your helps.

Former Member
0 Kudos

I see in the bapi BAPI_PRDSRVAPS_SAVEMULTI2 tab "Tables", the help of table EXTENSION_IN:

"

Specific information for this extension parameter:

The BAdI "APO_BAPI_BUS10001-CHANGE_SAVEMULTIPLE2" should be used to evaluate this extension parameter.

The following auxiliary structures are available for this extension parameter:

  • BAPI_TE_SAPAPO_MATKEY: Auxiliary structure for the customer enhancement for database table "/SAPAPO/MATKEY". This structure must be compatible with the customer include "CI_MATKEY".
  • BAPI_TE_SAPAPO_MATKEY_X: Auxiliary structure for change parameter of the customer enhancement for database table "/SAPAPO/MATKEY". The relationship between parameter and change parameter takes place using the table key. This structure must be compatible with customer include "CI_MATKEYX".
  • BAPI_TE_SAPAPO_MATLOC: Auxiliary structure for customer enhancement for database table "/SAPAPO/MATLOC". This structure must be compatible with customer include "CI_MATLOC".
  • BAPI_TE_SAPAPO_MATLOC_X: Auxiliary structure for change parameter for the customer enhancement for database table "/SAPAPO/MATLOC". The relationship between parameter and change parameter is a result of the table key. This structure must be compatible with customer include "CI_MATLOCX"."

I analyse the methode APO_BAPI_BUS10001-CHANGE_SAVEMULTIPLE2. There are not a table type "/SAPAPO/matloc" where i could move my data in this table. So I can do anything with this badi.

Usually, there is a table ET_TABLE to represente the table you want to update. Then i can do:

data ls_matloc_spe     type ci_matloc.

MOVE LS_EXTENSION_IN+30 to ls_matloc_spe.

MOVE CORRESPONDING FIELDS ls_matloc_spe to ls_matloc.

APPEND LS_MATLOC to ET_MATLOC.

Thanks

Former Member
0 Kudos

Hello,

After making the structure compatible with CI_MATLOC.

Pass the values by using offset. i.e. this EXTENSION_IN is of type char 255.

So, depending on the type pass the value using offset.

Example-

if zab_ratio refers to 20 char

then, pass the value like this +0(20) = <value>

and next is zab_relevant - char 20

then , pass the value as 20+(20) = <value>.

Hope, it works.

Former Member
0 Kudos

Hi Rahul,

How to pass the BAPI_TE_SAPAPO_MATLOC_X in BAPI_PRDSRVAPS_SAVEMULTI2.

Kindly Guide me the same.