PO Text in MM01 transaction

Hello ppl
    Iam writing a BDC program for Material Master loads..using MM01 trransaction. Iam stuck with the PO text field since I dont see that in the recording. Can anyone please let me know how to proceed. Its a bit urgent.
I appreciate your help.
Thanks,
~V

You know, I could get the SAVE_TEXT to work for me, but it does in a lot of cases, there may be something in the material master preventing it from showing.  Anyway, lets go a different route.  Lets use the BAPI instead.  I have done this example and it works good.
report zrich_0001.
data: headdata type bapimathead.
data: iltxt type table of bapi_mltx with header line.
data: return type  bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.
parameters: p_matnr type mara-matnr.
select single * from mara into xmara
          where matnr = p_matnr.
headdata-material        = xmara-matnr.
headdata-ind_sector      = xmara-mbrsh.
headdata-matl_type       = xmara-mtart.
headdata-basic_view = 'X'.
headdata-purchase_view = 'X'.
iltxt-applobject = 'MATERIAL'.
iltxt-text_name  = p_matnr.
iltxt-text_id    = 'BEST'.
iltxt-langu      = sy-langu.
iltxt-langu_iso  = 'EN'.
iltxt-format_col = space.
iltxt-text_line  = 'This is line 1'.
append iltxt.
iltxt-text_line  = 'This is line 2'.
append iltxt.
call function 'BAPI_MATERIAL_SAVEDATA'
     exporting
          headdata         = headdata
     importing
          return           = return
     tables
          materiallongtext = iltxt
          returnmessages   = returnm.
check sy-subrc  = 0.
Regards,
Rich Heilman

Similar Messages

  • Bdc for mm01 transaction

    Hi friends,
        I have to upload data using mm01 transaction.
        My program has to select respective views according to material type.
        Can anybody help me.
    Thanks and regards,
    Pavani.

    Hi,
    You will save lot of time & energy if you opt to use BAPI_MATERIAL_SAVEDATA. Have a look @the sample code. Please note Do not allocate any points as this code doesn't belong to me, however I have tested it & it works fine.
    TABLES bapi_MVKEx.
    * 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_MVKE1 LIKE BAPI_MVKE, "Sales Data
    BAPI_RETURN LIKE BAPIRET2. " Return Parameter
    DATA: return     LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    *--- 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,
    WERKS(4), " Plant
    MTART(4), " Material type
    MATNR(18), " Material number
    MATKL(9) , " Material group
    MBRSH(1), " Industry sector
    MEINS(3), " Base unit of measure
    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
    MAKTX(40), " Material description
    MTPOS_MARA(4), "Item Category Group
    vkorg(4), "Sales Org
    vtweg(2), "Dist channel
    Prdha(18), "Prod Hierarchy
    ladgr(4), " Loading Group
    prctr(10), "Profit Centr
    xchpf(1), "Batch Mgmt
    kondm(2), "Material Pricing Grp
    ktgrm(2), "Account Assignment Grp
    mvgr1(4),
    mvgr2(4),
    mvgr3(4),
    versg(1), "Material Statistics Grp
    * Added fields not part of the layout
    sapmatnr(18),
    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
    'H:\DATA\Nova\rbc\zrbc129.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'
    exporting
    STATIC = 'X'
    CHANGING
    FILE_NAME = F_FILE
    EXCEPTIONS
    MASK_TOO_LONG = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    *MESSAGE S010" 'Error in getting filename'.
    ENDIF.
    ENDFORM. " validate_input_file
    *& Form CONVER_XLS_ITAB
    * To convert XLS to internal table
    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> type any.
    *--- 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
    <fs> = it_intern-value.
    *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" 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
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        input              = it_data-matnr
    IMPORTING
       OUTPUT             =  it_data-sapmatnr
    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.
    BAPI_HEAD-MATERIAL = IT_DATA-sapMATNR.
    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'.
    BAPI_HEAD-SALES_VIEW = 'X'.
    BAPI_HEAD-QUALITY_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.
    BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
    BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.
    BAPI_MARA1-DIVISION = IT_DATA-SPART.
    BAPI_MARA1-item_cat = it_data-mtpos_mara.
    BAPI_MARA1-PROD_HIER = it_data-prdha.
    bapi_marax-item_cat = 'X'.
    bapi_marax-prod_hier = 'X'.
    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_MARC1-LOADINGGRP = IT_DATA-LADGR.
    BAPI_MARC1-PROFIT_CTR = IT_DATA-prctr.
    BAPI_MARC1-BATCH_MGMT = IT_DATA-xchpf.
    bapi_marc1-qm_authgrp = 'X'.
    bapi_marcx-qm_authgrp = 'X'.
    BAPI_MARCX-PLANT = IT_DATA-WERKS.
    BAPI_MARCX-PUR_GROUP = 'X'.
    BAPI_MARCX-LOADINGGRP = 'X'.
    BAPI_MARCX-PROFIT_CTR = 'X'.
    BAPI_MARCX-BATCH_MGMT = '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'.
    * Sales Data
    BAPI_MVKE1-ITEM_CAT = IT_DATA-MTPOS_MARA.
    BAPI_MVKEX-ITEM_CAT = 'X'.
    BAPI_MVKE1-SALES_ORG = IT_DATA-vkorg.
    BAPI_MVKEX-SALES_ORG = IT_DATA-vkorg.
    BAPI_MVKE1-DISTR_CHAN = IT_DATA-vtweg.
    BAPI_MVKEX-DISTR_CHAN = IT_DATA-vtweg.
    BAPI_MVKE1-MAT_PR_GRP = IT_DATA-kondm.
    BAPI_MVKEX-MAT_PR_GRP = 'X'.
    BAPI_MVKE1-ACCT_ASSGT = IT_DATA-ktgrm.
    BAPI_MVKEX-ACCT_ASSGT = 'X'.
    BAPI_MVKE1-MATL_GRP_1 = IT_DATA-mvgr1.
    BAPI_MVKEX-MATL_GRP_1 = 'X'.
    BAPI_MVKE1-MATL_GRP_2 = IT_DATA-mvgr2.
    BAPI_MVKEX-MATL_GRP_2 = 'X'.
    BAPI_MVKE1-MATL_GRP_3 = IT_DATA-mvgr3.
    BAPI_MVKEX-MATL_GRP_3 = 'X'.
    BAPI_MVKE1-matl_stats = IT_DATA-versg.
    BAPI_MVKEX-matl_stats = '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
    SALESDATA = BAPI_MVKE1
    SALESDATAX = BAPI_MVKEX
    IMPORTING
    RETURN = BAPI_RETURN
    TABLES
    MATERIALDESCRIPTION = IT_MAKT
    IF BAPI_RETURN-TYPE = 'E'.
    WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,it_data-matnr.
    ELSEIF BAPI_RETURN-TYPE = 'S'.
    WRITE: 'Successfully created/Changed material' ,it_data-matnr.
          CLEAR return.
          REFRESH return.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               IMPORTING
                    return = return.
    ENDIF.
    ENDLOOP.
    ENDFORM. " UPLOAD_MATMAS
    Regards
    Raju Chitale

  • BDC code for MM01 Transaction

    Hi All,,
                 Please give Entire BDC code for MM01 Transaction.
    i will change as per my requirement.
    I think this is already done by some ABAP Consultants.
    plz dont give answers like do recording for that transaction MM01. I know recording...
    For time constraiint, I have to complete soon.....
    Thanks in Advance
    BestRegards,
    Anil

    Hi,
    The below code is using the Session Method
    report ZDS_BDC_MM01
           no standard page heading line-size 255.
    include bdcrecx1.
    *parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    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: XFELD
            KZSEL_02_005(001),
    * data element: MAKTX
            MAKTX_006(040),
    * data element: MEINS
            MEINS_007(003),
    * data element: MAKTX
            MAKTX_008(040),
          end of record.
    *** End generated data section ***
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      ='C:\DHRUV.TXT'
       FILETYPE                      = 'DAT'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * 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.
    *do.
    LOOP AT record.
    *read dataset dataset into record.
    if sy-subrc <> 0. exit. endif.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-MATNR_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_004.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(02)'
                                  record-KZSEL_02_005.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_006.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_007.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_008.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM01'.
    *enddo.
    ENDLOOP.
    perform close_group.
    *perform close_dataset using dataset.
    *Text elements
    * E00 Error opening dataset, return code:
    * I01 Session name
    * I02 Open session
    * I03 Insert transaction
    * I04 Close Session
    * I05 Return code =
    * I06 Error session created
    * S01 Session name
    * S02 User
    * S03 Keep session
    * S04 Lock date
    * S05 Processing Mode
    * S06 Update Mode
    * S07 Generate session
    * S08 Call transaction
    * S09 Error sessn
    * S10 Nodata indicator
    * S11 Short log
    *Messages
    * Message class: MS
    *613   Please enter a session name and user name
    The Below is the coding for the Call Transaction...
    report ZDS_BDC_MM01_2
           no standard page heading line-size 255.
    *include bdcrecx1.
    *parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    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: MTPOS_MARA
            MTPOS_MARA_007(004),
          end of record.
    DATA: FLNAME TYPE STRING.
    *** End generated data section ***
    DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
    *** MESSAGE******
    DATA: BEGIN OF MESSTAB OCCURS 0.
            INCLUDE STRUCTURE BDCMSGCOLL.
            DATA: MATNR TYPE MARA-MATNR,
          END OF MESSTAB.
    ****END OF MESSAGE****
    PARAMETERS: FILENAME TYPE RLGRAP-FILENAME.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.
      CALL FUNCTION 'F4_FILENAME'
       IMPORTING
         FILE_NAME           = FILENAME.
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    FLNAME = FILENAME.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FLNAME
        FILETYPE                      = 'DAT'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * 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.
    LOOP AT record.
      DATA:
        CNT TYPE I.
        CNT = CNT + 1.
        REFRESH BDCDATA.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MTART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-MATNR_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_004.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_005.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_006.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_007.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    *perform bdc_transaction using 'MM01'.
    CALL TRANSACTION 'MM01' USING BDCDATA
                            MODE 'N'
                            UPDATE 'A'
                            MESSAGES INTO MESSTAB.
    READ TABLE MESSTAB INTO MESSTAB INDEX CNT.
       IF MESSTAB-MSGTYP = 'E'.
         MESSTAB-MATNR = RECORD-MATNR_001.
         MODIFY MESSTAB INDEX CNT FROM MESSTAB. " TRANSPORTING MATNR.
       ENDIF.
    ENDLOOP.
    FORM OPEN_GROUP.
      CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING  CLIENT   = SY-MANDT
                        GROUP    = 'MM01'
                        USER     = SY-UNAME
                        KEEP     = 'X'.
    ENDFORM.
    FORM BDC_INSERT.
      CALL FUNCTION 'BDC_INSERT'
       EXPORTING
         TCODE                  = 'MM01'
    *     POST_LOCAL             = NOVBLOCAL
    *     PRINTING               = NOPRINT
    *     SIMUBATCH              = ' '
    *     CTUPARAMS              = ' '
        TABLES
          DYNPROTAB              = BDCDATA
       EXCEPTIONS
         INTERNAL_ERROR         = 1
         NOT_OPEN               = 2
         QUEUE_ERROR            = 3
         TCODE_INVALID          = 4
         PRINTING_INVALID       = 5
         POSTING_INVALID        = 6
         OTHERS                 = 7
      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.
    END-OF-SELECTION.
    LOOP AT MESSTAB.
        IF MESSTAB-MSGTYP = 'E'.
          WRITE:/ 'ERROR OCCURED ON MATNR = ',MESSTAB-MATNR , 'MESSAGE : MATNR ALREADY EXISTS IN MARA!!!'.
        ENDIF.
      ENDLOOP.
    perform close_group.
    *perform close_dataset using dataset.
    *&      Form  close_group
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM close_group .
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
       NOT_OPEN          = 1
       QUEUE_ERROR       = 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.                    " close_group
    *&      Form  bdc_dynpro
    *       text
    *      -->P_0270   text
    *      -->P_0271   text
    FORM bdc_dynpro  USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
    *       text
    *      -->P_0275   text
    *      -->P_0276   text
    FORM bdc_field  USING  FNAM FVAL.
      IF FVAL <> ' '.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.                    " bdc_field
    *Text elements
    * E00 Error opening dataset, return code:
    * I01 Session name
    * I02 Open session
    * I03 Insert transaction
    * I04 Close Session
    * I05 Return code =
    * I06 Error session created
    * S01 Session name
    * S02 User
    * S03 Keep session
    * S04 Lock date
    * S05 Processing Mode
    * S06 Update Mode
    * S07 Generate session
    * S08 Call transaction
    * S09 Error sessn
    * S10 Nodata indicator
    * S11 Short log
    HTH
    Regards,
    Dhruv Shah

  • Purchase Order Text in MM01, MM02 dependant on Planyt ??

    Hello,
    In SAP standard, the purchase order text in MM01, MM02, MM03 will not be depedant on the plan , Is there any ways or configuration that allows user to create this text dependant on the plan in MM01 ?
    Thanks

    Hello,
    I am afraid I must confirm you, that the System is working as designed.        
    Although the System asks for a plant when maintaining the Purchase Order  Text view, the text is stored at client level and not at plant level.          
    The basic data text, the inspection text, the internal comment, the material description and the sales text are as well maintained at client level. The only text that can be maintained at plant level is the material memo in the MRP 4 view.
    You can maintain plant specific texts in the purchasing info record.                                                                               
    Regards,
    Mauro

  • User exit/BADi to change the header text in MIRO transaction

    Hi all,
    I am searching user exit or badi to change the header text in MIRO transaction.
    My requirement is, before post the invoice I need to populate the vendor name in Header text field(MIRO -> Details tab -> header text field ). I have tried all the user exits and BADi's related to MIRO. Doesn't work. If anybody knows please share.
    Thanks,
    Pranav

    Try BADI INVOICE_UPDATE.
    If you are in system version is ECC 6.0, you can find out a Enhancement SPOT (ES_SAPLMRMC) under Function module MRM_FINAL_CHECK, which can be used to perform this requirement
    Hope this helps.
    Thanks,
    Balaji
    Edited by: Balaji Ganapathiraman on Mar 14, 2008 4:43 PM

  • User exit/BADi to populate the header text in MIRO transaction

    Hi all,
    I am searching user exit or badi to populate the header text in MIRO transaction.
    My requirement is, before post the invoice I need to populate the some text in Header text field (MIRO -> Details tab -> header text field). I need to populate this field in the MM document as well as FI document (Accounting Document). I have tried all the user exits and BADi's related to MIRO/MRRL. Doesn't work. If anybody knows please share.
    Thanks,
    Santosh
    Edited by: Santosh Ghonasgi on May 13, 2010 4:48 PM

    Hello santosh,
    I am not sure whether a suitable exit / BADI exists to update the header text in MIRO directly.
    there is one related forum:
    User exit/BADi to change the header text in MIRO transaction
    Hope, it may helpful for you to proceed with some other parallel solution.
    Regards,
    Selva K.
    Edited by: Selvakumar Krishnan on May 13, 2010 5:29 PM

  • Long Text of VD53 Transaction

    Hi experts
           How to get long text in VD53 transaction Using READ_TEXT
    Regards
    Manoj

    the text name is i got for my sales org and mat no. is this
    TEXT NAME : SP01010031970211000000000011000112
    I guesss this is combination of
    text name =  SALES ORG + Distribution Channel+ customer no + material no.
    Text id = customer material no.
    Text Object = KNMT
    You need to pass this to ur READ_TEXT module.

  • Read Header Text  From VF03 Transaction

    Hi Frds,
                  I want to Read Header Text  From VF03 Transaction
    Read Transport Number and Transport Date From Vf03 Transaction.
    Guide Me Briefly
    How to pass the varaibles to the function Module
    Regards,
    Kabil

    hi Kabil ,
        Your issue completely accepted just keep in mind
    1) if you have to read both text you have to use read_text 2 times
    2) in that for first read_text
    CALL FUNCTION 'READ_TEXT'
         EXPORTING
          CLIENT                =       SY-MANDT
           ID                       =       '0002'
           LANGUAGE        =       SY-LANGU
           NAME                =        '             '          "" YOUR VARIABLE THAT CONTAINS Invoices number
           OBJECT             =        'VBRK'
          TABLES
           LINES                =         TLINE
       IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF. 
        is ok for Header note 1 .(means first text ) but for second text your ID is change other thing is same .
    CALL FUNCTION 'READ_TEXT'
         EXPORTING
          CLIENT                =       SY-MANDT
           ID                       =       '0013'
           LANGUAGE        =       SY-LANGU
           NAME                =        '             '          "" YOUR VARIABLE THAT CONTAINS Invoices number
           OBJECT             =        'VBRK'
          TABLES
           LINES                =         TLINE
       IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
    Hope this will help you
    Thanking You,
    shrikant padwale.

  • Create a text field in transaction code VF11

    Hi,
    How to configure a text field in transaction code VF11.Please help me on this.
    Presently we are just cancelling the invoices through VF11. but no inputing the reason for cancellation.
    We need to have a mandatory field, were in we need to input the reason for cancellation of that invoices.
    Thanks & Regards,
    vcsreddy.

    Dear
    Create One text type for Billing document header and Assign the Biling Type S1
    and when your doing Vf11Transcation select GOTO Billing Document Over view and select the line item
    go to text there your text type will determine.
    Do this I hope your requriment full fill
    Regards
    Supriya

  • Problem in selecting views in MM01 Transaction

    Hi,
    I want to know where can i configure views (In SPRO) for a particular Industry sector and material type for a material.In my case some view are getting displayed when i enter a material in MM01 transaction i want to select some more views for that material.
    Regards,
    Mukesh Kumar

    Hi,
    Go to Logistics general -> material master -> basic settings -> material types -> Define attributes of material types.
    Select the reqired material type and click on details ( Mirror glass)
    regards,

  • Dynamic select views for MM01 Transaction

    Hii  Friends,
    I have an issue like i need to dynamically select the views in MM01 transaction from the BDC program
    without selecting that views manually.
    Using SHDB recording i can select the views before recording  and then call those views again
    If i want to select the views from the program how do i do it..
    If there is any way to do this in call transaction let me know plz
    Thanks in advance
    kishore

    BDC is not good for MM01 , go for bapi
    other wise go for  LSMW bapi method...
    Business Object      BUS1001006   Standard material
    Method               SAVEDATA                    Create and change materia
    Message Type         MATMAS_BAPI                 Create and change materia
    Basic Type           MATMAS_BAPI02               Create and Change Materia

  • Create Long Text in MM01 for material

    Hi,
    I'm trying to create long text in MM01. After entering industry sector and material type and also the necessary views, i hit EDIT --> Long Text , the create text option is greyed out (inactive)..
    How can i make this work ? Or is there any other field where i can use long text ?
    thank you..

    Our client's material master data for material text is longer than 40 characters.. and it's impossible for them to reduce this to 40 charac.
    So i need to find another field which they can use..
    I wonder if i use po text, can i use it for developed reports, in search helps .. etc.. I'm not sure..
    And also I have no clue about how will i use the long text in EDIT menu..

  • Classification material in MM01 transaction

    Hello experts ,
    When i classified material in 'MM01' transaction , i  arrive to subscreen under assignments with some categories
    In general category , how can i to select the value of  'Model Product' field's if i have the  matnr of the material ?
    Thanks for your help.
    Avi.

    Hi,
    If you are trying to change a material, you chould go to MM02. There you need to enter your material and then change it in the tab as required.
    Cheers!!
    Arnab

  • Fetching Item Texts from VL03N transaction

    Hi All,
    I have a requirement in my program in which I need to fetch Item Texts from VL03N transaction corresponding to a delivery Number.i.ie. the path is Select the Item, GOTO>ITEM>TEXTS.From there I need to get the Service Notification.Please let me know how to fetch this using the read_text function module.
    Thanks,
    Neethu.

    Hello,
    You can fetch the item texts for VL03N transaction for the object VBBP.
    If the text is Material sales text, then its id would be 0001.
    For Item note, it is 0002.
    You can call the read_text fm as below:
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        CLIENT                        = SY-MANDT "client info
        id                            = pi_id  "id as 0001 or 0002 depending on the text
        language                      = pi_spras  "language key
        name                          = pi_name 
        object                        = pi_object    "Object Id
    Hope this helps.
    Thanks,
    Sowmya

  • How rectify this problem in MM01 transaction in ECC6.0 ?

    Hi
    While creting material using MM01 transaction,
    Using MATERIAL as BLANK
    Industry sector as Mechanical Engineering and
    Material type as Spare Parts.
    I am getting error like Record 02  01 does not exist in table T133A.
    Thanks.

    Hi,
         You can do Edit -> Modification Operations -> Switch Off Modification assistant and then try changing it.
    Regards
    Rani.

Maybe you are looking for