Skip to Content
author's profile photo Former Member
Former Member

hI ALL

HI ALL,

I AM USING A BAPI TO UPLOAD MATERIAL MASTER DATA. MY CODE IS GIVEN BELOW

***&----


****& Report ZBAPI_MATERIAL_UPLOAD

****&

***&----


****&

****&

***&----


***

REPORT ZBAPI_MATERIAL_UPLOAD NO STANDARD PAGE HEADING.

***

***

***

***

****&----


****& Report ZBAPI_MATERIAL_SAVEDATA

****&

****&----


****& AUTHOR

****&----


****& PURPOSE : THIS REPORT USES BAPI MATERIAL SAVE DATA TO UPDATE AND CREATE

****& THE MATERIAL

****&

****&

****&

****&

****&----


***

****REPORT ZBAPI_MATERIAL_SAVEDATA NO STANDARD PAGE HEADING MESSAGE-ID (ZHNC).

***

***TYPES:BEGIN OF TY_MAT,

***MATERIAL(4),

***IND_SECTOR(1),

***MATL_TYPE(4),

***

***

***BASIC_VIEW(1),

***SALES_VIEW(1),

***PURCHASE_VIEW(1),

***STORAGE_VIEW(1),

***MATL_GROUP(9),

***BASE_UOM(3),

***BASE_UOM_ISO(3),

***

***MATL_GROUP1(1),

***BASE_UOM1(1),

***BASE_UOM_ISO1(1),

***PLANT(4),

***DEL_FLAG(1),

***PUR_GROUP(3),

***BASE_QTY(13),

***

***PLANT2(4),

***DEL_FLAG5(1),

***PUR_GROUP1(1),

***BASE_QTY1(1),

***PLANT3(4),

***STGE_LOC(4),

***MRP_IND(1),

***

***PLANT4(4),

***STGE_LOC1(4),

***MRP_IND1(1),

***SALES_ORG(4),

***DISTR_CHAN(2),

***DEL_FLAG1(1),

***MIN_ORDER(13),

***

***SALES_ORG1(4),

***DISTR_CHAN1(2),

***DEL_FLAG2(1),

***MIN_ORDER1(1),

***LANGU(2),

***MATL_DESC(40),

***

***END OF TY_MAT.

***

***DATA: IT_DATA TYPE TABLE OF TY_MAT,

***WA_DATA LIKE LINE OF IT_DATA.

***

****decalraing flag

***

***data: v_flag value ''.

***

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

***

***DATA: BAPI_HEAD LIKE BAPIMATHEAD,

***BAPI_CLIENTDATA LIKE BAPI_MARA,

***BAPI_CLIENTDATAX LIKE BAPI_MARAX,

***BAPI_PLANTDATA LIKE BAPI_MARC,

***BAPI_PLANTDATAX LIKE BAPI_MARCX,

***BAPI_STORAGELOCATIONDATA LIKE BAPI_MARD,

***BAPI_STORAGELOCATIONDATAX LIKE BAPI_MARDX,

***BAPI_SALESDATA LIKE BAPI_MVKE,

***BAPI_SALESDATAX LIKE BAPI_MVKEX,

***BAPI_MAKT LIKE BAPI_MAKT,

***BAPI_RETURN LIKE BAPIRET2.

***

****INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION

***

***DATA: BEGIN OF IT_MAKT OCCURS 0.

***INCLUDE STRUCTURE BAPI_MAKT.

***DATA END OF IT_MAKT.

***

***DATA:BEGIN OF IT_RET OCCURS 0.

***INCLUDE STRUCTURE BAPIRET2.

***DATA END OF IT_RET.

***

****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 OBLIGATORY DEFAULT 'C:\Documents and Settings\Administrator\Desktop\MATMAS.XLS' .

***PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,

***P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,

***P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,

***P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.

***

***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.

***

****&----


  • Form F_GET_FILE

****&----


***

****text

***

****-->P_FNAME text

****<--P_SY_SUBRC text FORM F_GET_FILE USING P_FNAME LIKE FNAME.

***

***CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

***EXPORTING

***PROGRAM_NAME = SYST-REPID

***DYNPRO_NUMBER = SYST-DYNNR

***

***FIELD_NAME = ' '

***STATIC = ' '

***MASK = ' '

***CHANGING

***FILE_NAME = 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 FORM F_XLS_ITAB USING P_FNAME

****CHANGING P_IT_EXCEL.

***

***CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

***EXPORTING

***FILENAME = FNAME

***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 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

***&----


****& Form F_GET_DATA

***&----


***

***text

***

***--> p1 text

***<-- p2 text FORM F_GET_DATA .

***LOOP AT IT_DATA INTO WA_DATA.

***

***MOVE-CORRESPONDING WA_DATA TO BAPI_HEAD.

***

***BAPI_HEAD-BASIC_VIEW ='X'.

***

***BAPI_HEAD-SALES_VIEW ='X'.

***

***BAPI_HEAD-PURCHASE_VIEW ='X'.

***

***BAPI_HEAD-STORAGE_VIEW ='X'.

***

***MOVE-CORRESPONDING WA_DATA TO BAPI_CLIENTDATA.

***

***BAPI_CLIENTDATAX-MATL_GROUP = 'X'.

***

***BAPI_CLIENTDATAX-BASE_UOM = 'X'.

***

***BAPI_CLIENTDATAX-BASE_UOM_ISO = 'X'.

***

***MOVE-CORRESPONDING WA_DATA TO BAPI_PLANTDATA.

***

***BAPI_PLANTDATAX-PLANT = BAPI_PLANTDATA-PLANT.

***

***BAPI_PLANTDATAX-DEL_FLAG = 'X'.

***

***BAPI_PLANTDATAX-PUR_GROUP = 'X'.

***

***BAPI_PLANTDATAX-BASE_QTY = 'X'.

***

***MOVE-CORRESPONDING WA_DATA TO BAPI_STORAGELOCATIONDATA.

***

***BAPI_STORAGELOCATIONDATA-PLANT = BAPI_PLANTDATA-PLANT.

***

***BAPI_STORAGELOCATIONDATAX-PLANT = BAPI_STORAGELOCATIONDATA-PLANT.

***

***BAPI_STORAGELOCATIONDATAX-STGE_LOC = BAPI_STORAGELOCATIONDATA-STGE_LOC.

***

***BAPI_STORAGELOCATIONDATAX-MRP_IND = 'X'.

***

***MOVE-CORRESPONDING WA_DATA TO BAPI_SALESDATA.

***

***BAPI_SALESDATAX-SALES_ORG = BAPI_SALESDATA-SALES_ORG.

***

***BAPI_SALESDATAX-DISTR_CHAN = BAPI_SALESDATA-DISTR_CHAN.

***

***BAPI_SALESDATAX-DEL_FLAG = BAPI_SALESDATA-DEL_FLAG.

***

***BAPI_SALESDATAX-MIN_ORDER = 'X'.

***

***REFRESH IT_MAKT.

***

***IT_MAKT-LANGU = WA_DATA-LANGU.

***

***IT_MAKT-MATL_DESC = WA_DATA-MATL_DESC.

***

***APPEND IT_MAKT.

***

***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.

***

***WRITE:/ 'MATERIAL CREATED OR UPDATED SUCESSFULLY WITH MATERIAL NO',WA_DATA-MATERIAL.

***

***ELSE.

***

***MESSAGE E000(ZHNC) WITH 'ERROR IN CREATING THE MATERIAL'.

***

****WRITE: / 'ERROR IN CREATIN MATERIAL',IT_RET-MESSAGE.

***

****PERFORM F_DOWNLOAD.

***

***ENDIF.

***

****ENDIF.

***

***ENDLOOP.

***

***ENDFORM. " F_GET_DATA

****&----


****& Form F_CALL_BAPI

****&----


***

***text

***

****--> p1 text

****<-- p2 text FORM F_CALL_BAPI .

***CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

***EXPORTING

***HEADDATA = BAPI_HEAD

***CLIENTDATA = BAPI_CLIENTDATA

***CLIENTDATAX = BAPI_CLIENTDATAX

***PLANTDATA = BAPI_PLANTDATA

***PLANTDATAX = BAPI_PLANTDATAX

***STORAGELOCATIONDATA = BAPI_STORAGELOCATIONDATA

***STORAGELOCATIONDATAX = BAPI_STORAGELOCATIONDATAX

***SALESDATA = BAPI_SALESDATA

***SALESDATAX = BAPI_SALESDATAX

***IMPORTING

***RETURN = IT_RET

***TABLES

***MATERIALDESCRIPTION = IT_MAKT

***

***UNITSOFMEASURE =

***UNITSOFMEASUREX =

***INTERNATIONALARTNOS =

***MATERIALLONGTEXT =

***TAXCLASSIFICATIONS =

***RETURNMESSAGES =

***PRTDATA =

***PRTDATAX =

***EXTENSIONIN =

***EXTENSIONINX =

***.

***

***APPEND IT_RET.

***

***ENDFORM. " F_CALL_BAPI

***&----


****& Form F_BAPI_COMMIT

***&----


***

***text

***--> p1 text

***<-- p2 text FORM F_BAPI_COMMIT .

***

***CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

***

***EXPORTING

***WAIT =

***IMPORTING

***RETURN =

***.

***

***ENDFORM. " F_BAPI_COMMIT

*****************************8ANOTHER PROGRAM FOR MATERIAL UPLOAD TESTING***********************************************************************

&----


*& Report ZKAR_MATMAS_BAPI

&----


*& This program demonstrates how easy it is to create Material master

*& data using BAPI_MATERIAL_SAVEDATA

*& The program also generates a report post-execution displaying errors

*& as well as successful uploads

&----


*REPORT ZKAR_MATMAS_BAPI.

----


  • TABLES

----


----


  • FLAGS *

----


DATA: F_STOP. " Flag used to stop processing

----


  • DATA DECLARATIONS *

----


DATA : V_EMPTY TYPE I, " No. of empty records

V_TOTAL TYPE I. " Total no. of records.

----


  • STRUCTURES & INTERNAL TABLES

----


*BAPI structures

----


DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information

BAPI_MAKT LIKE BAPI_MAKT, " Material Description

BAPI_MARA1 LIKE BAPI_MARA, " Client Data

BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA

BAPI_MARC1 LIKE BAPI_MARC, " Plant View

BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC

BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View

BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW

BAPI_RETURN LIKE BAPIRET2. " Return Parameter

*--- Internal table to hold excel file data

DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

*--- Internal table to hold Matetrial descriptions

DATA: BEGIN OF IT_MAKT OCCURS 100.

INCLUDE STRUCTURE BAPI_MAKT.

DATA: END OF IT_MAKT.

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

DATA : BEGIN OF IT_DATA OCCURS 100,

MATNR(18), " Material number

MBRSH(1), " Industry sector

MTART(4), " Material type

MAKTX(40), " Material description

MEINS(3) , " Base unit of measure

  • WERKS(4), " Plant

*

  • MTART(4), " Material type

*

*

*

  • MATKL(9) , " Material group

*

*

*

  • GEWEI(3), " Weight Unit

*

  • SPART(2), " Division

*

  • EKGRP(3), " Purchasing group

*

  • VPRSV(1), " Price control indicator

*

  • STPRS(12), " Standard price

*

  • PEINH(3), " Price unit

  • SPRAS(2), " Language key

END OF IT_DATA.

----


  • SELECTION SCREEN. *

----


SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.

PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT " Input File

'C:\Users\Amit singh\Desktop\bapi_test.xls'.

PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session

PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines

PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,

P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,

P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,

P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.

SELECTION-SCREEN END OF BLOCK SCR1.

----


  • AT SELECTION-SCREEN *

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

*--- Validating file

PERFORM VALIDATE_FILE USING P_FILE.

----


  • START-OF-SELECTION

----


START-OF-SELECTION.

*--- Perform to convert the Excel data into an internal table

PERFORM CONVERT_XLS_ITAB.

IF NOT IT_DATA[] IS INITIAL.

*--- Perform to delete Header lines

PERFORM DELETE_HEADER_EMPTY_RECS.

ENDIF.

----


  • END OF SELECTION. *

----


END-OF-SELECTION.

*--- Perform to upload Material Master data

PERFORM UPLOAD_MATMAS.

----


  • Form : validate_input_file

----


  • Description : To provide F4 help for file if read from PC

----


FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

CHANGING

FILE_NAME = F_FILE

EXCEPTIONS

MASK_TOO_LONG = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.

ENDIF.

ENDFORM. " validate_input_file

&----


*& Form CONVER_XLS_ITAB

&----


  • text

----


FORM CONVERT_XLS_ITAB.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = P_FILE

I_BEGIN_COL = P_BEGCOL

I_BEGIN_ROW = P_BEGROW

I_END_COL = P_ENDCOL

I_END_ROW = P_ENDROW

TABLES

INTERN = IT_INTERN.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*--- Perform to move the data into an internal data

PERFORM MOVE_DATA.

ENDFORM. " CONVERT_XLS_ITAB

&----


*& Form MOVE_DATA

&----


  • text

----


FORM MOVE_DATA.

DATA : LV_INDEX TYPE I.

FIELD-SYMBOLS <FS>.

*--- Sorting the internal table

SORT IT_INTERN BY ROW COL.

CLEAR IT_INTERN.

LOOP AT IT_INTERN.

MOVE IT_INTERN-COL TO LV_INDEX.

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

ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS>.

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

MOVE IT_INTERN-VALUE TO <FS>.

AT END OF ROW.

APPEND IT_DATA.

CLEAR IT_DATA.

ENDAT.

ENDLOOP.

ENDFORM. " MOVE_DATA

&----


*& Form DELETE_HEADER_EMPTY_RECS

&----


  • To delete the Header and empty records

----


FORM DELETE_HEADER_EMPTY_RECS.

DATA: LV_TABIX LIKE SY-TABIX.

IF NOT P_HEADER IS INITIAL.

LOOP AT IT_DATA.

IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.

DELETE IT_DATA FROM 1 TO P_HEADER.

  • P_HEADER = 0.

EXIT.

ENDIF.

ENDLOOP.

ENDIF.

CLEAR IT_DATA.

*--- To delete the empty lines from internal table

LOOP AT IT_DATA.

LV_TABIX = SY-TABIX.

IF IT_DATA IS INITIAL.

V_EMPTY = V_EMPTY + 1.

DELETE IT_DATA INDEX LV_TABIX..

ENDIF.

ENDLOOP.

CLEAR IT_DATA.

*--- Total no of recs in file

DESCRIBE TABLE IT_DATA LINES V_TOTAL.

IF V_TOTAL = 0.

MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file

F_STOP = 'X'.

STOP.

ENDIF.

ENDFORM. " DELETE_HEADER_EMPTY_RECS

&----


*& Form UPLOAD_MATMAS

&----


  • to upload Material Master data

----


FORM UPLOAD_MATMAS .

LOOP AT IT_DATA.

  • Header

BAPI_HEAD-MATERIAL = IT_DATA-MATNR.

BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.

BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.

BAPI_HEAD-BASIC_VIEW = 'X'.

*BAPI_HEAD-PURCHASE_VIEW = 'X'.

*

*BAPI_HEAD-ACCOUNT_VIEW = 'X'.

  • Material Description

REFRESH IT_MAKT.

*IT_MAKT-LANGU = IT_DATA-SPRAS.

IT_MAKT-MATL_DESC = IT_DATA-MAKTX.

APPEND IT_MAKT.

  • Client Data - Basic

*BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.

*************************ERROR*****************************************

BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.

***********************ERROR********************************************

*BAPI_MARA1-BASE_UOM_ISO = IT_DATA-MEINS.

*BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.

*BAPI_MARA1-DIVISION = IT_DATA-SPART.

*BAPI_MARAX-MATL_GROUP = 'X'.

*

BAPI_MARAX-BASE_UOM = 'X'.

*

*BAPI_MARAX-UNIT_OF_WT = 'X'.

*

*BAPI_MARAX-DIVISION = 'X'.

  • Plant - Purchasing

*BAPI_MARC1-PLANT = IT_DATA-WERKS.

*BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.

*BAPI_MARCX-PLANT = IT_DATA-WERKS.

*BAPI_MARCX-PUR_GROUP = 'X'.

  • Accounting

*BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.

*BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.

*BAPI_MBEW1-STD_PRICE = IT_DATA-STPRS.

*BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.

*BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.

*BAPI_MBEWX-PRICE_CTRL = 'X'.

*

*BAPI_MBEWX-STD_PRICE = 'X'.

*

*BAPI_MBEWX-PRICE_UNIT = 'X'.

*--- BAPI to create material

call function 'BAPI_MATERIAL_SAVEDATA'

exporting

HEADDATA = BAPI_HEAD

CLIENTDATA = BAPI_MARA1

CLIENTDATAX = BAPI_MARAX

*PLANTDATA = BAPI_MARC1

*PLANTDATAX = BAPI_MARCX

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA = BAPI_MBEW1

  • VALUATIONDATAX = BAPI_MBEWX

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA = BAPI_MVKE1

  • SALESDATAX = BAPI_MVKEX

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

IMPORTING

RETURN = BAPI_RETURN

TABLES

MATERIALDESCRIPTION = IT_MAKT

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

  • RETURNMESSAGES =

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

IF BAPI_RETURN-TYPE = 'E'.

WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,it_data-matnr.

ELSEIF BAPI_RETURN-TYPE = 'S'.

WRITE: 'Successfully created material' ,it_data-matnr.

ENDIF.

ENDLOOP.

ENDFORM. " UPLOAD_MATMAS

THE ERROR LINE IS BETWEEN THE STARS.

AND ERROR SAYS THAT

The field MARA-MEINS/BAPI_MARA-BASE_UOM(_ISO) is defined as a required field; it does not contain an entry

for material: mat45667

PLEASE HELP ME OUT ON THIS .

POINTS WILL BE REWARDED

REGARDS

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jun 17, 2008 at 10:39 AM

    Amit,

    Have you check for material 45667 in MM03?

    first check in mm03 is UOM is base unit or sales unit?

    and the same unit you have to provide by your program.

    and also please do not throw the whole peace of code here

    for better replies.because nobody can read your whole code so please be specific for better and quick replies.

    Hope this would not hurt you.

    kindly support SDN!

    Amit.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 11:11 AM

    thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 06:16 AM

    hi still pending

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.