Creation of Purchase Requisition using BAPI

Hi Experts
Can anyone provide me the sample code for creating Purchase Requisition using BAPI
Thanks in advance

Hi siri,
go throught this, hope
http://www.erpgenie.com/abap/bapi/example.htm
Also refer to the following links..
www.sappoint.com/abap/bapiintro.pdf
www.sap-img.com/bapi.htm
www.sap-img.com/abap/bapi-conventions.htm
www.planetsap.com/Bapi_main_page.htm
www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://sap-img.com/bapi.htm
Thanks
Naveen khan
Message was edited by:
        Pattan Naveen

Similar Messages

  • Bom explosion in purchase requisition using BAPi

    Hello All,
    Is it possible to explode a BOM in a purchase requisition using a functional module.
    Vivek

    Rajen,
    I have a material on which when I run MRP I get purchase requisitions with two different production version.
    In one purchase requisition I can see the BOM components and while on the other one I dont see BOM components.
    If I pass these two Purchase requisitions in EBAN table I find that RSNUM is blank for the latter case.
    If I go in this purchase requisition in change mode and explode the BOM and save, I can see BOM components.
    Also If I refresh EBAN table after this activity, I see the RSNUM field is populated.
    I hope this helps.
    Vivek

  • Create Purchase Order with reference to Purchase Requisition using BAPI's

    Hello Experts,
    I need to create a Purchase order with reference to a Purchase Requisition.
    All the above has to be done by using BAPI's.
    For creating PR, I am using BAPI_REQUISITION_CREATE.
    and for PO, I am using BAPI_PO_CREATE.
    I am not able to use the requistion number in the PO. BAPI throws the following exception
    "Requisition 1014396 00010 not selectable"
    "Document contains no items"
    Query's:
    1. Do I need to release the PR for using it in PO?
    2. If so how can I work with the "BAPI_REQUISITION_RELEASE_GEN" to release PR?
    I have tried using the BAPI getting the following error "Release outside filed of responsibility".
    Please help I am in critical Postion...
    Thanks,
    Suma

    Hi Meenakshi,
    When, I try to release error I am getting the following the error " Purchase Requisition can not be released".
    Is this problem because of authorization or data issue?
    Thanks
    Suma

  • Creation of purchase order using bapi

    hi gurus,
    Can anyone give me an example of how to create purchase order using bapi

    Hi use BAPI_PO_CREATE.. I have an eg. of changing a PO using BAPI. This is almost similar to create.. Go thru and let me know if u need more info..
    Dont forget to use 'BAPI COMMIT'  after the function call...
    DATA:
    *Update Short text, qty, net price, item no.,
    *agreement no. and agreement line no.
         it_po_item                  TYPE TABLE OF bapimepoitem,
    *Select fields
         it_po_item_x                TYPE TABLE OF bapimepoitemx,
    *Delivery date
         it_po_schedule              TYPE TABLE OF bapimeposchedule,
    *Select fields
         it_po_schedule_x            TYPE TABLE OF bapimeposchedulx,
    *Return parameters
         it_return                   TYPE TABLE OF bapiret2,
    *PO Account
         it_po_account               TYPE TABLE OF bapimepoaccount,
    *Select fields
         it_po_account_x             TYPE TABLE OF bapimepoaccountx,
    Condition Types
         it_po_cond                  TYPE TABLE OF bapimepocond,
    *Select fields
         it_po_cond_x                TYPE TABLE OF bapimepocondx,
         it_po_text                  type table of BAPIMEPOTEXT.
    Structures
    DATA:
          st_po_header               TYPE         bapimepoheader,
          st_po_header_x             TYPE         bapimepoheaderx,
          st_po_item                 LIKE LINE OF it_po_item,
          st_po_item_x               LIKE LINE OF it_po_item_x,
          st_po_schedule             LIKE LINE OF it_po_schedule,
          st_po_schedule_x           LIKE LINE OF it_po_schedule_x,
          st_return                  TYPE          bapiret2,
          st_po_account              LIKE LINE OF  it_po_account,
          st_po_account_x            LIKE LINE OF  it_po_account_x,
          st_po_cond                 LIKE LINE OF  it_po_cond,
          st_po_cond_x               LIKE LINE OF  it_po_cond_x,
          st_po_text                 like line of  it_po_text.
    Variables
    DATA : po_number    TYPE bapimepoheader-po_number,
           w_item_no(10) TYPE n VALUE  '1'.
    START-OF-SELECTION.
    test values
      po_number                = '94490'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = po_number
    IMPORTING
       OUTPUT        = po_number
      st_po_item-po_item       = w_item_no.
      st_po_item-quantity      = '00.000'.
      st_po_item-delete_ind    = 'X'.
    st_po_item-short_text    = 'ZMU-test1'.
    st_po_item-agreement     = '0060000128'.
    st_po_item-agmt_item     = '1'.
    st_po_item-net_price     = '1'.
      st_po_item_x-po_item      = w_item_no.
      st_po_item_x-po_itemx     = 'X'.
      st_po_item_x-delete_ind   = 'X'.
      st_po_item_x-quantity     = 'X'.
    st_po_item_x-short_text   = 'X'.
    st_po_item_x-agreement    = 'X'.
    st_po_item_x-agmt_item    = 'X'.
    st_po_item_x-net_price    = 'X'.
    st_po_schedule-po_item         = w_item_no.
    st_po_schedule-delivery_date   = '9/19/2008'.
    st_po_schedule-quantity        = '1'.
    st_po_schedule_x-po_item         = w_item_no.
    st_po_schedule_x-po_itemx        = 'X'.
    st_po_schedule_x-delivery_date   = 'X'.
    st_po_schedule_x-quantity        = 'X'.
    st_po_cond-itm_number  = w_item_no.
    st_po_cond-cond_type   = 'PB00'.
    st_po_cond-cond_value  = '1.000'.
    st_po_cond-currency    = 'USD'.
    st_po_cond-change_id   = 'U'.
    st_po_cond_x-itm_number  = w_item_no.
    st_po_cond_x-itm_numberx = 'X'.
    st_po_cond_x-cond_type   = 'X'.
    st_po_cond_x-cond_value  = 'X'.
    st_po_cond_x-currency    = 'X'.
    st_po_cond_x-change_id   = 'X'.
    st_po_text-PO_NUMBER = po_number.
    st_po_text-PO_ITEM = w_item_no.
    st_po_text-TEXT_LINE = 'MU_TEST1 MU_TEST2'.
      APPEND:
             st_po_item_x      TO it_po_item_x,
             st_po_item        TO it_po_item.
            st_po_schedule_x  TO it_po_schedule_x,
            st_po_schedule    TO it_po_schedule,
            st_po_cond        TO it_po_cond,
            st_po_cond_x      TO  it_po_cond_x,
            st_po_text        to  it_po_text.
    st_po_text-PO_NUMBER = po_number.
    st_po_text-PO_ITEM = w_item_no.
    st_po_text-TEXT_LINE = 'MU_TEST2'.
    st_po_text-TEXT_FORM = '03'.
    append st_po_text to it_po_text.
      PERFORM function_call.
      LOOP AT it_return INTO st_return.
        WRITE:/ st_return-message, 'Message type =', st_return-type,/.
      ENDLOOP.
      REFRESH:
                it_return,
                it_po_item,
                it_po_item_x,
                it_po_cond,
                it_po_cond_x.
    PERFORM update_price.
    WRITE:/ 'After update - Messages'.
    LOOP AT it_return INTO st_return.
       WRITE:/ st_return-message, 'Message type =', st_return-type,/.
    ENDLOOP.
    data: begin of test occurs 0,
            f1,
          end of test.
          FORM function_call                                            *
    FORM function_call.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder              = po_number
         POHEADER                  =
         POHEADERX                 =
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
    IMPORTING
      EXPHEADER                    =
       TABLES
          return                     = it_return
          poitem                     = it_po_item
          poitemx                    = it_po_item_x
      POADDRDELIVERY               =
        poschedule                 = it_po_schedule
        poschedulex                = it_po_schedule_x
       poaccount                   =
      POACCOUNTPROFITSEGMENT       =
       poaccountx                  =
      POCONDHEADER                 =
      POCONDHEADERX                =
       pocond                      =  it_po_cond
       pocondx                     =  it_po_cond_x
      POLIMITS                     =
      POCONTRACTLIMITS             =
      POSERVICES                   =
      POSRVACCESSVALUES            =
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POTEXTHEADER                 =
       POTEXTITEM                   =  it_po_text
      POPARTNER                    =
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                wait   = 'X'
           IMPORTING
                return = st_return.
    ENDFORM.

  • PM (T-code IW32) - Creation of purchase requisition permitted price=0$

    Hi,
    In IW32, we are able to enter a price of 0,00$ and save the purchase requisition. In ME51N, this action is not possible, we have to enter a price > 0,00$. Why are we able to save a 0,00$ purchase requisition using IW32, and not ME51N? We should not be able to create a 0,00$ purchase requisition in IW32 !
    IW32 procedure of PO creation:
    1. Run IW32
    2. Enter order number
    3. Go to «components» table
    4. DO NOT enter component, enter description, reqmnt qty, UM, IC, Plnt, OpAc
    5. Select the line item
    6. Click on the Purchasing button at the bottom left of the screen
    7. Enter Price = 0,00$, G/L account number, and save
    8. Quit IW32 transaction
    9. Go back in IW32, select the line item, click on the purchasing button, and there will now be a purchasing requisition number in the Purchasing Data table.
    10. Go in ME54N. You will now be able to release a 0,00$ purchase requisition....
    The system SHOULD NOT allow me to create and release a 0,00$ purchase requisition. How can I fix this?
    Thanks,
    Julien

    Hi,
    Go to SPRO > MM > Purchasing > Purchase Requisition > Define Screen Layout at Document Level > Here for Field selection key "ESTF" i.e. Requisition from prodn. order, mark field "Price and price unit" as required under selection group 'Quantity and price'.
    It will start asking Valuation Price during Order Creation for PR.

  • SNP Heuristic: Creation of purchase requisition

    Hi experts,
    we face following problem: heuristic creates purchase orders when there is no source of supply.
    Background:
    there is a forecast demand for a location product on a customer location without transport lane to the production plant due to false master data.
    The SNP heuristic generates purchase requisitions to fulfill the demand and there is no requirements shortage.
    So it is hard to recognize which forecast demands can't be fulfilled.
    Is there a parameter in material master or in a heuristic profie which disables the creation of purchase requisitions in snp heuristic when there is no source of supply.
    If no purchase requisition is created there will be a requirement shortage which can be recognised by an alert.
    Thanks for your help.
    Robert

    hi.
    As per heuristic process , the system will create a purchase requisition if there are no Tlane exists and the material's procurement type is F/X since it is a infinite planning.
    Now you can use a optimizer or CTM to restrict the system from creating purchase requisition.
    Also you can try with location heuristic.
    Hope this can help.
    regards,
    kaushik

  • Attach the file for purchase requisition using BSP service

    Hi All,
    I have Requirement Attach the any file like(PDF,TXT,PPT) to Purchase requisition using BSP service.Could please provide me any function module or BAPI for this functionality.
    Thanks in advance.
    Regards,
    Rajesh.

    Hi All,
    REPORT ZTESTJLG3 . .
    parameter p_mandt like sy-mandt default '120' .
    parameter p_equi type equnr default '1000007' .
    parameter p_path like IBIPPARMS-path memory id AD_LOCAL_PATH .
    parameter p_name(30) default 'Test attach 100007' lower case .
    " nom attachement .
    data w_prog like sy-repid .
    data w_dynnr like sy-dynnr .
    data w_attachement type borident .
    initialization .
    w_prog = sy-repid .
    w_dynnr = sy-dynnr .
    " test jean luc recuperer le code de
    fucntion module 'GOS_EXECUTE_SERVICE'
    data lo_container TYPE REF TO cl_gui_container .
    *call method lo_container->get_container_type .
    at selection-screen on value-request for p_path .
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    PROGRAM_NAME = w_prog
    DYNPRO_NUMBER = w_dynnr
    FIELD_NAME = 'P_PATH'
    IMPORTING
    FILE_NAME = p_path .
    start-of-selection .
    if sy-mandt ne p_mandt .
    write 'Erreur mandt ' .
    exit .
    endif .
    data ws_borident like borident .
    ws_borident-OBJKEY = p_equi.
    ws_borident-OBJTYPE = 'EQUI'.
    data w_document like SOOD4 .
    data : begin of wt_files occurs 0 .
    data fname(128) .
    data end of wt_files.
    wt_files-fname = p_path .
    append wt_files .
    data folder_id like SOODK .
    call function 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    region = 'B'
    IMPORTING
    folder_id = folder_id
    EXCEPTIONS
    others = 1.
    w_document-foltp = folder_id-objtp .
    w_document-folyr = folder_id-objyr .
    w_document-folno = folder_id-objno .
    append document to documents.
    w_document-objdes = p_name .
    w_document-objnam = p_name .
    data w_h_data like sooD2 ..
    data w_fol_data like sofm2.
    data w_rec_data like soos6 .
    w_h_data-objdes = p_name .
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    METHOD = 'IMPORTFROMPC'
    OFFICE_USER =
    REF_DOCUMENT = w_document
    NEW_PARENT =
    IMPORTING
    AUTHORITY =
    TABLES
    OBJCONT =
    OBJHEAD =
    OBJPARA =
    OBJPARB =
    RECIPIENTS =
    ATTACHMENTS =
    REFERENCES =
    FILES = wt_files
    CHANGING
    DOCUMENT = w_document
    HEADER_DATA = w_h_data
    FOLMEM_DATA = w_fol_data
    RECEIVE_DATA = w_rec_data .
    if w_document-okcode = 'CREA' or w_document-okcode = 'CHNG'.
    w_attachement-objtype = 'MESSAGE'.
    w_attachement-objkey = w_document(34).
    CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
    EXPORTING
    OBJ_ROLEA = ws_borident
    OBJ_ROLEB = w_attachement
    RELATIONTYPE = 'ATTA'
    IMPORTING
    BINREL =
    TABLES
    BINREL_ATTRIB =
    EXCEPTIONS
    NO_MODEL = 1
    INTERNAL_ERROR = 2
    UNKNOWN = 3
    OTHERS = 4
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endif .
    For above requirement i am trying like above code.
    working fine but which transaction i can find the attach file.I am trying to fine using ME52N transaction but i c't find this file.
    Please suggest me how can i find this one
    Thanks in advance,
    RajeshV.

  • Creation indicator purchase requisition in md02

    Hello SAP Gurus,
         This is regarding creation indicator purchase requisition in md02.In this creation indicator purchase requisition if we keep setting as 2 than it will create purchase requisition if the dates of PR are in the opening period and will create planned order  if dates of PR falls out of opening period.And it takes the opening period from schedule margin key.
         My question is , as system calculate the opening date by subtracting the number of days which we have given in opening period in schedule margin key from the order start date.suppose if order start date is 10.03.2008 and we have given the opening period of 5 days,than the opening date will be 05.03.2008 if there are no holidays between it.So how it comes that PR date will fall in opening period?I am confused that when system will create planned order and when system will create PR if we keep creation indicator purchase requisition as 2.
          Plz help me with this query.If you could explain with one example than it would be great.
                         Thanking all in advance.And obviously for suitable answer i will definately give good points.

    Hi,
    System calculates the opening date  by subtracting the number days given as opening period at SMK from order start date.
    For creation ind =2 ,
    MRP run date decides the PR / Planned order creation even if u set procurement F.
    If MRP run date falls bettwen the opening date & order start date , it will create PR only,
    If run MRP run date falls outside the opening preriod ie earlier than the order opening date, system will create planned order and it has to converted to PR
    For  examble,  Order start date is  28.03.2008 and 2 day is defined as opening period SMK for ROH.
    If u run MRP on today it will create planned order.  
    Hope u understand , ifso reward and close.
    Regards
    Pradeep

  • Sales order - automatic creation of purchase requisition - cost assignment

    Hi
    When the sales order is released, we have an automatic creation of Purchase requisation. We have given "internal order" as the cost obect in the sales order. But when the system has created automatic purchase requisition, it has not picked internal order. What could be the reason?
    Thank you for the help.
    Thanks
    Ram

    Hi
    I feel that it is abug in the development you have carried out for creation of Purchase requisition when a sales order is relased,
    Please check the enhancement, you need to pass the values to the correct table after derivation.
    Thanks & Regards
    Kishore

  • Sales order - automatic creation of purchase requisition - CO assignment

    Hi
    When the sales order is released, we have an automatic creation of Purchase requisation. We have given "internal order" as the cost obect in the sales order. But when the system has created automatic purchase requisition, it has not picked internal order. What could be the reason?
    Thank you for the help.
    Thanks
    Ram

    Hi
    I feel that it is abug in the development you have carried out for creation of Purchase requisition when a sales order is relased,
    Please check the enhancement, you need to pass the values to the correct table after derivation.
    Thanks & Regards
    Kishore

  • Auto Creation of Purchase Requisition at Contract Level

    Hi All,
    I am having business requirement for creation of purchase requisition at contract level for third party Products.
    Brief Business requirement
    My client is in trading business of telecom product.  They are sourcing product from different-different vendors and some of the product is also supplied by him self. As a business practice the system will automatically create an Installed base as per structured by business owner once delivered the product to end customer and also assigned warranty norms.
    Once warranty is over then customer will called for contract since at the time sailing the product warranty will be liability of the company which in terns had some mutual contract with supplier (back to back replacement).
    But once the same will come under service agreement/contract on that time they want installed base selection of components should had a functionality to segregate component based on vendor because they want to calculate % margin based on net sale value of the product.(e.g 10% of net sale Value 10,0000)  not only that they also wants based on that system should automatically create Purchase requisition so that logistic department will take care of third party agreement part.
    If any body come across with such kind of business scenario. Please share the proposed solution.
    Regards
    Neeraj

    Hello,
    I noticed that this question had status answered.  We have the same requirement.... how did you resolve this?
    Best Regards
    Kristof

  • Creation of sale order using bapi in webdynpro using table control

    only first row is getting updated when checked in va03, the line items are not getting replaced, only first row is committed..
    Here is the code for table control i used...
    http://www.scribd.com/doc/51879492/creation-of-sale-order-using-bapi-in-webdynpro-using-table-control
    pls help me out with this..

    Duplicate Posting.  Original is here: Sales order creation with bapi in webdynpro using table control

  • HOW TO CREATE PURCHASE ORDER USING BAPI

    HI FRIENDS,
    I HAVE URGENT REQUIREMNT ,TO CREATE PURCHASE ORDER USING BAPI.PLS HELP ON THIS.
    UR'S
    RAVI

    Hi
    See the sample code and do accordingly
    REPORT zpo_bapi_purchord_tej.
    DATA DECLARATIONS *
    TYPE-POOLS slis.
    TYPES: BEGIN OF ty_table,
    v_legacy(8),
    vendor TYPE bapimepoheader-vendor,
    purch_org TYPE bapimepoheader-purch_org,
    pur_group TYPE bapimepoheader-pur_group,
    material TYPE bapimepoitem-material,
    quantity(13),
    delivery_date TYPE bapimeposchedule-delivery_date,
    net_price(23),
    plant TYPE bapimepoitem-plant,
    END OF ty_table.
    TYPES: BEGIN OF ty_alv,
    v_legs(8),
    success(10),
    v_legf(8),
    END OF ty_alv.
    TYPES: BEGIN OF ty_alv1,
    v_legf1(8),
    v_msg(500),
    END OF ty_alv1.
    *-----Work area declarations.
    DATA: x_table TYPE ty_table,
    x_header TYPE bapimepoheader,
    x_headerx TYPE bapimepoheaderx,
    x_item TYPE bapimepoitem,
    x_itemx TYPE bapimepoitemx,
    x_sched TYPE bapimeposchedule,
    x_schedx TYPE bapimeposchedulx,
    x_commatable(255),
    x_alv TYPE ty_alv,
    x_alv1 TYPE ty_alv1,
    x_alv2 TYPE ty_alv1.
    *-----Internal table declarations.
    DATA: it_table TYPE TABLE OF ty_table,
    it_commatable LIKE TABLE OF x_commatable,
    it_item TYPE TABLE OF bapimepoitem,
    it_itemx TYPE TABLE OF bapimepoitemx,
    it_sched TYPE TABLE OF bapimeposchedule,
    it_schedx TYPE TABLE OF bapimeposchedulx,
    it_alv TYPE TABLE OF ty_alv,
    it_alv1 TYPE TABLE OF ty_alv1,
    it_alv2 TYPE TABLE OF ty_alv1.
    DATA: po_number TYPE bapimepoheader-po_number,
    x_return TYPE bapiret2,
    it_return TYPE TABLE OF bapiret2,
    v_file TYPE string,
    v_temp(8),
    v_succsount TYPE i VALUE 0,
    v_failcount TYPE i VALUE 0,
    v_total TYPE i.
    DATA: v_temp1(5) TYPE n VALUE 0.
    DATA: x_event TYPE slis_t_event,
    x_fieldcat TYPE slis_t_fieldcat_alv,
    x_list_header TYPE slis_t_listheader,
    x_event1 LIKE LINE OF x_event,
    x_layout1 TYPE slis_layout_alv,
    x_variant1 TYPE disvariant,
    x_repid2 LIKE sy-repid.
    DATA : it_fieldcat TYPE TABLE OF slis_t_fieldcat_alv.
    SELECTION-SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK v_b1 WITH FRAME.
    *-----To fetch the flat file.
    PARAMETERS: p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK v_b1.
    AT SELECTION-SCREEN *
    AT SELECTION-SCREEN.
    IF p_file IS INITIAL.
    MESSAGE text-001 TYPE 'E'.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    *-----To use F4 help to find file path.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = p_file.
    v_file = p_file.
    START-OF-SELECTION *
    START-OF-SELECTION.
    PERFORM gui_upload.
    LOOP AT it_table INTO x_table.
    PERFORM header_details.
    v_temp = x_table-v_legacy.
    LOOP AT it_table INTO x_table WHERE v_legacy = v_temp.
    PERFORM lineitem.
    PERFORM schedule.
    ENDLOOP.
    DELETE it_table WHERE v_legacy = v_temp.
    PERFORM bapicall.
    MOVE po_number TO x_alv-success.
    APPEND x_alv TO it_alv.
    CLEAR x_alv.
    *-----To clear the item details in internal table after the operation for a header.
    REFRESH: it_item,
    it_itemx,
    it_sched,
    it_schedx.
    CLEAR: v_temp1.
    ENDLOOP.
    v_total = v_succsount + v_failcount.
    PERFORM display_alv.
    FORM GUI_UPLOAD *
    FORM gui_upload .
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = v_file
    filetype = 'ASC'
    TABLES
    data_tab = it_commatable
    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.
    *-----To fetch the comma seperated flat file into an internal table.
    LOOP AT it_commatable INTO x_commatable.
    IF x_commatable IS NOT INITIAL.
    SPLIT x_commatable AT ',' INTO
    x_table-v_legacy
    x_table-vendor
    x_table-purch_org
    x_table-pur_group
    x_table-material
    x_table-quantity
    x_table-delivery_date
    x_table-net_price
    x_table-plant.
    APPEND x_table TO it_table.
    ENDIF.
    CLEAR x_table.
    ENDLOOP.
    ENDIF.
    ENDFORM. " gui_upload
    FORM HEADER_DETAILS *
    FORM header_details .
    MOVE 'NB' TO x_header-doc_type.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = x_table-vendor
    IMPORTING
    output = x_table-vendor
    MOVE x_table-vendor TO x_header-vendor.
    MOVE x_table-purch_org TO x_header-purch_org.
    MOVE x_table-pur_group TO x_header-pur_group.
    x_headerx-doc_type = 'X'.
    x_headerx-vendor = 'X'.
    x_headerx-purch_org = 'X'.
    x_headerx-pur_group = 'X'.
    ENDFORM. " header_details
    FORM LINEITEM *
    FORM lineitem .
    v_temp1 = v_temp1 + 10.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = v_temp1
    IMPORTING
    output = v_temp1.
    MOVE v_temp1 TO x_item-po_item.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = x_table-material
    IMPORTING
    output = x_table-material.
    MOVE x_table-material TO x_item-material.
    MOVE x_table-quantity TO x_item-quantity.
    MOVE x_table-net_price TO x_item-net_price.
    MOVE x_table-plant TO x_item-plant.
    x_itemx-po_item = v_temp1.
    x_itemx-material = 'X'.
    x_itemx-quantity = 'X'.
    x_itemx-net_price = 'X'.
    x_itemx-plant = 'X'.
    APPEND x_item TO it_item.
    APPEND x_itemx TO it_itemx.
    CLEAR: x_item, x_itemx.
    ENDFORM. " lineitem1
    FORM SCHEDULE *
    FORM schedule .
    MOVE x_table-delivery_date TO x_sched-delivery_date.
    MOVE v_temp1 TO x_sched-po_item.
    x_schedx-delivery_date = 'X'.
    x_schedx-po_item = v_temp1.
    APPEND x_sched TO it_sched.
    APPEND x_schedx TO it_schedx.
    CLEAR: x_sched, x_schedx.
    ENDFORM. " schedule
    FORM BAPICALL *
    FORM bapicall .
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = x_header
    poheaderx = x_headerx
    IMPORTING
    exppurchaseorder = po_number
    TABLES
    return = it_return
    poitem = it_item
    poitemx = it_itemx
    poschedule = it_sched
    poschedulex = it_schedx.
    IF po_number IS NOT INITIAL.
    v_succsount = v_succsount + 1.
    MOVE x_table-v_legacy TO x_alv-v_legs.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ELSE.
    v_failcount = v_failcount + 1.
    MOVE x_table-v_legacy TO x_alv-v_legf.
    MOVE x_table-v_legacy TO x_alv1-v_legf1.
    LOOP AT it_return INTO x_return.
    IF x_alv1-v_msg IS INITIAL.
    MOVE x_return-message TO x_alv1-v_msg.
    ELSE.
    CONCATENATE x_alv1-v_msg x_return-message INTO x_alv1-v_msg SEPARATED BY space.
    ENDIF.
    ENDLOOP.
    APPEND x_alv1 TO it_alv1.
    CLEAR x_alv1.
    ENDIF.
    ENDFORM. " bapicall
    FORM DISPLAY_ALV *
    FORM display_alv .
    PERFORM x_list_header.
    PERFORM build_fieldcat CHANGING x_fieldcat.
    x_repid2 = sy-repid.
    x_event1-name = 'TOP_OF_PAGE'.
    x_event1-form = 'TOP_OF_PAGE'.
    APPEND x_event1 TO x_event.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = x_repid2
    is_layout = x_layout1
    it_fieldcat = x_fieldcat
    i_callback_user_command = 'USER_COMMAND'
    i_callback_top_of_page = 'TOP_OF_PAGE'
    i_save = 'A'
    is_variant = x_variant1
    it_events = x_event
    TABLES
    t_outtab = it_alv
    EXCEPTIONS
    program_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.
    ENDFORM. " display_master_data
    FORM USER_COMMAND *
    FORM user_command USING ucomm LIKE sy-ucomm selfield
    TYPE slis_selfield.
    READ TABLE it_alv INTO x_alv INDEX selfield-tabindex.
    CLEAR : x_alv2,it_alv2[].
    LOOP AT it_alv1 INTO x_alv1 WHERE v_legf1 = x_alv-v_legf.
    x_alv2 = x_alv1.
    APPEND x_alv2 TO it_alv2 .
    ENDLOOP.
    DATA : it_fieldcat TYPE slis_t_fieldcat_alv.
    DATA : x3_fieldcat LIKE LINE OF it_fieldcat.
    CLEAR : x3_fieldcat,it_fieldcat[].
    CLEAR x3_fieldcat.
    x3_fieldcat-col_pos = '1'.
    x3_fieldcat-fieldname = 'V_LEGF1'.
    x3_fieldcat-reptext_ddic = text-111.
    x3_fieldcat-ref_tabname = 'IT_ALV2'.
    APPEND x3_fieldcat TO it_fieldcat.
    CLEAR x3_fieldcat.
    CLEAR x3_fieldcat.
    x3_fieldcat-col_pos = '1'.
    x3_fieldcat-fieldname = 'V_MSG'.
    x3_fieldcat-reptext_ddic = text-112.
    x3_fieldcat-ref_tabname = 'IT_ALV2'.
    APPEND x3_fieldcat TO it_fieldcat.
    CLEAR x3_fieldcat.
    x_layout1-colwidth_optimize = 'X'.
    x_layout1-zebra = 'X'.
    IF it_alv2[] IS NOT INITIAL.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = x_repid2
    is_layout = x_layout1
    it_fieldcat = it_fieldcat
    i_save = 'A'
    i_callback_top_of_page = 'TOP'
    is_variant = x_variant1
    it_events = x_event
    TABLES
    t_outtab = it_alv2
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    ENDIF.
    ENDFORM.
    FORM USER_COMMAND *
    FORM top.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = 'Commentry'.
    ENDFORM.
    FORM BUILD_FIELDCAT *
    FORM build_fieldcat CHANGING et_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: x1_fieldcat TYPE slis_fieldcat_alv.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '1'.
    x1_fieldcat-fieldname = 'V_LEGS'.
    x1_fieldcat-reptext_ddic = text-108.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '2'.
    x1_fieldcat-fieldname = 'SUCCESS'.
    x1_fieldcat-key = 'X'.
    x1_fieldcat-reptext_ddic = text-109.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '3'.
    x1_fieldcat-fieldname = 'V_LEGF'.
    x1_fieldcat-key = 'X'.
    x1_fieldcat-reptext_ddic = text-110.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    ENDFORM. " build_fieldcat
    FORM BUILD_LIST_HEADER *
    FORM x_list_header.
    DATA: x_list_header1 TYPE slis_listheader.
    *-----List Header: type H
    CLEAR x_list_header1 .
    x_list_header1-typ = 'H'.
    x_list_header1-info = text-105.
    APPEND x_list_header1 TO x_list_header.
    *-----List Key: type S
    x_list_header1-typ = 'S'.
    x_list_header1-key = text-106.
    x_list_header1-info = v_total.
    APPEND x_list_header1 TO x_list_header.
    *-----List Key: Type S
    CLEAR x_list_header1 .
    x_list_header1-typ = 'S'.
    x_list_header1-key = text-107.
    x_list_header1-info = v_succsount.
    APPEND x_list_header1 TO x_list_header.
    ENDFORM. " build_list_header
    FORM TOP_OF_PAGE *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = x_list_header.
    ENDFORM. " TOP_OF_PAGE
    Reward points if useful
    Anji

  • Rounding Values while creating purchase requisitions using ME51N

    Hi MM Experts,
    I have created some materials with a Rounding Value maintained in MRP1 View of the material master.
    Whenever I raise a purchase order, the order quantity rounds off to the value maintained in the material master which is the correct functionality.
    But when i try to create a purchase requisition using ME51N, the rounding functionality doesn't work.
    Example: Rounding value (in MRP1 view) of a material is 25.
    The order quantity entered is 4. But before saving the PURCHASE ORDER the order quantity will be changed to 25(which is the rounding value). This is the correct functionality but doesn't happen with the PURCHASE REQUISITION (ME51N)
    Can someone guide me on how to make the rounding value work for purchase requisitions when using ME51N?
    Thanks in advance.
    cheers,
    Randi

    Hi!
    i had the same problem with a company.
    i did not find any customizing possibilities.
    I solved it with BAdI ME_PROCESS_REQ_CUST
    Method PROCESS_ITEM.
    I hope this helps
    Flo

  • Purchase Requisition using webdynpro

    Hi all,
        I have a requirement wherein i have to create a purchase requisition using webdynpro by taking Document type, Plant, Storage Location, Material and Quantity as input. I am able to generate a PR NO. for a single Material but when there are multiple Materials for the same plant and storage location the PR does not get generated. Kindly Help.
    Regards,
    Santhosh.

    Hi,
    In extended notification the approvar will be asked to SAP login details and proceed for approval process. Without log into sap you cannot approve the PR. Please refer below link for better clarity. Thanking you.
    Approve workitems from outlook

Maybe you are looking for

  • Is there anything to be taken care of while using GUI_DOWNLOAD in ITS?

    Hi All,          I have a requirement on which I am using GUI_DOWNLOAD for downloading a file into a network Drive.In the foreground I am executing using ITS.When I click on 'SUBMIT' button it goes to "Interpreter failed ...Internal error code: 0x210

  • Error: Net Valuw is Zero in the invoice

    Hi Experts Our user has created condition record for the condition type "PR00" after the creation of sales order.  Maual entry of the price is not allowed for the user which is blocked in the condition type "PR00" (i.e Maual Entry-->D Not possible to

  • I received an apple tv but my tv doesnt have an hdmi input only av can i find an adapter?

    I received an apple tv, but my tv doesnt have any HDMI input only three cable av, is it possible to find adpter to connect. Thank you.

  • Export help needed

    Hi I want to export a short film Ive made so it can be viewed on a pc and Quicktime doesn't seem to work. I have only very basic understanding of File formats so I may not have saved the files correctly. I have FCP studio and the film was shot in HDV

  • I am having a problem finding a child node (c#)

    Hi ! My XML is a bit like this: <Layers> <Layer> <OverlapNames> </OverlapNames> <CommonNames> </CommonNames> <SnapNames> <SnapName Name="zzz" /> <SnapName Name="yyy" /> </SnapNames </Layer> </Layers> I have this initial XmlNode which returns a valid