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 to create Purchse View for Article

Former Member
0 Likes
827

Hi,

I have created article using MM41 and maintained BASIC DATA and ADDITIONAL BASICDATA for it. I have to now maintain PURCHASE VIEW for that article.

I am using FM WRF_MATERIAL_MAINTAINDATA_RT to create purchase view.

I am passing data to two structure INFORECORD_GENERAL STRUCTURE BAPIEINA

INFORECORD_PURCHORG STRUCTURE WRFBAPIEINE

that holds purchase view data.

BAPI returns telling article is changed. but if i go check in MM43 it is not changed.

BAPI works fine if i try to modify any data except for the above.

Can any one suggest me how to tackle this or is there any other way to create new purchse view for existing article.

Vanitha P

1 REPLY 1
Read only

Former Member
0 Likes
550

>

> Hi,

>

> I have created article using MM41 and maintained BASIC DATA and ADDITIONAL BASICDATA for it. I have to now maintain PURCHASE VIEW for that article.

>

> I am using FM WRF_MATERIAL_MAINTAINDATA_RT to create purchase view.

>

> I am passing data to two structure INFORECORD_GENERAL STRUCTURE BAPIEINA

> INFORECORD_PURCHORG STRUCTURE WRFBAPIEINE

> that holds purchase view data.

>

> BAPI returns telling article is changed. but if i go check in MM43 it is not changed.

>

>

> BAPI works fine if i try to modify any data except for the above.

>

> Can any one suggest me how to tackle this or is there any other way to create new purchse view for existing article.

>

>

>

> Vanitha P

Here a simple example code for upload Material data:

*&---------------------------------------------------------------------*
*&      Form  call_bapi
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM call_bapi USING is_head  TYPE bapimathead
                     is_mara  TYPE bapi_mara
                     is_marax TYPE bapi_marax
                     is_marc  TYPE bapi_marc
                     is_marcx TYPE bapi_marcx
                     is_mbew  TYPE bapi_mbew
                     is_mbewx TYPE bapi_mbewx
                     is_mvke  TYPE bapi_mvke
                     is_mvkex TYPE bapi_mvkex
                     is_mlan  type bapi_mlan.

  Data: lt_mlan type table of bapi_mlan.
  Append is_mlan to lt_mlan.

  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      headdata                   = ls_head
      clientdata                 = ls_mara
      clientdatax                = ls_marax
      plantdata                  = ls_marc
      plantdatax                 = ls_marcx
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
      valuationdata              = ls_mbew
      valuationdatax             = ls_mbewx
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
     salesdata                  = is_mvke
     salesdatax                 = is_mvkex
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
*   FLAG_ONLINE                = ' '
*   FLAG_CAD_CALL              = ' '
*   NO_DEQUEUE                 = ' '
*   NO_ROLLBACK_WORK           = ' '
    IMPORTING
      return                     = gs_return
    TABLES
      materialdescription        = gt_makt
*      unitsofmeasure             = gt_uom
*      unitsofmeasurex            = gt_uomx
      internationalartnos        = gt_mean
*   MATERIALLONGTEXT           =
      TAXCLASSIFICATIONS         = lt_mlan
*   RETURNMESSAGES             =
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =
            .


*  READ TABLE gt_return INTO gs_return WITH KEY type = gc_return_s.
*  IF sy-subrc = 0.
  IF gs_return-type EQ gc_return_s.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*     EXPORTING
*       WAIT          =
*     IMPORTING
*       RETURN        =
              .
  ELSE.
    WRITE: /.
    WRITE: ls_mara-old_mat_no, gs_return-type,
              '   ', gs_return-message(50).
  ENDIF.

  CLEAR gs_return.

ENDFORM.                    "call_bapi