Material inventory function module

Hallo,
I have to create a z-program that fill all screen of transaction MI02 from an internal table. So I create a material inventory document.
How can I proceded? Is better calling transaction MI02 or exists a funcion module that fill all item of materila inventory?

HI Gilbert
you can use BDC for that you have to record the transactiion in SHDB by entering the required fields.
for this you can do this in two ways.
one is convert the excel file into intetnal table and the other the save the excel file as tab delimited text file and upload it into internal table.
i am posting the sample code for the two methods.
<b>EXCEL:</b>
REPORT  UPLOAD_EXCEL no standard page heading.
*Data Declaration
data: itab like alsmex_tabline occurs 0 with header line.
Has the following format:
            Row number   | Colum Number   |   Value
     i.e.     1                 1             Name1
              2                 1             Joe
TYPES: Begin of t_record,
    name1 like itab-value,
    name2 like itab-value,
    age   like itab-value,
    End of t_record.
DATA: it_record type standard table of t_record initial size 0,
      wa_record type t_record.
DATA: gd_currentrow type i.
*Selection Screen Declaration
PARAMETER p_infile like rlgrap-filename.
*START OF SELECTION
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       exporting
            filename                = p_infile
            i_begin_col             = '1'
            i_begin_row             = '2'  "Do not require headings
            i_end_col               = '14'
            i_end_row               = '31'
       tables
            intern                  = itab
       exceptions
            inconsistent_parameters = 1
            upload_ole              = 2
            others                  = 3.
  if sy-subrc <> 0.
    message e010(zz) with text-001. "Problem uploading Excel Spreadsheet
  endif.
Sort table by rows and colums
  sort itab by row col.
Get first row retrieved
  read table itab index 1.
Set first row retrieved to current row
  gd_currentrow = itab-row.
  loop at itab.
  Reset values for next row
    if itab-row ne gd_currentrow.
      append wa_record to it_record.
      clear wa_record.
      gd_currentrow = itab-row.
    endif.
    case itab-col.
      when '0001'.                              "First name
        wa_record-name1 = itab-value.
      when '0002'.                              "Surname
        wa_record-name2 = itab-value.
      when '0003'.                              "Age
        wa_record-age   = itab-value.
    endcase.
  endloop.
  append wa_record to it_record.
*!! Excel data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
  loop at it_record into wa_record.
    write:/     sy-vline,
           (10) wa_record-name1, sy-vline,
           (10) wa_record-name2, sy-vline,
           (10) wa_record-age, sy-vline.
  endloop.
TAB-DELIMITED:
REPORT  ZBDCAPPL.
parameters: V_DATA(132) lower case.
data: begin of record OCCURS 0,
data element: MATNR
        MATNR_001(018),
data element: MBRSH
        MBRSH_002(001),
data element: MTART
        MTART_003(004),
data element: XFELD
        KZSEL_01_004(001),
data element: MAKTX
        MAKTX_005(040),
data element: MEINS
        MEINS_006(003),
data element: MATKL
        MATKL_007(009),
data element: SPART
        SPART_008(002),
      end of record.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = 'D:\ABAP\material.txt'
  FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
  HEADER_LENGTH                 = 0
  READ_BY_LINE                  = 'X'
  DAT_MODE                      = ' '
  CODEPAGE                      = ' '
  IGNORE_CERR                   = ABAP_TRUE
  REPLACEMENT                   = '#'
  CHECK_BOM                     = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
  TABLES
    DATA_TAB                      = RECORD
EXCEPTIONS
  FILE_OPEN_ERROR               = 1
  FILE_READ_ERROR               = 2
  NO_BATCH                      = 3
  GUI_REFUSE_FILETRANSFER       = 4
  INVALID_TYPE                  = 5
  NO_AUTHORITY                  = 6
  UNKNOWN_ERROR                 = 7
  BAD_DATA_FORMAT               = 8
  HEADER_NOT_ALLOWED            = 9
  SEPARATOR_NOT_ALLOWED         = 10
  HEADER_TOO_LONG               = 11
  UNKNOWN_DP_ERROR              = 12
  ACCESS_DENIED                 = 13
  DP_OUT_OF_MEMORY              = 14
  DISK_FULL                     = 15
  DP_TIMEOUT                    = 16
  OTHERS                        = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards
kishore

Similar Messages

  • Exact Material Enque Function Module:

    Hi all
    I am Creating Sales Document, delivery and PGI and Billing in One Shot.
    I am using BAPI_SALESORDER_CREATEFROMDAT2 to create sales Order
    For PGI and Billing I have written BDC.
    The Issue is some times it is working Perfectly and some times not.
    So any one tell me which enque FM to be used and at which point it should be used to ensure the perfect running of the program.
    Many en queue Function modules are there for material, But I am not getting which is to be used for this particular requirement.
    Can any one please help me on this.
    Thanks in advance.
    Regards
    Avinash

    hi,
    use ENQUEUE_E_TABLE
    DEQUEUE_E_TABLE
    thanks.

  • Material UOM function module in BW

    Is there a function module similar to MD_CONVERT_MATERIAL_UNIT in BW?  I need to convert some UOM in my start routine.
    thanks

    I do not think we have one in BW.
    We generally use factor value from T006 table and use them.

  • Any function module to get Stock and value of material on a given date?

    Hi Friends
    Is there any function module available to get Stock/and  value of material on a given date?
    Thanks
    Harish

    Sorry I didn't elaborate the requirement.
    I am asked to develop a custom report for inventory management. For range of materials it is required to display stock and value on particular date and GRs GIs for the range.
    I need function module to use in Zreport.
    Thanks
    Harish

  • Function Module or BAPI to get inventory turnover in abap

    Hello,
    is there a possibility to get the information of inventory turnover of an material with help of a function module oder BAPI?
    Like the transaction MC44. But I need it in an ABAP-Report. A simple calculation is easy, but not an exact calculation of the inventory turnover (Umschlagshäufikeit).

    Hi,
    http://hoopsdoc.hillyard.com/images/inventory%20management/MC44.htm
    http://www.erpgenie.com/sap-technical/abap/bapi-step-by-step-example
    Hope these links may help you.
    Thanks.

  • Is there a Function Module that gives a given year and month's inventory ?

    Hi!
    I want to asked whether a function module exists that gives the inventory value in a given storage location for a given plant at the end of a given month of a year .
    For example : I have a plan "2000" and a storage location "2001" and for the material "X" I want to learn the closing inventory of material X , say, at the end of January of 2004 or February of 2006 ?
    Thanks.
    Erkan VAROL

    Hi  Erkan,
       Try with this FM "BAPI_WHSE_STOCK_GET_LIST".
    Regards,
    Suresh Kumar.

  • Function Modules or Methods to Retrieve texts in Material Master

    Hi All,
    Can you get me a list of Function Modules which retrieve the text from Material Master.
    My requirement is to extract texts:
    Basic Text - at material level
    Purchase Order text - at material level
    Sales Texts - at material-sales org level
    Thanks in Advance.
    Sure Points for all Valuable answers
    Regards
    Vinayak

    hi
          u can get using read_text FM ask ur functionl person to give you the ID and other details required..
    u can also get it from STXH table... from which even the FM gets data..

  • Function Module to know the Acc doc no for a Material document.

    Dear Friends,
    What is the Function Module to know the Acc doc no for a Material document? Please help. Thanks in advance.
    Regards,
    RAMAN

    Hi Raman,
    I am not sure about your requirement,
    But i remember when i required the same like you i went to vrpma table to get the account document,
    I just did like a blind fold,
    as my company does all the billing accounts in the same month, my search criteria was blind.
    Also try with MKPF-XBLNR with the VBRK-XBLNR and get VBRK-VBELN
    from there goto BSEG.
    Thansk & regards,
    Dileep .C

  • Function module to get material characteristics and coresponding value

    Hi experts,
          I have got one problem...when we go to t code MM03..we select the views for a specific material for Basic Data1,Basic Data2 and Classification..in classification we get the material description and its corresponding values...
    These values we receive through specific class and its corresponding object....I want some Function Module which will allow me to receive the description and corresponding value for the material which will automatically retrieve the data for that material using the class and object...
    Please help me to sort this problem...
    Thanks in advance

    TRY these two FMs
    1) CLAF_CLASSIFICATION_OF_OBJECTS and
    2) Bapi_objcl_getdetails.
    for first one it gets the all characteristics assigned to the class even though the values are not assigned
    in second case onle the vlaues assigned characteristics will get

  • Function module to get Conditions based on Customer & Material

    Hi,
    Is there any function module such that the list of conditions are displayed, based on Customer & Material given?
    Thnx in advance,
    Shivaa.....

    actualy Jan this report is based on GL account no..GL acount no.s dat we required are not there in bsid n bsad...we need bank related GL account no..IN BSID n BSAD all GL account no. are customer GL account no.s...

  • Function module to read 'Customer Material InfoRecords'?

    Is there a function module to read customer material inforecords?
    Transaction code VD53 is the display screen for Customer Material INforecords. I have a requirement to read this data in user exit.
    Thanks
    Gova

    I found one FM. RV_CUSTOMER_MATERIAL_READ
    But it won't serve my purpose as I need to find customer material number for a given material number.
    But, I found the table where this information is stored. KNMT. I'm going to create a custom FM to serve my purpose.

  • Function Module for listing Equipments based on Material Number

    Hi,
       I need to display list of Equipments based on the given Material Number.
       This can be done by simple query statement as given below,
              SELECT equnr matnr sernr FROM equi
              INTO CORRESPONDING FIELDS OF TABLE <Int Table>
              WHERE matnr IN im_matnr.
        But, I need Function module to acheive this. Can anyone suggest me the Standard Function module which works as mentioned above?

    Hi Shirlatha,
    If you need to  only above code  value  then you can create own FM  and pass the MATNR only.
    In SAP BAPI_EQMT_DETAIL  one FM is there to get complete Equipment details but need to pass matnr and Equipment  number.
    Please try to use this FM or you can create Own FM.
    Regards,
    Prasenjit

  • Material price change with variable G/L account - which function module?

    Hi,
    do you know a function module which allows to change the material price (S or V) and accepts a cost center for the price variances that is not the one from customizing?

    Hi Tony.
    I feel that you are in extended classic scenario.
    For the "extended classic scenario" with services you must consider the following corrections in the R/3 system as of Release 40.
    1) Three new function modules
    2) Source code corrections in R/3 System
    ->  account assignment category in R/3 system can be changed for EBP
    These information are from one SAP note.
    Note 431954 - Extended classic scenario (services): Changes in R/3.
    regards,nishant
    please reward point if this helps

  • Function Module for calculation of the net price of a configurable material

    Hi,
    I would like to know if a function module allows to calculate the purchasing /net price of a configurable material at a vendor and at a requested delivery date before the creation of a purchasing order.
    For configurable materials, we have no PIR and no moving / standard price thus the valuation price in the PR is blank.
    I would like to fill in the field "valuation price" in the PR with the net price we can find in the PO.
    However the PR is created before the PO.
    Thanks a lot in advance for yours reply.
    regards,

    hi Pravenn,
    I don't know about these functions, but u can try anything like this:
    data:
    strdate like sy-datum value '20070901',
          enddate like sy-datum value '20070909',
          date(10),
          moddate(1).
    date = enddate - strdate + 1.
    moddate = date mod 7.
    date = date div 7.
    if moddate <> 0.
      date = date + 1.
    endif.
    write: / date.
    Regards
    Allan Cristian
    Message was edited by:
            Allan Cristian

  • Function modules for material and description

    Hi,
    Pls let me know the function module for material and description.
    Regards,
    Bala

    Hi,
    Please use FM: MD_MATERIAL_GET_TEXT
    Reagrds
    Raju

Maybe you are looking for

  • Bad sound in my x-fi audio after windows upd

    I have accidentally downloaded this @ windows update on tuesday? Creative - Sound - Creative X-Fi Audio Processor (WDM)Creative Sound sofware update released in June, 2007? After that all my sound options were gone and i have a terrible bad sound. Is

  • Too much empty lines in paragraph

    I'm making a book. And there is strange InDesign behaviour. Please look at screenshot and you will understand the problem. there are 4 lines for text and just 2 lines of text. But InDesign moves this 2 lines into other page. I have even uncheked "Kee

  • Suppress -signed on a Signed Document

    Whenever, I sign a document, then go to save it, it always has the document name with '-signed' at the end of it.  Is there a way to always suppress the '-signed' addition?

  • 500 Internal Server Error - JDeveloper

    I am trying to complete a tutorial in JDeveloper 11g. I realize that this is a beta/demo version of JDeveloper, but I do not think that this is the reason I am having a problem. When I run my application, I get this error in my browser: 500 Internal

  • Netbeans C++ configuration on a MAC OS X Mountain Lion

    I have NetBeans installed with a C++ compiler. When I first downloaded NetBeans and the compiler, netBeans automatically configured the C++ compiler. Now I have upgraded to the new operating system mountain lion. Now whenever I try to compile a C++ p