Application Development 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: 

bapi_material_savedata problem

Former Member
0 Kudos

hi experts,

i am updating some custom fields using bapi_material_savedata.but i am populating bapi with all parameters.but custom fields are not updating.please guide me

check the below code..

DATA:BEGIN OF IT_EXTENSIONIN OCCURS 0 .

INCLUDE STRUCTURE BAPIPAREX.

DATA:END OF IT_EXTENSIONIN.

DATA:BEGIN OF IT_EXTENSIONINX OCCURS 0 .

INCLUDE STRUCTURE BAPIPAREX.

DATA:END OF IT_EXTENSIONINX.

DATA:TE TYPE BAPI_TE_MARA,

TEX TYPE BAPI_TE_MARAX.

DATA:header TYPE bapimathead .

DATA:makt1 LIKE bapi_makt OCCURS 0 WITH HEADER LINE.

data:bapiret2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA:CLIENTDATA TYPE BAPI_MARA .

data: material type mara-matnr.

material = '000000002000000108'.

header-material = material.

header-MATL_TYPE = 'ZPRT'.

HEADER-IND_SECTOR = 'M'.

HEADER-BASIC_VIEW = 'X'.

TE-MATERIAL = material.

TE-zzcode2 = 'C'.

TEX-MATERIAL = material.

TEX-zzcode2 = 'X'.

MOVE 'BAPI_TE_MARA' TO IT_EXTENSIONIN-STRUCTURE.

IT_EXTENSIONIN-VALUEPART1 = TE.

APPEND IT_EXTENSIONIN.

MOVE 'BAPI_TE_MARAX' TO IT_EXTENSIONINX-STRUCTURE.

IT_EXTENSIONINX-VALUEPART1 = TEX.

APPEND IT_EXTENSIONINX.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = HEADER

  • CLIENTDATA =

  • CLIENTDATAX =

  • PLANTDATA =

  • PLANTDATAX =

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

  • FLAG_ONLINE = ' '

  • FLAG_CAD_CALL = ' '

  • NO_DEQUEUE = ' '

  • NO_ROLLBACK_WORK = ' '

IMPORTING

RETURN = bapiret2

TABLES

  • MATERIALDESCRIPTION =

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

  • RETURNMESSAGES =

  • PRTDATA =

  • PRTDATAX =

EXTENSIONIN = IT_EXTENSIONIN

EXTENSIONINX = IT_EXTENSIONINX

  • NFMCHARGEWEIGHTS =

  • NFMCHARGEWEIGHTSX =

  • NFMSTRUCTURALWEIGHTS =

  • NFMSTRUCTURALWEIGHTSX =

.

if sy-subrc = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

endif.

thanks

sai

14 REPLIES 14

Former Member
0 Kudos

Hi,

When creating material master data, you must transfer the material number, the material type, and the industry sector to the method. You must also enter a material description and its language.

Regards

Nicole

Former Member
0 Kudos

hi nikole,

thanks for ur reply. i am not creating material. i am updating already existing material.

Thanks

Sai

raymond_giuseppi
Active Contributor
0 Kudos

There are already some threads with the same question of [extensionin in bapi_material_savedata|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=extensionin+bapi_material_savedata&adv=true&sdn_author_name=&sortby=cm_rnd_rankvalue] none of those provides you any clues ?

Also check if you can maintain those fields with transactions MM01/MM02 and MM17, if not, begin with OSS [Note 44410 - Integrating cust.-specific fields in matl master|https://service.sap.com/sap/support/notes/44410] only then will you be able to begin with the BAPI.

Regards

tarangini_katta
Active Contributor
0 Kudos

Hi,

We have the Extension one and extension1x in table paramters u can pass u r customer fields there.

just go through this.This is from function module of BAPI_MATERAIL_SAVEDATA.

Just u go thorugh the documentation

Besides the table fields already defined, customer-defined table fields can also be supplied with data. Since these fields are created by the customer, they are known only during the runtime and must therefore be determined dynamically.

The structures BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN, MLGT, MVKE) and the relevant checkbox structures BAPI_TE_<NAME> (<NAME> = MARAX, etc.) must first be extended by the customer to include the fields required. The standard structures contain only the corresponding key fields. When including new fields in these structures, make sure that the field has the same name as the field in the database table. In addition, the fields in the structures BAPI_TE_<NAME> may only be of the type CHARACTER. The data element BAPIUPDATE must be used for the fields in the checkbox structure (except for key fields).

The two parameters EXTENSIONIN and EXTENSIONINX are used to transfer the data to the method. The field STRUCTURE contains the name of the structure (for example, BAPI_TE_MARA or BAPI_TE_MARAX) used to identify the work area (for example, WA_BAPI_TE_MARA or WA_BAPI_TE_MARAX) to which the data is transferred. The remaining fields for the parameter EXTENSIONIN or EXTENSIONINX contain the data for the key fields (for example, the material number) and the data for the customer-defined fields. The number of characters reserved in the two parameters for the content of a customer-defined field must be the same as the number of characters for the corresponding work area field. If the number of characters required is smaller, the remaining characters in the two parameters must be filled with blanks. Only then may the content of another field be transferred. Here too, remember that the data is written to the database only if the corresponding indicator has been set in the work area.

Former Member
0 Kudos

Hello Sai,

Refer this code.

REPORT ZMATERIALEXTENSION line-size 500 no standard page heading .

************************************************************************

*

*----


  • T A B L E S

*----


.

tables: t001l, "Storage Locations

mara, "General Material Data

makt, "Material Descriptions

mbew, "Material Valuation

marc, "Plant Data for Material

mltx, "Purchase Order Descriptions

tq34, "Default values for inspection type

qmat. "Inspection type - material parameters

*DECLARING WORK AREAs TO BE PASSED TO THE FUNCTION MODULE.

data : ihead_data type BAPIMaTHEAD,

iclient_data type bapi_mara, "Client Data

iclient_datax type bapi_marax,

  • imakt like bapi_makt, "Mat Description

iplant_data like bapi_marc, "Plant View

iplant_datax like bapi_marcx,

iltxt type table of bapi_mltx with header line, "Pur Order Text

istoragelocationdata type bapi_mard, "Storage Location

istoragelocationdatax type bapi_mardx,

iaccounting_data like bapi_mbew, "Accounting View

iaccounting_datax like bapi_mbewx,

bapiret like bapiret2,

returnm type table of bapi_matreturn2 with header line.

*INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION

data: begin of it_makt occurs 0.

include structure bapi_makt.

data end of it_makt.

**Internal Table to hold the records in the text file

types:begin of it,

matnr(18), " Material number

mbrsh(1), " Industry sector

mtart(4), " Material type

werks(4), " Plant

LGORT_D(4), "Storage Location

maktx(40), " Material description

meins(3), " Base unit of measure

matkl(9) , " Material group

BISMT(18), " Old Material number

spart(2), " Division

gewei(3), " Weight Unit

TEXT1(30), " Purchasr Order Text

TEXT2(30),

TEXT3(30),

TEXT4(30),

TEXT5(30),

TEXT6(30),

DZEINR(22), " Document

ekgrp(3), " Purchasing group

EKWSL(4), " Purchase Value Key

WEBAZ(3), " Goods receipt processing time in days

DISMM(2), " MRP Type

MINBE(13), " Reorder point

DISPO(3), " MRP Controller

DISLS(2), " Lot size (materials planning)

MABST(13), " Maximum stock level

PLIFZ(3), " Planned delivery time in days

WEBAZ1(3), " Goods receipt processing time in days

FHORI(3), " Scheduling Margin Key for Floats

EISBE(13), " Safety stock

MTVFP(2), " Checking Group for Availability Check

LGPBE(10), " Storage Bin

QMATAUTH(6)," Material Authorization Group for Activities in QM

QMPUR(1), " QM in Procurement is Active

QSSPUR(8), " Control Key for Quality Management in Procurement

****************************************Add for Inspection setup

QPART1(8), " Inspection Type

QPART2(8),

QPART3(8),

QPART4(8),

QPART5(8),

QMATAKTIV1(1)," Inspection Type - Material Combination is Active

QMATAKTIV2(1),

QMATAKTIV3(1),

QMATAKTIV4(1),

QMATAKTIV5(1),

**************************************Add for Inspection setup

BKLAS(4), " Valuation Class

BWTTY_D(1), " Valuation Category

vprsv(1), " Price control indicator

VERPR_BAPI(23), " Moving average price/periodic unit price

PEINH(5), " Price Unit

end of it.

data: it_data type table of it ,

wa_data like line of it_data.

*Declaring Data Variables

data: fstring type string.

data: potext type string."Purchase Order Desc

*Internal Table for Messages

data:begin of it_ret occurs 0.

include structure bapiret2.

data end of it_ret.

data:begin of it_fret occurs 0.

include structure bapiret2.

data end of it_fret.

*Internal Table for Success Log

data:begin of s_fret occurs 0,

parameter like bapiret2-PARAMETER,

message like bapiret2-MESSAGE,

type like bapiret2-type,

end of s_fret.

*Internal Table for Error Log

data:begin of e_fret occurs 0,

parameter like bapiret2-PARAMETER,

message like bapiret2-MESSAGE,

type like bapiret2-type,

end of e_fret.

data:begin of main_table occurs 0,

parameter like bapiret2-PARAMETER,

message like bapiret2-MESSAGE,

type like bapiret2-type,

end of main_table.

*INTERNAL TABLE TO HOLD THE QMAT with Inspection Setup Data to be

*Distributed

data : insctrl type table of bapi1001004_qmat with header line.

*INTERNAL TABLE TO HOLD HEADER DATA

data: it_excel type alsmex_tabline occurs 0 with header line.

*SELECTION-SCREEN ELEMENTS

selection-screen begin of block b1 with frame title text-001.

parameter: fname type rlgrap-filename default 'c:\mat_extension.xls'.

parameter: slogfile type rlgrap-filename default 'c:\slog.txt'.

parameter: elogfile type rlgrap-filename default 'c:\elog.txt'.

parameters: p_begcol type i default '2' no-display,

p_begrow type i default '7' no-display,

p_endcol type i default '200' no-display,

p_endrow type i default '2500' no-display.

*perform f_get_data.

selection-screen end of block b1.

*DECLARATION OF EXCELAL TABLE

at selection-screen on value-request for fname.

perform f_get_file using fname.

start-of-selection.

perform f_xls_itab using fname

changing it_excel.

perform f_move_data.

perform f_get_data.

perform f_call_bapi.

&----


*& Form F_GET_FILE

&----


  • text

----


  • -->P_FNAME text

  • <--P_SY_SUBRC text

----


*****************************************************************

****************This routine will display F4 help against filename

form f_get_file using p_fname like fname.

******************************************************************

*********Fn Module for F4 help appear on the filename(on selection

*********screen)

call function 'KD_GET_FILENAME_ON_F4'

exporting

program_name = syst-repid

dynpro_number = syst-dynnr

  • FIELD_NAME = ' '

  • STATIC = ' '

  • MASK = ' '

changing

file_name = p_fname

  • EXCEPTIONS

  • MASK_TOO_LONG = 1

  • OTHERS = 2

.

if sy-subrc <> 0.

message e006(zhnc).

endif.

endform. " F_GET_FILE

&----


*& Form F_XLS_ITAB

&----


  • text

----


  • -->P_FNAME text

  • <--P_IT_EXCEL text

----


****************************************************************

***************This routine will convert the excel file data into

***************internal table

form f_xls_itab using p_fname

changing p_it_excel.

*********************************************************************

*********Fn Module to convert the excel file data into internal table

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exporting

filename = 'c:\mat_extension.xls'

i_begin_col = p_begcol

i_begin_row = p_begrow

i_end_col = p_endcol

i_end_row = p_endrow

tables

intern = it_excel

exceptions

inconsistent_parameters = 1

upload_ole = 2

others = 3.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

endform. " F_XLS_ITAB

&----


*& Form F_MOVE_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


**********************************************************************

***********This routine will move each record to an internal table row

form f_move_data .

data : lv_index type i.

field-symbols <fs>.

*--- Sorting the internal table

sort it_excel by row col.

clear it_excel.

loop at it_excel.

move it_excel-col to lv_index.

*--- Assigning the each record to an internal table row

assign component lv_index of structure wa_data to <fs>.

*--- Asigning the field value to a field symbol

move it_excel-value to <fs>.

at end of row.

append wa_data to it_data.

*

clear wa_data.

endat.

endloop.

endform. " F_MOVE_DATA

*********************************************************************

********************This routine will move data from internal table to

********************work areas to be passed to the BAPI

form f_get_data .

loop at it_data into wa_data.

move-corresponding wa_data to ihead_data.

********************************************************************

*******Fn Module to add the leading zeros to make the material to 18

*******char(SAP compatible)

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = WA_data-matnr

IMPORTING

OUTPUT = WA_data-matnr.

  • EXCEPTIONS

  • LENGTH_ERROR = 1

  • OTHERS = 2

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*

  • Header

ihead_data-material = wa_data-matnr.

ihead_data-ind_sector = wa_data-mbrsh.

ihead_data-matl_type = wa_data-mtart.

ihead_data-basic_view = 'X'.

ihead_data-purchase_view = 'X'.

ihead_data-MRP_VIEW = 'X'.

ihead_data-STORAGE_VIEW = 'X'.

ihead_data-QUALITY_VIEW = 'X'.

ihead_data-account_view = 'X'.

move-corresponding wa_data to iclient_data.

  • Material Description

refresh it_makt.

it_makt-langu = 'EN'.

it_makt-MATL_DESC = wa_data-maktx.

append it_makt.

  • Purchase Order Description

clear:iltxt,iltxt[].

CONCATENATE wa_data-text1 wa_data-text2 wa_data-text3 wa_data-text4

wa_data-text5 wa_data-text6 into POTEXT

SEPARATED BY SPACE.

iltxt-applobject = 'MATERIAL'.

iltxt-text_name = wa_data-matnr.

iltxt-text_id = 'BEST'.

iltxt-langu = sy-langu.

iltxt-langu_iso = 'EN'.

iltxt-format_col = space.

iltxt-text_line = POTEXT.

append iltxt.

  • Client Data - Basic

TRANSLATE wa_data-meins TO UPPER CASE.

iclient_data-matl_group = wa_data-matkl.

iclient_data-OLD_MAT_NO = wa_data-BISMT.

iclient_data-base_uom = wa_data-meins.

iclient_data-DOCUMENT = wa_data-DZEINR.

iclient_data-unit_of_wt = wa_data-gewei.

iclient_data-division = wa_data-spart.

iclient_data-QM_PROCMNT = wa_data-QMPUR.

iclient_data-PUR_VALKEY = wa_data-EKWSL.

iclient_datax-matl_group = 'X'.

iclient_datax-OLD_MAT_NO = 'X'.

iclient_datax-base_uom = 'X'.

  • iclient_datax-PO_UNIT = 'X'.

iclient_datax-DOCUMENT = 'X'.

iclient_datax-unit_of_wt = 'X'.

iclient_datax-division = 'X'.

iclient_datax-QM_PROCMNT = 'X'.

iclient_data-PUR_VALKEY = 'X'.

move-corresponding wa_data to iplant_data.

  • Plant - Purchasing

iplant_data-plant = wa_data-werks.

iplant_data-pur_group = wa_data-ekgrp.

iplant_data-GR_PR_TIME = wa_data-WEBAZ.

iplant_datax-plant = wa_data-werks.

iplant_data-pur_group = 'X'.

iplant_datax-GR_PR_TIME = 'X'.

*MRP1 View

TRANSLATE wa_data-DISPO TO UPPER CASE.

iplant_data-MRP_TYPE = wa_data-DISMM.

iplant_data-REORDER_PT = wa_data-MINBE.

iplant_data-MRP_CTRLER = wa_data-DISPO.

iplant_data-LOTSIZEKEY = wa_data-DISLS.

iplant_data-MAX_STOCK = wa_data-MABST .

iplant_datax-MRP_TYPE = 'X'.

iplant_datax-REORDER_PT = 'X'.

iplant_datax-MRP_CTRLER = 'X'.

iplant_datax-LOTSIZEKEY = 'X'.

iplant_datax-MAX_STOCK = 'X'.

*MRP2 View

iplant_data-PLND_DELRY = wa_data-PLIFZ.

iplant_data-SM_KEY = wa_data-FHORI.

iplant_data-CTRL_KEY = wa_data-QSSPUR.

iplant_data-AVAILCHECK = wa_data-MTVFP.

iplant_datax-PLND_DELRY = 'X'.

iplant_datax-SM_KEY = 'X'.

iplant_data-CTRL_KEY = 'X'.

iplant_datax-AVAILCHECK = 'X'.

*MRP3 View

iplant_data-SAFETY_STK = wa_data-EISBE.

iplant_data-QM_AUTHGRP = wa_data-QMATAUTH.

iplant_datax-SAFETY_STK = 'X'.

iplant_data-QM_AUTHGRP = 'X'.

move-corresponding wa_data to istoragelocationdata.

  • Inspection Setup

clear:insctrl,insctrl[].

insctrl-insptype = wa_data-QPART1.

insctrl-material = wa_data-matnr.

insctrl-plant = wa_data-werks.

insctrl-QUAL_SCORE_PROCEDURE = '06'.

insctrl-ind_insptype_mat_active = 'X'.

append insctrl.

if wa_data-QPART2 is not initial .

insctrl-insptype = wa_data-QPART2.

insctrl-material = wa_data-matnr.

insctrl-plant = wa_data-werks.

insctrl-QUAL_SCORE_PROCEDURE = '06'.

insctrl-ind_insptype_mat_active = 'X'.

append insctrl.

endif.

if wa_data-QPART3 is not initial .

insctrl-insptype = wa_data-QPART3.

insctrl-material = wa_data-matnr.

insctrl-plant = wa_data-werks.

insctrl-QUAL_SCORE_PROCEDURE = '06'.

insctrl-ind_insptype_mat_active = 'X'.

append insctrl.

endif.

if wa_data-QPART4 is not initial .

insctrl-insptype = wa_data-QPART4.

insctrl-material = wa_data-matnr.

insctrl-plant = wa_data-werks.

insctrl-QUAL_SCORE_PROCEDURE = '06'.

insctrl-ind_insptype_mat_active = 'X'.

append insctrl.

endif.

if wa_data-QPART5 is not initial .

insctrl-insptype = wa_data-QPART5.

insctrl-material = wa_data-matnr.

insctrl-plant = wa_data-werks.

insctrl-QUAL_SCORE_PROCEDURE = '06'.

insctrl-ind_insptype_mat_active = 'X'.

append insctrl.

endif.

  • Storage View

istoragelocationdata-plant = wa_data-werks.

istoragelocationdata-stge_loc = wa_data-LGORT_D.

istoragelocationdata-stge_bin = wa_data-LGPBE.

istoragelocationdatax-plant = wa_data-werks.

istoragelocationdatax-stge_loc = wa_data-LGORT_D.

istoragelocationdatax-stge_bin = 'X'.

  • Accounting

iaccounting_data-val_area = wa_data-werks.

iaccounting_data-price_ctrl = wa_data-vprsv.

iaccounting_data-MOVING_PR = wa_data-VERPR_BAPI.

iaccounting_data-PRICE_UNIT = wa_data-PEINH.

iaccounting_data-VAL_CLASS = wa_data-BKLAS.

iaccounting_data-VAL_CAT = wa_data-BWTTY_D.

iaccounting_datax-val_area = wa_data-werks.

iaccounting_datax-price_ctrl = 'X'.

iaccounting_datax-MOVING_PR = 'X'.

iaccounting_datax-PRICE_UNIT = 'X'.

iaccounting_datax-VAL_CLASS = 'X'.

iaccounting_datax-VAL_CAT = 'X'.

clear it_ret.

refresh it_ret.

perform f_call_bapi.

read table it_ret with key type = 'S'.

if sy-subrc eq 0.

perform f_bapi_commit.

endif.

endloop.

loop at main_table where type = 'S' .

s_fret-parameter = main_table-parameter .

s_fret-message = main_table-message .

append s_fret.

write: /2 s_fret-parameter,

21 s_fret-message.

endloop.

loop at main_table where type ne 'S'.

e_fret-parameter = main_table-parameter .

e_fret-message = main_table-message .

append e_fret.

write: /2 e_fret-parameter,

21 e_fret-message.

endloop.

fstring = slogfile.

perform download_data tables s_fret using fstring.

fstring = elogfile.

perform download_data tables e_fret using fstring.

endform. " F_GET_DATA

&----


*& Form F_CALL_BAPI

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form f_call_bapi .

************************************************************************

*********Call BAPI to upload a material from a flat file or from already

*********existing material

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = ihead_data

CLIENTDATA = iclient_data

CLIENTDATAX = iclient_datax

PLANTDATA = iplant_data

PLANTDATAX = iplant_datax

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

STORAGELOCATIONDATA = istoragelocationdata

STORAGELOCATIONDATAX = istoragelocationdatax

VALUATIONDATA = iaccounting_data

VALUATIONDATAX = iaccounting_datax

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA = istoragelocationdata

  • STORAGETYPEDATAX = istoragelocationdatax

  • FLAG_ONLINE = ' '

  • FLAG_CAD_CALL = ' '

  • NO_DEQUEUE = ' '

  • NO_ROLLBACK_WORK = ' '

IMPORTING

RETURN = it_ret

TABLES

MATERIALDESCRIPTION = it_makt

  • UNITSOFMEASURE = it_uom

  • UNITSOFMEASUREX = it_uomx

  • INTERNATIONALARTNOS =

MATERIALLONGTEXT = iltxt

  • TAXCLASSIFICATIONS =

RETURNMESSAGES = returnm.

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

it_fret-parameter = wa_data-matnr.

it_fret-message = it_ret-message.

it_fret-type = it_ret-type.

it_fret-ID = it_ret-ID.

it_fret-number = it_ret-number.

append it_fret.

main_table-parameter = it_fret-parameter.

main_table-message = it_fret-message.

main_table-type = it_fret-type.

append main_table.

*******************************************************************

********Fn Call for Insp Set Up******************************Start

CALL FUNCTION 'BAPI_MATINSPCTRL_SAVEREPLICA'

TABLES

return = returnm

inspectionctrl = insctrl.

.

*****************************************************************

*********Fn Call for Insp Set Up****************************End

endform. " F_CALL_BAPI

*

&----


*& Form F_BAPI_COMMIT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form f_bapi_commit .

**********************************************************************

************Fn Module to be called to write the changes to the database

call function 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

endform. " F_BAPI_COMMIT

*********************************************************************

****Call Fn Module for log file of Success/Error records*******Start

FORM download_data TABLES main_table USING g_filename.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = g_filename

filetype = 'ASC'

write_field_separator = 'X'

trunc_trailing_blanks = 'X'

TABLES

data_tab = main_table.

ENDFORM. "download_data

*********************************************************************

******Call Fn Module for logfile of Success/Error records*******End

top-of-page.

write: /3 'Material No' color 6 inverse on,

22 'Message' color 6 inverse on.

Hope this code will solve ur problem.

If further u r facing some problem then revert me back.

Aastha.

Former Member
0 Kudos

hi raymond,

we are maintaing those fields with MM01/MM02 trasactions.but still bapi is not updating.iam not getting any error also.

Thanks

Sai

0 Kudos

try to add HEADDATA-BASIC_VIEW = 'X' AND pass also CLIENTDATA and CLIENTDATAX parameters with initial values.

Regards

Former Member
0 Kudos

HI Raymond,

i am already included basic_view = 'X'..it is not working.

Thanks

Sai

Former Member
0 Kudos

any ideas

0 Kudos

try to

- add HEADDATA-BASIC_VIEW = 'X'

- pass also CLIENTDATA and CLIENTDATAX parameters with one field changed to its current value.

Regards

Former Member
0 Kudos

HI RAYMOND,

i have appended my custom fields to BAPI_TE_MARA,BAPI_TE_MARAX,MARA .i am populating custom fields in BAPI_TE_MARA and update flag in BAPI_TE_MARAX. i need to update only custom fields in BAPI_TE_MARA.. i am not changing any data in clientdata and cliendatax.so how i can pass clintdata clientdatax .

Thanks

Sai

0 Kudos

Hi,

try to work with FUBA MATERIAL_MAINTAIN_DARK instead of yours.

Regards

Nicole

0 Kudos

My hypothesis is that the treatment of BAPI tests if one view is to be updated and exit prematurely if this is not the case. As you update client customer data (MARA) i suggest to simulate an update of the client data. If that's true, then do we need to simulate an update on a standard field.

So, just choice any allowed field, and simulate a change by giving its current value, so the BAPI will try to change basic data.and not only customer fields. just put the actual value in one of CLIENTDATA structure and the corresponding flag in CLIENTDATAX.

(Use BAPI_MATERIAL_GET_DETAIL if you don't have data ready for that)

If that works, you may even try with initial CLIENTDATA and CLIENTDATAX, just call the BAPI with the HEADDATA-BASIC_VIEW flag on.

Regards

RoySayak
Active Participant
0 Kudos

Hi Sai,

After using BAPI_MATERIAL_SAVEDATA try to use COMMIT WORK.

IF sy-subrc IS INITIAL.
        COMMIT WORK.
      ELSE.
        ROLLBACK WORK.
      ENDIF.

Regards,

SR