Current Position:Home > Issue in material master update from presentation server  using BAPI....

Issue in material master update from presentation server  using BAPI....

Update:10-11Source: network consolidation
Advertisement
Hi Guru's...
i am trying to change the material master from presentation server (desktop flat file)
using BAPI(BAPI_MATERIAL_SAVEDATA) ....
while executing my program i am getting the message like material had changed...
but while in mm02 i am un able to fine the updates...
please find below program logic and correct me if any mistakes....
thanks in advance...
*& Report  ZAREPAS36
REPORT  zarepas36.
DATA : gs_bapimathead             TYPE  bapimathead,
       gs_clientdata              TYPE  bapi_mara,
       gs_clientdatax             TYPE  bapi_marax.
TYPES : BEGIN OF gty_itab1,
        matnr(18),
        matkl(9),
        spart(2),
        ntgew(13),
        gewei(3),
        meins(3),
        END OF gty_itab1.
DATA : gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
       gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
       abc(132),
       END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
      gwa_itab2 TYPE gty_itab2.
flat file at selection screen
PARAMETERS: p_files TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename = p_files
    filetype = 'ASC'
  CHANGING
    data_tab = gt_itab2
  EXCEPTIONS
    OTHERS   = 8.
LOOP AT gt_itab2 INTO gwa_itab2.
  IF gwa_itab2-abc(1) = 'S'.
    gwa_itab1 = gwa_itab2-abc(132).
    APPEND gwa_itab1 TO gt_itab1.
  ENDIF.
ENDLOOP.
loop at gt_itab1 into gwa_itab1.
*Material
gs_bapimathead-material    = gwa_itab1-matnr.
*Material details at client data
*material group.
gs_clientdata-matl_group = gwa_itab1-matkl.
gs_clientdatax-matl_group = 'X'.
*Division
gs_clientdata-division = gwa_itab1-spart.
gs_clientdatax-division = 'X'.
*Net Weight
gs_clientdata-net_weight = gwa_itab1-ntgew.
gs_clientdatax-net_weight = 'X'.
*Unit of Weight
gs_clientdata-unit_of_wt = gwa_itab1-gewei.
gs_clientdatax-unit_of_wt = 'X'.
*Base Unit of Measure
gs_clientdata-base_uom = gwa_itab1-meins.
gs_clientdatax-base_uom = 'X'.
endloop.
*calling BAPI for making changes in material and saving thru BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
    headdata    = gs_bapimathead
    clientdata  = gs_clientdata
    clientdatax = gs_clientdatax.
IF sy-subrc NE 0.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  WRITE: / 'Error occured while changing material'.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  WRITE: / 'material',gs_bapimathead-material,'changed'.
ENDIF.

The Best Answer

Advertisement
hi hello Guru's
i resolved the issuee..
pleaso go thru the below proram logic for your reference..........
*& Report  ZAREPAS36
REPORT  zarepas36.
DATA : gs_bapimathead             TYPE  bapimathead,
       gs_clientdata              TYPE  bapi_mara,
       gs_clientdatax             TYPE  bapi_marax.
TYPES : BEGIN OF gty_itab1,
        matnr(18),
        matkl(9),
        spart(2),
        ntgew(13),
        gewei(3),
        meins(3),
        END OF gty_itab1.
DATA : gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
       gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
       abc(132),
       END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
      gwa_itab2 TYPE gty_itab2.
DATA:ls_return         TYPE bapiret2,
     lt_bapiret2       TYPE standard table of bapiret2.
flat file at selection screen
PARAMETERS: p_files TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename = p_files
    filetype = 'ASC'
  CHANGING
    data_tab = gt_itab2
  EXCEPTIONS
    OTHERS   = 8.
LOOP AT gt_itab2 INTO gwa_itab2.
  IF gwa_itab2-abc(1) = 'S'.
    gwa_itab1 = gwa_itab2-abc(132).
    APPEND gwa_itab1 TO gt_itab1.
  ENDIF.
ENDLOOP.
LOOP AT gt_itab1 INTO gwa_itab1.
*Material
  gs_bapimathead-material    = gwa_itab1-matnr.
*Material details at client data
*material group.
  gs_clientdata-matl_group = gwa_itab1-matkl.
  gs_clientdatax-matl_group = 'X'.
*Division
  gs_clientdata-division = gwa_itab1-spart.
  gs_clientdatax-division = 'X'.
*Net Weight
  gs_clientdata-net_weight = gwa_itab1-ntgew.
  gs_clientdatax-net_weight = 'X'.
*Unit of Weight
  gs_clientdata-unit_of_wt = gwa_itab1-gewei.
  gs_clientdatax-unit_of_wt = 'X'.
*Base Unit of Measure
  gs_clientdata-base_uom = gwa_itab1-meins.
  gs_clientdatax-base_uom = 'X'.
ENDLOOP.
*calling BAPI for making changes in material and saving thru BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
    headdata    = gs_bapimathead
    clientdata  = gs_clientdata
    clientdatax = gs_clientdatax
  IMPORTING
    return      = ls_return.
LOOP AT lt_bapiret2 INTO ls_return.
  EXIT.
ENDLOOP.
IF sy-subrc = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  WRITE: / 'Error occured while changing material'.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  WRITE: / 'material',gs_bapimathead-material,'changed'.
ENDIF.
  • Issue in material master update from presentation server  using BAPI.... Update:10-11

    Hi Guru's... i am trying to change the material master from presentation server (desktop flat file) using BAPI(BAPI_MATERIAL_SAVEDATA) .... while executing my program i am getting the message like material had changed... but while in mm02 i am un abl

  • Material Master: Update the Z fields using BAPI Update:10-11

    Hi to all, My requirement is simple. But I do not have much knowledge on BAPI. I have got some information that we can extend th BAPI and update the Z fields in material master. I have added the z fields in MARA. So when I call the bapi z fields has

  • Issue: Sending material master using ALE-IDOC. Update:10-11

    Hi all, I am sending the material master data from one server to another.All the fields getting transported along with creator(field ERNAM) of the material.When viewed from WE05 the field is having the same data as original creator of the material in

  • Material Master Update from group routing. Update:11-30

    Dear All, When we make material routing. in CA02>scheduling>Results--->Update material master (marking). can be done for the lead time scheduling Purpose. and update in CA96. But when we use Group Routing, and assign multiple materials in routing

  • Exit for Material Master UPdate Update:11-30

    Hi Friends, could anyone let me know any user exit for Material Master UPdate. Thanks in Advance Regardshi good MGA00001            Material Master (Industry): Checks and Enhancements MGA00002            Material Master (Industry): Number Assignment

  • Material Master Update Update:10-11

    Hi Abap Experts, I am facing an issue with an update of material master data when using a Bapi BAPI_MATERIAL_SAVEREPLICA. I am trying to update the below fields Minlotsize,pl_ti_fince,plnd_delry. Below is the code which i have used   LOOP AT it_zcost

  • Archiving issue in material master Update:11-30

    Hi I am trying to delete the material master through SARA t.code 1.enter the  archiving object  MM_MATNR 2. then click write button enter the varient name(zarc..)click maintain      then enter the materials ...tick the radio button production mode..s

  • Material Master Update through BAPI - Follow up material not updated Update:10-11

    Hi Experts, I am updating the material master through a custom transaction using the BAPI  'BAPI_MATERIAL_SAVEDATA'. Rest of the fields are updating correctly except for discontinuation ind., effective out date & follow-up material. When I try to upd

  • Weight change in material master, update all open PO's Update:10-11

    Hello IS there any standard way for mass update open purchase orders, when weights and volumen in material master change ? example: there is a change in neto weight for material AAAA, which is inserted into mm02, basic data for his material. This cha

  • Issue In Material Master Creation. Update:10-11

    Hi All, We are migrating from ECC 5.0 to ECC 6.0. We have created a Test system  in 6.0 which is replica of our existing Production system in 5.0. I have checked relevant config settings everything is ok. While doing testing we observed following iss