PURCHASE ORDER UPLOAD

Hi,
             My query:
             How to upload Purchase order data from legacy to SAP.
Bye...

Hi
check this example(explained step by step)
Using Tcode MM01 -- Maintain the source fields are
1) mara-amtnr char(18)
2) mara-mbrsh char(1)
3) mara-mtart char(4)
4) makt-maktx char(40)
5) mara-meins char(3)
the flate file format is like this as follows
MAT991,C,COUP,Srinivas material01,Kg
MAT992,C,COUP,Srinivas material02,Kg
AMT993,C,COUP,Srinivas material03,Kg
MAT994,C,COUP,Srinivas material04,Kg
MAT995,C,COUP,Srinivas material05,Kg
goto Tcode LSMW
give Project Name
Subproject Name
object Name
Press Enter -
Press Execute Button
It gives 13 radio-Button Options
do the following 13 steps as follows
1) select radio-Button 1 and execute
Maintain Object Attributes
select Standard Batch/Direct Input
give Object -- 0020
Method -- 0000
save & Come Back
2) select radio-Button 2 and execute
Maintain Source Structures
select the source structure and got to click on create button
give source structure name & Description
save & Come Back
3) select radio-Button 3 and execute
Maintain Source Fields
select the source structure and click on create button
give
first field
field name matnr
Field Label material Number
Field Length 18
Field Type C
Second field
field name mbrsh
Field Label Industrial Sector
Field Length 1
Field Type C
Third field
field name mtart
Field Label material type
Field Length 4
Field Type C
fourth field
field name maktx
Field Label material description
Field Length 40
Field Type C
fifth field
field name meins
Field Label base unit of measurement
Field Length 3
Field Type C
save & come back
4) select radio-Button 4 and execute
Maintain Structure Relations
go to blue lines
select first blue line and click on create relationship button
select Second blue line and click on create relationship button
select Third blue line and click on create relationship button
save & come back
5) select radio-Button 5 and execute
Maintain Field Mapping and Conversion Rules
Select the Tcode and click on Rule button there you will select constant
and press continue button
give Transaction Code : MM01 and press Enter
after that
1) select MATNR field click on Source filed(this is the field mapping) select MATNR and press Enter
2) select MBRSH field click on Source filed(this is the field mapping) select MBRSH and press Enter
3) select MTART field click on Source filed(this is the field mapping) select MTART and press Enter
4) select MAKTX field click on Source filed(this is the field mapping) select MAKTX and press Enter
5) select MEINS field click on Source filed(this is the field mapping) select MEINS and press Enter
finally
save & come back
6) select radio-Button 6 and execute
Maintain Fixed Values, Translations, User-Defined Routines
Create FIXED VALUE Name & Description as MM01
Create Translations Name & Description as MM01
Create User-Defined Routines Name & Description as MM01
after that delete all the above three just created in the 6th step
FIXED VALUE --MM01
Translations --MM01
User-Defined Routines --MM01
come back
7) select radio-Button 7 and execute
Specify Files
select On the PC (Frontend) -- and click on Create button(f5)
give the path of the file like "c:\material_data.txt"
description : -
separators as select comma radiao- button
and press enter save & come back
8) select radio-Button 8 and execute
Assign Files
Save & come back
9) select radio-Button 9 and execute
Read Files
Execute
come back
come back
10) select radio-Button 10 and execute
Display Imported Data
Execute and press enter
come back
Come back
11) select radio-Button 11 and execute
Convert Data
Execute
come back
Come back
12) select radio-Button 12 and execute
Display Converted Data
Execute & come back
13) select radio-Button 13 and execute
Start Direct Input Program
select the Program
select continue button
go with via physical file
give the lock mode as 'E'
and execute
Also chk this:
http://www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc
http://www.mydatabus.com/visitor.php?pt=downloadFile&tc=6289701541332&cl=53&cn=000003&uid=6659
I recommend visiting http://www.**************** for this. For more details, click on http://www.****************/Tutorials/LSMW/LSMWMainPage.htm
http://www.erpgenie.com/sap/saptech/lsmw.htm
The steps are:
Maintain Object Attributes
Maintain Source Structures
Maintain Source Fields
Maintain Structure Relations
Maintain Field Mapping and Conversion Rules
Maintain Fixed Values, Translations, User-Defined Routines
Specify Files
Assign Files
Read Data
Display Read Data
Convert Data
Display Converted Data
Create Batch Input Session
Run Batch Input Session
also go through the links:
http://www.sapbrain.com/TOOLS/LSMW/SAP_LSMW_steps_introduction.html
http://esnips.com/doc/8e732760-5548-44cc-a0bb-5982c9424f17/lsmw_sp.ppt
http://esnips.com/doc/f55fef40-fb82-4e89-9000-88316699c323/Data-Transfer-Using-LSMW.zip
http://esnips.com/doc/1cd73c19-4263-42a4-9d6f-ac5487b0ebcb/LSMW-with-Idocs.ppt
http://esnips.com/doc/ef04c89f-f3a2-473c-beee-6db5bb3dbb0e/LSMW-with-BAPI.ppt
http://esnips.com/doc/7582d072-6663-4388-803b-4b2b94d7f85e/LSMW.pdf
REFER.
Re: ALE
check the following it contains step by step procedure,
https://help.sap.com/saphelp_nw04s/helpdata/en/87/f3ae74e68111d1b3ff006094b944c8/content.htm
Check this how to create LSMW
http://www.sapbrainsonline.com/TOOLS/LSMW/SAP_LSMW_steps_introduction.html
http://www.sapbrain.com/TOOLS/LSMW/SAP_LSMW_steps_introduction.html
http://esnips.com/doc/8e732760-5548-44cc-a0bb-5982c9424f17/lsmw_sp.ppt
http://esnips.com/doc/f55fef40-fb82-4e89-9000-88316699c323/Data-Transfer-Using-LSMW.zip
http://esnips.com/doc/1cd73c19-4263-42a4-9d6f-ac5487b0ebcb/LSMW-with-Idocs.ppt
http://esnips.com/doc/ef04c89f-f3a2-473c-beee-6db5bb3dbb0e/LSMW-with-BAPI.ppt
http://esnips.com/doc/7582d072-6663-4388-803b-4b2b94d7f85e/LSMW.pdf
For more documents regarding creation of lsmw give me your mail id i'll send some documents
Reward all helpfull answers
Regards
Pavan
Message was edited by:
        Pavan praveen

Similar Messages

  • Open Purchase Order UPload Using the BAPI 's

    i need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out  using the BAIP's for upload the PO, i need sample code for this ........
    Thanks & Regards
    Raghu
    <u>Field Name     Field Description                              Type     Length</u>
    <b>EBELN             Purchasing Document Number                         CHAR     010          X
    BUKRS             Company Code                                                     CHAR    004     MN10     C
    EKORG             Purchasing Organization                              CHAR     004     MN00     C
    EKGRP             Purchasing group                              CHAR     003          X
    BSART             Order type (Purchasing)                              CHAR     004          X
    LIFNR             Account Number of Vendor or Creditor                    CHAR     010          X
    BEDAT             Purchase Order Date                              DATS     010          X
    ZTERM             Terms of payment key                              CHAR     004          X
    WAERS             Currency Key                                   CUKY     005          X
    INCO1             Incoterms (part 1)                              CHAR     003          X
    INCO2             Incoterms (part 2)                              CHAR     028          X</b>
    EBELP             Item Number of Purchasing Document                    NUMC     005          X
    EMATN             Material number                                   CHAR     018          X
    WERKS             Plant                                        CHAR     004          X
    LGORT             Storage location                              CHAR     004          X
    EPSTP             Item category in purchasing document                    CHAR     001          X
    KNTTP             Account assignment category                         CHAR     001          X
    EINDT             Item delivery date                              DATS     010          X
    MENGE            "Purchase order quantity (direct input, transfer of POs)"     CHAR     013          X
    MEINS            Order unit                                   UNIT     003          X
    NETPR            "Net price: Document currency (direct input, transfer of"     CHAR     011          X
    PEINH            "Price unit (direct input, transfer of POs)"               CHAR     005          X
    BPRME            Order Price Unit (Purchasing)                         UNIT     003          X
    BPUMZ            Numerator: Conversion OPUn into OUn (direct input of POs          CHAR     005          X
    BPUMN            Denominator: Conversion OPUn into OUn (direct input of P          CHAR     005          X
    SAKTO            Cost element                                   CHAR     010          X
    KOSTL              Cost Center                                   CHAR     010          X
    VBELN          Sales and Distribution Document Number                    CHAR     010          X
    VBELP          Sales document item                              NUMC     006          X
    WEMPF          Goods recipient                                   CHAR     012          X
    WEBTH          "Amount in local currency (direct input, transfer of POs)"     CHAR     013          X
    WEBTF          "Amount in document currency (direct input, transfer of P"     CHAR     013          X
    WEREF          Flag for treatment of GR/IR (direct input of POs)          CHAR     001          X
    SPINF          Indicator: Update info record                         CHAR     001          X
    WEPOS          Goods Receipt Indicator                              CHAR     001          X
    REPOS          Invoice receipt indicator                         CHAR     001          X

    i need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out  using the BAIP's for upload the PO, i need sample code for this ........
    Thanks & Regards
    Raghu
    <u>Field Name     Field Description                              Type     Length</u>
    <b>EBELN             Purchasing Document Number                         CHAR     010          X
    BUKRS             Company Code                                                     CHAR    004     MN10     C
    EKORG             Purchasing Organization                              CHAR     004     MN00     C
    EKGRP             Purchasing group                              CHAR     003          X
    BSART             Order type (Purchasing)                              CHAR     004          X
    LIFNR             Account Number of Vendor or Creditor                    CHAR     010          X
    BEDAT             Purchase Order Date                              DATS     010          X
    ZTERM             Terms of payment key                              CHAR     004          X
    WAERS             Currency Key                                   CUKY     005          X
    INCO1             Incoterms (part 1)                              CHAR     003          X
    INCO2             Incoterms (part 2)                              CHAR     028          X</b>
    EBELP             Item Number of Purchasing Document                    NUMC     005          X
    EMATN             Material number                                   CHAR     018          X
    WERKS             Plant                                        CHAR     004          X
    LGORT             Storage location                              CHAR     004          X
    EPSTP             Item category in purchasing document                    CHAR     001          X
    KNTTP             Account assignment category                         CHAR     001          X
    EINDT             Item delivery date                              DATS     010          X
    MENGE            "Purchase order quantity (direct input, transfer of POs)"     CHAR     013          X
    MEINS            Order unit                                   UNIT     003          X
    NETPR            "Net price: Document currency (direct input, transfer of"     CHAR     011          X
    PEINH            "Price unit (direct input, transfer of POs)"               CHAR     005          X
    BPRME            Order Price Unit (Purchasing)                         UNIT     003          X
    BPUMZ            Numerator: Conversion OPUn into OUn (direct input of POs          CHAR     005          X
    BPUMN            Denominator: Conversion OPUn into OUn (direct input of P          CHAR     005          X
    SAKTO            Cost element                                   CHAR     010          X
    KOSTL              Cost Center                                   CHAR     010          X
    VBELN          Sales and Distribution Document Number                    CHAR     010          X
    VBELP          Sales document item                              NUMC     006          X
    WEMPF          Goods recipient                                   CHAR     012          X
    WEBTH          "Amount in local currency (direct input, transfer of POs)"     CHAR     013          X
    WEBTF          "Amount in document currency (direct input, transfer of P"     CHAR     013          X
    WEREF          Flag for treatment of GR/IR (direct input of POs)          CHAR     001          X
    SPINF          Indicator: Update info record                         CHAR     001          X
    WEPOS          Goods Receipt Indicator                              CHAR     001          X
    REPOS          Invoice receipt indicator                         CHAR     001          X

  • Regarding Purchase order upload

    Dear All,
                           I have to upload the Purchase orders in to the SAP using DTW.i have fillled the follwing fields in to the opor and POR1 template but it is showing application error.
    OPOR
    Record Key
    Docentry
    address
    cardcode
    docduedate
    docdate
    doctotal
    POr1
    Recordkey
    linenum
    accountcode
    itemcode
    price
    quantity..........
    I think am missing a manadatory field.......Pls give me a solution to this...............Also tell me what are the mandatory fields that has to be filled for uploading.Actually the datas are large so i cannot ask the client to type all of them......Uploading is the only way..........So pls help me out.
    Regards,
    Shyam

    Hello ,
    You dont need to fill thise field in OPOR
    Record Key
    address
    doctotal
    because these all field all system generated
    Then try again upload it.
    Thanks
    Manvendra Singh Niranjan

  • Purchase order upload using LSMW

    Hi
    Can we use Basic type ORDERS05 in the IDOC method to upload purchase order using LSMW.
    This also can achieved using business object BUS2012 and basic type PORDCR05.
    Just wanted to what would be the difference between these two methods and possibliity of PO using basic type ORDERS05 using Idoc method.
    Regards
    Raj
    Edited by: Rajitha1234 on Jan 28, 2011 6:55 AM
    Edited by: Rajitha1234 on Jan 28, 2011 6:56 AM

    Hai
    Check with the following
    Select fifth Radio button then follow the bellow step
    <b>5) select radio-Button 5 and execute
       Maintain Field Mapping and Conversion Rules
       Select the Tcode and click on Rule button there you   will select constant
       and press continue button
       give Transaction Code : ME21 and press Enter</b>
    Thanks & regards
    Sreenivasulu P

  • PURCHASE ORDER UPLOAD THRU BDC

    HOW MANY FLAT FILES 'LL U UPLOAD FOR PURCHASE ORDER IN BDC ND BAPI. i.e., WILL U GIVE SEPERATE FILE FOR HEADER DATA AND ITEM DATA OR A SINGLE FILE FOR BOTH. GIVE ME SOME SAMPLE CODES.

    Refer the sample program in BDC:
    *& Report ZTRAINEE15_BDC *
    REPORT ztrainee15_bdc
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 10,
    orderno LIKE vbak-vbeln,
    itemno LIKE vbap-posnr,
    reason LIKE vbap-abgru,
    END OF itab.
    DATA : BEGIN OF it_bdc OCCURS 10.
    INCLUDE STRUCTURE bdcdata.
    DATA : END OF it_bdc.
    DATA : filename TYPE string.
    DATA: it_bdcmsgcall type standard table of BDCMSGCOLL WITH HEADER LINE.
    *DATA: it_bdcdata type standard table of BDCDATA WITH HEADER LINE.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    PARAMETER: p_file TYPE rlgrap-filename,
    rjct_itm RADIOBUTTON GROUP g1,
    add_item RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK b1.
    GUI FOR PATH FILE
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    field_name = ' '
    IMPORTING
    file_name = p_file.
    UPLOADING FILE
    START-OF-SELECTION.
    filename = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = filename
    filetype = 'ASC'
    HAS_FIELD_SEPARATOR = ' '
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = itab
    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.
    *AT SELECTION-SCREEN ON RADIOBUTTON GROUP g1.
    CASE 'rjct_itm'.
    WHEN 'X'.
    PASSING DATA
    program name, screen no.
    LOOP AT itab.
    clear: it_bdc, it_bdc[].
    PERFORM bdc_dynpro USING 'SAPMV45A' '102' 'X'.
    PERFORM bdc_field USING 'BDC_CURSOR' 'VBAK-VBELN'.
    PERFORM bdc_field USING 'BDC_OKCODE' '=SUCH'.
    PERFORM bdc_field USING 'VBAK-VBELN' itab-orderno.
    PERFORM bdc_dynpro USING 'SAPMV45A' '4001' 'X'.
    PERFORM bdc_field USING 'BDC_CURSOR' 'VBAP-POSNR'.
    PERFORM bdc_field USING 'BDC_OKCODE' '=ITEM'.
    PERFORM bdc_field USING 'VBAP-POSNR' itab-itemno.
    PERFORM bdc_dynpro USING 'SAPMV45A' '4003' 'X'.
    PERFORM bdc_field USING 'BDC_CURSOR' 'VBAP-ABGRU'.
    PERFORM bdc_field USING 'BDC_OKCODE' '=SICH'.
    PERFORM bdc_field USING 'VBAP-ABGRU' itab-reason.
    CALLING TRANSACTION
    CALL TRANSACTION 'VA02' USING it_bdc MODE 'A' MESSAGES INTO
    it_bdcmsgcall.
    ENDLOOP.
    LOOP AT it_bdc.
    WRITE: / it_bdc-program,
    it_bdc-dynpro,
    it_bdc-dynbegin,
    it_bdc-fnam,
    it_bdc-fval.
    ENDLOOP.
    *ENDCASE.
    *& Form bdc_dynpro
    text
    -->P_0198 text
    -->P_0199 text
    -->P_0200 text
    FORM bdc_dynpro USING p_program
    p_dynpro
    p_flag.
    it_bdc-program = p_program.
    it_bdc-dynpro = p_dynpro.
    it_bdc-dynbegin = p_flag.
    APPEND it_bdc.
    CLEAR it_bdc.
    ENDFORM. " bdc_dynpro
    *& Form bdc_field
    text
    -->P_0230 text
    -->P_0231 text
    FORM bdc_field USING p_fnam
    p_fval.
    it_bdc-fnam = p_fnam.
    it_bdc-fval = p_fval.
    APPEND it_bdc.
    CLEAR it_bdc.
    ENDFORM. " bdc_field

  • Standard purchase order upload to oracle

    hi,
    we are on oracle apps 11i, database 9i.
    I have a custom requirement that requires importing purchase orders to Oracle Apps through database. I was advised to use the following interface tables:
    PO_HEADERS_INTERFACE
    PO_LINES_INTERFACE
    PO_LINE_LOCATIONS_INTERFACE
    PO_DISTRIBUTIONS_INTERFACE
    insert the data to these tables using a PLSQL procedure and then running the program IMPORT STANDARD PURCHASE ORDERS from front end.
    If someone confirms the above is the right method, it would be appreciated.
    thanks & regards

    Looks correct. Refer to the below links.
    http://docs.oracle.com/cd/E19509-01/820-4390/ggtjd/index.html
    http://api-wizard.blogspot.com/2012/10/purchase-order-import.html
    http://raghuoaf.blogspot.com/2012/03/po-creation-and-import-po.html
    Thanks
    Shree

  • Fail safe logic needed for purchase order upload program

    Hello all,
    i am working on creating PO's by reading data from a text file. I need to implement fail safe logic in it, which is to make sure this program uploads all the records in the text file successfully. For example, i have 1000 records in my text file and while running the upload program if the program times out while creating the 500th PO or if SAP is down at that time, then we have 499 PO's created and 501 yet to be created. But if we run the same program again, we will generate duplicate PO's for 499 again. I want to avoid this kind of problem.
    How do i implement this idea?
    Kindly guide me on this.
    Thanks.

    Ok ..
    Then I would suggest you use Application Log to keep the success and error messages of PO processing.
    You can check trsnaction SLG0 and create your own application log object.
    Then you need to use FMs BAL_LOG_* to crate and add messages to it.
    This way you will have a facility to check as which of your records are converted to PO for a run.
    In case SAP gets down in between , still you can find the details using Xn SLG1 and then accordingly remove the records from your file which are already converted to PO.
    Thanks,
    Ram

  • Regarding bdc upload for purchase order

    hi friends,
    here i got a problem in purchase order upload.the format in excel sheet data is in this format mentioned bellow
    lifnr      ekorg  ekgrp   werks   lgort         ematn       menge netpr
    142     1000     1000     1000     1000     <b>100-100      10      150
                                               100-100     15     100
                                                100-100     10     140
                                                100-100     12     56
                                                100-100      8      40</b>
    here to identify items which r in bold and to write code for this is my problem. if the iteams r separated with  ' , '  i can use split at , and between loop and end loop i executed the code earlier. but now my flat file containing 1000+ records and to convert that in my mode of program is a problem. so can any one suggest me how to proceed and code the above mentioned flat file structure to be uploaded in one record.
    <b>this program is very urgent.............so take it as a request and help me in futher proceddings.......</b>
    thaning you all........
    i wait for replay...............

    Hi,
    I hope earlier you are comma seperated file, and you are easily spliting the values using SPLIT command.
    Now you are using flat file (fixed length) Using offset values you need map the fields manually in loop ... endloop control statement. (takes long time to find total lengh of record although you have to).
    If you using TABDELIMITED, use the same SPLIT command , instead of 'comma' use 'CL_ABAP_CHAR_UTILITIES=>TAB_DELIMITED' attribute.
    If you can maintain hierarchy. I hope it will be easy.
    see below structure if want to do in hierarchy mode. Write logic determine the detail record and map it. It is easy rather than direct offset mapping.
    <b>indicator ifnr ekorg ekgrp werks lgort
    indicator  ematn menge netpr
    1 142 1000 1000 1000 1000
    <i>2 100-100 10 150
    2 100-100 15 100
    2 100-100 10 140
    2 100-100 12 56
    2 100-100 8 40</i></b>
    Please let me know what type of file  i.e. reason i have given all three types.
    If it helps.Plz reward points.
    Regards
    Bhupal Reddy.

  • Open Purchase order pload

    Can any one provide OPen purchase order upload program using BAPI method....
    Thanks & regards.
    Ramesh T.
    Moderator Message : Not enough re-search before posting. Thread locked
    Edited by: Vinod Kumar on Apr 22, 2011 3:41 PM

    Hi Harshad,
    You can use the Service PO scenario.
    Service PO is used to Procure/ Avail the Services. you can create the service PO ( having account Assignment Category 'K' and item Category 'D'  for services) which has the validity period.
    at item overview level, you have to specify the Material /Service info in Short text.
    At Item Detail level, you will have the service tab. Depending on your indent (as and when it comes) you can enter the service item with its unit cost and qty.
    Later on, once you physically received the Material/Service, then using transaction ML81N you can accept the service. which in turn post your GR Document.
    Regards,
    S Anand

  • I am trying to upload the purchase order long text in mm01 using BAPI

    Hi All,
    I am trying to upload Purchase Order Long text (which is in chinese Language) and Language field with  ZH(chinese) in MM01 using BAPI_MATERIAL_SAVEDATA.
    It is uploading properly, But in the Language field it is showing Z1(Customer reserve) instead of ZH(Chinese).
    What could be the reason for this and how it can be resolved.
    Thanks in advance,
    Raja

    Hi,
    Which input parametr did you use? See table T002
    LANGU = '1'
    LAISO = 'ZH'
    Rgds,
    JP

  • Upload purchase order

    Hai,
    how to upload the purchase order when one PO has three line items,
    another has 100 line items, and so on.
    can i use BAPI_PO_Create FM for this ?
    if it possible ,how to use ?
    Thanks & regards,
    Manikandan

    Check the following ex:
    Data Declaration for BAPI *****************
    data: begin of pohead occurs 10.
            include structure BAPIMEPOHEADER.
    data: end of pohead.
    data: begin of poheadx occurs 10.
            include structure BAPIMEPOHEADERX.
    data: end of poheadx.
    *EXPPURCHASEORDER
    data: BEGIN OF ponum.
            include structure BAPIMEPOHEADER.
    data: end of ponum.
    data: begin of poitem occurs 100.
            include structure BAPIMEPOITEM.
    data: end of poitem.
    data: begin of poitemx occurs 100.
            include structure BAPIMEPOITEMX.
    data: end of poitemx.
    data: begin of errmsg occurs 10.
            include structure bapiret2.
    data: end of errmsg.
    data : errflag.
    START-OF-SELECTION.
    PERFORM UPLOAD_DATA.
    *&      Form  UPLOAD_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM UPLOAD_DATA .
      data: p_fdir(200) type c .
      p_fdir = gfile.
      data: begin of it_filedir occurs 10.
              include structure salfldir.
      data: end of it_filedir.
    Get Current Directory Listing for OUT Dir
      call function 'RZL_READ_DIR_LOCAL'
        EXPORTING
          name     = p_fdir
        TABLES
          file_tbl = it_filedir.
      data: it_filedir1 like it_filedir occurs 0 with header line.
      loop at it_filedir.
        if it_filedir-name(4) = 'CPOR' or it_filedir-name(4) = 'cpor'.
          move it_filedir-name to it_filedir1-name.
          append it_filedir1.
        endif.
      endloop.
      IF IT_FILEDIR1[] IS INITIAL.
        STOP.
      ENDIF.
      REFRESH I_MSG1.
      CLEAR I_MSG1.
      loop at it_filedir1.
        REFRESH I_TAB.
        REFRESH I_TAB2.
        REFRESH I_TAB1.
        data: g_file(100) type c .
        name = it_filedir1-name.
        concatenate: gfile '\' name into g_file.
        data : i_tab1(200).
        OPEN DATASET g_file FOR INPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          DO.
            READ DATASET g_file INTO i_tab1.
            if sy-subrc = 0.
              split i_tab1 at ',' into i_tab-verkf i_tab-verkf1 i_tab-lifnr
                        i_tab-ebelp1 i_tab-werks
                     i_tab-matnr i_tab-idnlf
                     i_tab-menge i_tab-bprme i_tab-lewed i_tab-netpr.
            else.
              exit.
            endif.
            APPEND i_tab.
            clear i_tab.
          ENDDO.
        ENDIF.
    *************** error testing*******************
        LOOP AT i_tab.
          MOVE-CORRESPONDING i_tab TO etab1.
          append etab1.
          clear etab1.
        ENDLOOP.
    *************** end error testing*******************
       DELETE DATASET g_file.
        CLOSE DATASET g_file.
        concatenate:
                    hfile '\' date1 '\' name into h_file.
        OPEN DATASET h_file FOR OUTPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          LOOP AT I_TAB.
            CONCATENATE I_TAB-VERKF ',' I_TAB-VERKF1 ',' I_TAB-LIFNR ','
                        I_TAB-EBELP1 ',' I_TAB-WERKS ','  I_TAB-MATNR ','
                        I_TAB-IDNLF ',' I_TAB-MENGE ',' I_TAB-BPRME ','
                        I_TAB-LEWED ',' I_TAB-NETPR INTO I_TAB2.
            TRANSFER i_tab2 TO h_file.
          ENDLOOP.
        ENDIF.
        CLOSE DATASET h_file.
      MOVE I_TAB[] TO I_TAB3[].
      DELETE ADJACENT DUPLICATES FROM I_TAB COMPARING VERKF.
      loop at i_tab.
        refresh pohead.
        refresh poheadx.
        refresh poitem.
        refresh poitemX.
        pohead-DOC_TYPE = i_tab-bsart.
        pohead-VENDOR = i_tab-lifnr.
        pohead-PURCH_ORG = c_ekorg.
        pohead-CREAT_DATE = i_tab-verkf1.
        pohead-PUR_GROUP = c_ekgrp.
        pohead-COMP_CODE = c_bukrs.
        pohead-SALES_PERS = I_TAB-VERKF2.
        pohead-doc_date = sy-datum.
        pohead-langu = sy-langu.
        append pohead.
        poheadx-DOC_TYPE = c_x.
        poheadx-VENDOR = c_x.
        poheadx-PURCH_ORG = c_x.
        poheadx-PUR_GROUP = c_x.
        poheadx-COMP_CODE = c_x.
        poheadx-SALES_PERS = c_x.
        poheadx-doc_date = c_x.
        poheadx-langu = c_x.
        append poheadx.
        loop at i_tab3 WHERE VERKF = I_TAB-VERKF.
          poitem-PO_ITEM = i_tab3-ebelp1.
          poitem-MATERIAL = i_tab3-MATNR.
          poitem-QUANTITY = i_tab3-MENGE.
          poitem-PO_UNIT = i_tab3-BPRME.
          poitem-NET_PRICE = i_tab3-NETPR.
          poitem-PLANT = i_tab3-WERKS.
          poitem-GR_TO_DATE = i_tab3-LEWED.
         poitem-tax_code = c_x.
         poitem-item_cat = c_x.
         POITEM-ACCTASSCAT = c_x.
         poitem-AGREEMENT = i_tab3-ebeln.
         poitem-AGMT_ITEM = i_tab3-ebelp1.
          poitem-VEND_MAT = i_tab3-IDNLF.
          append poitem.
          poitemx-PO_ITEM = i_tab3-ebelp1.
          poitemx-MATERIAL = c_x.
          poitemx-QUANTITY = c_x.
          poitemx-PO_UNIT = c_x.
          poitemx-NET_PRICE = c_x.
          poitemx-PLANT = c_x.
          poitemx-GR_TO_DATE = c_x.
          poitemx-tax_code = c_x.
          poitemx-item_cat = c_x.
        POITEMx-ACCTASSCAT = c_x.
         poitemx-AGREEMENT = 'X'.
         poitemx-AGMT_ITEM = 'X'.
          poitemx-VEND_MAT = c_x.
          append poitemx.
        endloop.
        CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            POHEADER                    = pohead
       POHEADERX                    = poheadx
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
      POEXPIMPHEADER               =
      POEXPIMPHEADERX              =
      VERSIONS                     =
      NO_MESSAGING                 =
      NO_MESSAGE_REQ               =
      NO_AUTHORITY                 =
      NO_PRICE_FROM_PO             =
         IMPORTING
      EXPPURCHASEORDER             =
           EXPHEADER                    = ponum
      EXPPOEXPIMPHEADER            =
         TABLES
           RETURN                       = errmsg
           POITEM                       = poitem
       POITEMX                      = poitemx
      POADDRDELIVERY               =
      POSCHEDULE                   =
      POSCHEDULEX                  =
      POACCOUNT                    =
      POACCOUNTPROFITSEGMENT       =
      POACCOUNTX                   =
      POCONDHEADER                 =
      POCONDHEADERX                =
      POCOND                       =
      POCONDX                      =
      POLIMITS                     =
      POCONTRACTLIMITS             =
      POSERVICES                   =
      POSRVACCESSVALUES            =
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POEXPIMPITEM                 =
      POEXPIMPITEMX                =
      POTEXTHEADER                 =
      POTEXTITEM                   =
      ALLVERSIONS                  =
      POPARTNER                    =
        clear errflag.
        loop at errmsg.
          if errmsg-type eq 'E'.
            write:/'Error in function', errmsg-message.
            errflag = 'X'.
          else.
            write:/ errmsg-message.
          endif.
        endloop.
        if errflag is initial.
          commit work and wait.
          if sy-subrc ne 0.
            write:/ 'Error in updating'.
            exit.
          else.
            write:/ ponum-PO_NUMBER, ponum-comp_code.
          endif.
        endif.
      endloop.
    ENDFORM.                    " UPLOAD_DATA

  • Upload Purchase order text tab using BDC

    Is it possible to upload Purchase order text tab in material master (tcode mm01) using a BDC.
    If so pls tell me how to upload the same, what is the field name of the box.
    Regards,
    Senthil

    u need to use READ_TEXT or SAVE_TEXT or WRITE_TEXT or COMMIT_TEXT to upload text into SAP.

  • Doubt in uploading purchase order data using BDC

    Hi friends,
    how to upload purchase order data.
    1) In both BDC and BAPI which one is preferable?
    2) for suppose if it is through BDC,  how to use? what are the transactions that we can use(SHDB, ME21N,ME21)?
    3) To execute the job in background, is it possible for both call transaction and session method.
    Thanks in advance
    Sreenivas k

    It really depends on the number of records you have. Still for a set of 5,000 records my answer to your questions will be:
    1) In both BDC and BAPI which one is preferable?  - <b>Go with BDC</b>
    2) for suppose if it is through BDC, how to use? what are the transactions that we can use(SHDB, ME21N,ME21)? - <b>Yes, its SHDB for recording, SE38 for abap program and ME21 for PO. Avoid SAP Enjoy transactions for recording as you may end up having problems wiht it.</b>
    3) To execute the job in background, is it possible for both call transaction and session method. - <b>If you use call transaction method then you have to schedule the job to run in background or simply run it through F9 instead of F8. In case of session method you can chose to process the session in background. However  I would suggest you go with BDC Session method for this.</b>
    - Guru
    Reward points for helpful answers

  • Upload of purchase order text in the material master

    Now we have information of Purchase order text for all the material.
    Is it possible to upload the Purchase order text using LSMW.
    Some friends were telling that LSMW is not possible for Purchase Order text.
    Can anyone suggest how I can upload this purchase order text for all 1000
    material using LSMW program.
    /if not LSMW is there any other method to upload it
    thanks in advance
    deepak.s.goura

    Dear Deepak,
    there is standard direct upload i believe
    go to lsmw
    Execute 1st option
    then inLSMW:Object Attribute screen
    in standard batch/ direct input
    firsr radio button
    select object 005
    and method 003
    Program name RSTXLITF.
    Then go by normal process i.e source field , field mapping...
    In this way u can also upload Text in the Material master.
    Rewards if helpful
    Regards
    Sanjay L

  • Upload of purchase order details using LSMW

    Hi friends,
    I encountered a problem while uploading purchase order details using LSMW . in the field mapping I could not able to fine the field TCODE. as a result I could not assign the transaction code ME21. could you please suggest me a solution.
      thanks

    Hai
    Check with the following
    Select fifth Radio button then follow the bellow step
    <b>5) select radio-Button 5 and execute
       Maintain Field Mapping and Conversion Rules
       Select the Tcode and click on Rule button there you   will select constant
       and press continue button
       give Transaction Code : ME21 and press Enter</b>
    Thanks & regards
    Sreenivasulu P

Maybe you are looking for