cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module for assortment change WSOA2

former_member797394
Participant
0 Likes
3,541

Hello everyone,

My requirement in function module is to call transaction code WSOA2 in order to add stores(WRSZ-LOCNR) to existing assortments(WRS1-ASORT).

This is my first time I am asking for FM, that is why a more clear answer would be appreciated. However, it is not neccessary.

I hope my question is clear.

View Entire Topic
venkateswaran_k
Active Contributor

Hi

You may try with the BAPI - BAPI_ASSORTMENT_MAINTAINDATA . Open the bapi SE37 - the FM documentation may help you further

CALL FUNCTION 'BAPI_ASSORTMENT_MAINTAINDATA' "Maintenance of Assortments
  EXPORTING
    assortment =                " bapie1wrs1
    assortmentx =               " bapie1wrs1x
  IMPORTING
    return =                    " bapiret2
* TABLES
*   materialgroup =             " bapie1wrs6
*   materialgroupx =            " bapie1wrs6x
*   description =               " bapie1wrst
*   descriptionx =              " bapie1wrstx
*   assortmentusers =           " bapie1wrsz
*   assortmentusersx =          " bapie1wrszx
former_member797394
Participant
0 Likes

Thank you vey much. I have a question. What is the difference between assortment and assortmentx. What should I write here?

venkateswaran_k
Active Contributor
0 Likes

Hi

Sorry for delay,

In X table - you have to mark the items you mentioned in assortment table, - mark them with X in assortmentX table. If you do not mention then that item will mot be updated

former_member797394
Participant
0 Likes

venkateswaran.k

Am I doing everything correctly? If yes, then program does not write my entries and not even giving any errors.

DATA:
ld_return TYPE bapiret2,
it_assortmentusers TYPE STANDARD TABLE OF bapie1wrsz, "TABLES PARAM
wa_assortmentusers LIKE LINE OF it_assortmentusers,
it_assortmentusersx TYPE STANDARD TABLE OF bapie1wrszx, "TABLES PARAM
wa_assortmentusersx LIKE LINE OF it_assortmentusersx,
ld_assortment TYPE bapie1wrs1,
wa_assortment LIKE ld_assortment,
ld_assortmentx TYPE bapie1wrs1x,
wa_assortmentx LIKE ld_assortmentx.
LOOP AT mt_info INTO ls_info.
wa_assortment-assortment = ls_info-asort.
wa_assortmentx-assortment = 'X'.
wa_assortmentusers-seqnumber = '5'.
wa_assortmentusers-customer_site = ls_info-locnr.
wa_assortmentusers-salesorg = ls_info-vkorg.
wa_assortmentusers-distr_chan = ls_info-vtweg.
wa_assortmentusersx-seqnumber = 'X'.
wa_assortmentusersx-customer_site = 'X'.
wa_assortmentusersx-salesorg = 'X'.
wa_assortmentusersx-distr_chan = 'X'.
APPEND wa_assortmentusers TO it_assortmentusers.
APPEND wa_assortmentusersx TO it_assortmentusersx.
ENDLOOP.
CALL FUNCTION 'BAPI_ASSORTMENT_MAINTAINDATA'
EXPORTING
assortment = wa_assortment
assortmentx = wa_assortmentx
IMPORTING
return = ld_return
TABLES
* MATERIALGROUP =
* MATERIALGROUPX =
* DESCRIPTION =
* DESCRIPTIONX =
assortmentusers = it_assortmentusers
assortmentusersx = it_assortmentusersx.
WRITE: ld_return-message.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
venkateswaran_k
Active Contributor
0 Likes

Hi

Did you debug and check the table - ld_return

What is expected and what it is nod updated. Can you please share.

former_member797394
Participant
0 Likes

venkateswaran.k

Yes, I have debuged. In ld-return, there is nothing written. My programm should append new markets to an assortment. So, I am passing assortment(ASORT), market(LOCNR) and two more fields. Everything seems to be written to internal tables,but nothing is written to the tables. What may be the reason for this? And what should I share, for better understanding?

venkateswaran_k
Active Contributor
0 Likes

I am not fully aware of the functionality. However, can you please pass the values for ( for both asoortment and assortment uers)

VALID_FROM

VALID_TO

ASTMT_CAT

former_member797394
Participant
0 Likes

I tried this, but unfortunately this didnt work