Creating PO's - Batch Program

Hi All,
According to my requirement I have to create PO's from the open PR's and make it as a batch job.
What logic do I need to use for this, please help me out in this.
Thanks,
Praveen

REPORT ZTEST_BAPI .
*- BAPI related declarations
DATA : g_pohdr TYPE bapimepoheader,
g_pohdrx TYPE bapimepoheaderx,
gt_poitem TYPE TABLE OF bapimepoitem,
gt_poitemx TYPE TABLE OF bapimepoitemx,
gt_posched TYPE TABLE OF bapimeposchedule,
gt_poschedx TYPE TABLE OF bapimeposchedulx,
gt_poacct TYPE TABLE OF bapimepoaccount,
gt_poacctx TYPE TABLE OF bapimepoaccountx,
gt_poservice TYPE TABLE OF bapiesllc,
gt_posrvacc TYPE TABLE OF bapiesklc,
gt_return TYPE TABLE OF bapiret2.
perform prepare_header.
PERFORM prepare_items.
PERFORM prepare_schedule.
perform create_po.
*& Form prepare_header
Set up header structure
FORM prepare_header.
g_pohdr-comp_code = '2000'.
g_pohdrx-comp_code = 'X'.
set up doc type
g_pohdr-doc_type = 'NB'.
g_pohdrx-doc_type = 'X'.
g_pohdr-vendor = '0008000330'.
g_pohdrx-vendor = 'X'.
g_pohdr-langu = sy-langu.
g_pohdrx-langu = 'X'.
g_pohdr-purch_org = 'BA01'.
g_pohdrx-purch_org = 'X'.
g_pohdr-pur_group = '800'.
g_pohdrx-pur_group = 'X'.
g_pohdr-currency = 'USD'.
g_pohdrx-currency = 'X'.
ENDFORM. " prepare_header
*& Form prepare_items
Set up item values
FORM prepare_items.
DATA : ls_poitem TYPE bapimepoitem,
ls_poitemx TYPE bapimepoitemx.
ls_poitem-po_item = '00010'.
ls_poitemx-po_item = '00010'.
ls_poitemx-po_itemx = 'X'.
ls_poitem-short_text = 'ABSORBER,SHOCK:PALLETIZER'.
ls_poitemx-short_text = 'X'.
ls_poitem-material = '000000000001070062'.
ls_poitemx-material = 'X'.
ls_poitem-vend_mat = 'xyz'.
ls_poitemx-vend_mat = 'X'.
ls_poitem-quantity = '100'.
ls_poitemx-quantity = 'X'.
ls_poitem-po_unit = 'EA'.
ls_poitemx-po_unit = 'X'.
ls_poitem-po_unit_iso = 'EA'.
ls_poitemx-po_unit_iso = 'X'.
ls_poitem-net_price = '6.32'.
ls_poitemx-net_price = 'X'.
ls_poitem-price_unit = '1'.
ls_poitemx-price_unit = 'X'.
ls_poitem-item_cat = 'D'.
ls_poitemx-item_cat = 'X'.
ls_poitem-plant = '1575'.
ls_poitemx-plant = 'X'.
ls_poitem-ACCTASSCAT = 'K'.
ls_poitemx-ACCTASSCAT = 'X'.
ls_poitem-acctasscat = <fs_req>-knttp.
ls_poitemx-acctasscat = 'X'.
ls_poitem-distrib = <fs_req>-vrtkz.
ls_poitemx-distrib = 'X'.
ls_poitem-part_inv = <fs_req>-twrkz.
ls_poitemx-part_inv = 'X'.
ls_poitem-gr_ind = <fs_req>-wepos.
ls_poitemx-gr_ind = 'X'.
ls_poitem-gr_non_val = <fs_req>-weunb.
ls_poitemx-gr_non_val = 'X'.
ls_poitem-ir_ind = <fs_req>-repos.
ls_poitemx-ir_ind = 'X'.
ls_poitem-agreement = <fs_req>-konnr.
ls_poitemx-agreement = 'X'.
ls_poitem-agmt_item = <fs_req>-ktpnr.
ls_poitemx-agmt_item = 'X'.
ls_poitem-preq_no = <fs_req>-banfn.
ls_poitemx-preq_no = 'X'.
ls_poitem-preq_item = <fs_req>-bnfpo.
ls_poitemx-preq_item = 'X'.
ls_poitem-preq_name = <fs_req>-afnam.
ls_poitemx-preq_name = 'X'.
ls_poitem-pckg_no = <fs_req>-packno.
ls_poitemx-pckg_no = 'X'.
APPEND : ls_poitem TO gt_poitem,
ls_poitemx TO gt_poitemx.
ENDFORM. " prepare_items
*& Form prepare_schedule
Schedule data
FORM prepare_schedule.
DATA : ls_posched TYPE bapimeposchedule,
ls_poschedx TYPE bapimeposchedulx.
ls_poschedx-po_item = '00010'.
ls_posched-po_item = '00010'.
ls_poschedx-po_itemx = 'X'.
ls_posched-delivery_date = '10/31/2005'.
ls_poschedx-delivery_date = 'X'.
ls_posched-quantity = '100'.
ls_poschedx-quantity = 'X'.
ls_posched-preq_no = <fs_req>-banfn.
ls_poschedx-preq_no = 'X'.
ls_posched-preq_item = <fs_req>-bnfpo.
ls_poschedx-preq_item = 'X'.
APPEND : ls_posched TO gt_posched,
ls_poschedx TO gt_poschedx.
ENDFORM. " prepare_schedule
*& Form create_po
Create PO with ref to the req
FORM create_po.
DATA : lt_return TYPE TABLE OF bapiret2,
l_ponum TYPE banfn.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = g_pohdr
poheaderx = g_pohdrx
testrun = 'X'
IMPORTING
exppurchaseorder = l_ponum
TABLES
return = lt_return
poitem = gt_poitem
poitemx = gt_poitemx
poschedule = gt_posched
poschedulex = gt_poschedx
poaccount = gt_poacct
poaccountx = gt_poacctx
poservices = gt_poservice
posrvaccessvalues = gt_posrvacc.
APPEND LINES OF lt_return TO gt_return.
IF NOT l_ponum IS INITIAL.
MESSAGE s398(00) WITH 'Purchase document ' l_ponum
' successfully created'.
ENDIF.
ENDFORM. " create_po
<b>
Reward points</b>
Regards

Similar Messages

  • How to create check in batch automatically after automatic payment program

    Hello
    SAP Experts i am getting a  issue
    how to create check in batch automatically after automatic payment program ( t code is f110)
    Thanks & Regards
    Narendra.G

    Hi Narendra,
    Please note the process below for cheque Printing:-
    1. The pre requisite for Cheque printing is you have used program RFFOUS_c/or the Z version of this program in FBZP and that you have maintained the form name in the field Form name for Payment medium in FBZP.
    2. You have a pre printed stationary on which you want to print and the Program & the form has been modified to print as per this.
    3. In F110, you must have assigned the Variant name, which would specify the cheque lot no. and this should exactly match with the current cheque no. in the pre printed stationary.
    4. Now, after all this setting, when you run Payment run in F110, then also only the Payment documents are posted but the cheque no.s are not updated in the Payment document no. nor the PAYR table is updated. It is only when you run the Print out tab, that a spool is created in SP01 for cheque printing as per the Payment documents.
    5. Then in SP01, you can print the spool on your pre printed stationary.
    This is the complete process of printing cheques from F110. Hope this helps..
    Regards,
    SAPFICO

  • Using Sap Batch Program - RFBIBL00

    Hi,
    I have gone through the forum in trying to understand the standard sap batch program, but still unable to do so.
    I have a requirement where I need to use standard sap batch program RFBIBL00
    I need to use T.code: F-22 for processing
    I have a posting text file to upload. Please explain me how to use the standard sap batch program.
    I know there are 3 structures BGR00, BBKPF and BBSEG which needs to be populated before calling the program RFBIBL00
    Please explain me in detail.
    Appreciate all the help from your end.
    Madan

    This is a brief guideline from memory, so you will have to modify it to fit your exact requirements.
    1. Initialise the work areas, can be done by
    perform init_strukturen_erzeugen(rfbibli0) using '/'
    2. Fill your batch structure BGR00 and append to output file data itab
    3. Load your data from text file, and loop around it
    4. Fill your header structure BBKPF per document, append to output file itab
    5. Fill your lines itab BBSEG per document line, append to output file itab
    6. Repeat 4 & 5 for each document in text file.
    7. Create temporary output file on App server using contents of output file itab
    8. Submit rfbibl00 program using output file name
    9. Delete the temporary file (good practice)
    Hope that helps for starters

  • Use of Standard Batch Programs - RFBIBL00 and RFBIBL01

    Dear All,
    I am facing issues while using the standard batch program
    RFBIBL00 which in turn triggers RFBIBL01 for creating batch session.
    I understand that there are 3 structures BGR00, BBKPF and BBSEG which needs to be populated.
    I also understand that this program reads data from file on application server.
    I want to understand whether the above batch program can be used for
    1. To Create Batch Session ?
    2. To Call Transaction ?
    Please explain the steps in detail, for both these processes.
    I am calling transaction F-22 to post invoices.
    Please exlpain in detail on how to go about this.
    Warm Regards'
    Madan

    Hi,
    Thank you for the information.
    I have already populated the strucutres BGR00 and BBKPF.
    I am facing issues while populating data for BBSEG.(item leve data)
    Can u pls tell me how exactly i can populate these structures and where exactly to do so ?
    Please explain me the process of populating the header and item level data structures.
    Appreciate all the help from your end.
    Once again thanks for ur time and information.
    Madan

  • Batch program in PCUI Portal

    Hello All,
    We have a requirement to build up a batch program that will display the unapproved opportunities to the user in a list. Each line in this list shall be a URL, clicking on which will open up the opportunity details.
    The user will have an option to select opportunities and then mass approve them.
    Can anyone guide me as to how can this be achieved in SAP CRM PCUI portal.
    Thanks.
    Regards
    Priyanka

    Hi Priyanka,
    I'm not sure if  your requirement is to create a new PCUI application or to create a report which could be run when needed.
    If it's for a new PCUI application, the URL can't be displayed using standard feature of Object Link Navigation (OLN) which would redirect the user to the embedded object link. For mass approval also, there's a standard functionality available in 5.0 for Mass Changes. Kindly refer to PCUI Cookbook for more detail.
    I hope it helps.
    Cheers,
    Gyan.

  • How to create po through batch run

    Hi,
    how to create po through batch run (through background job)
    Prashanth

    Hi Prashanth ,
    Run the below program as a background job.
    Make sure that inforecord exists for all and automatic PO are ticked in Vendor and Material Master.
    Program : RM06BB30
    Create a suitable variant.
    Job Creation : Tcode : SM36
    Regards
    Ramesh Ch

  • Batch program

    HI,
    A batch program is needed.This batch program will be scheduled as a batch job.
    It should query table say 'A' depending on two mandatory and one optional parameter.There is only one primary key in table 'A 'and it is an optional parameter.This query would give a list of say all sales orders(optional paramter).Using this list of sales orders, I would then need to query another table say 'B' where sales order is a primary key along with material number.Now for sales order S and material M1 I need to update a certain field in' B'.For same sales order S and material M2 I need to update a certain field in 'B'.Also I need to update a field in table C where there are four key fields and sales order and material are two fields.The business rules for update need to be taken from a config table.
    How can I ?
    (A) Do the process in the backgroung as a say BDC /batch input without end user intervention
    (B)Create a new config table and maintain the rules there.I know the rules.
    Thanks for your help in advance !!

    Hi,
    you could update the tables directly - but then you / the batch report would be fully responsible for the correct business logic, not only the additional customer requirements, but also all standard logic -> usually a task to big.
    Instead it's easier, safer, recommended to use standard interface to update tables (as long as we don't speak about append fields.
    In your case BAPI_SALESORDER_CHANGE might give you the possibility to change the values - but you didn't describe the fields / tables good enough for a good help. Also call transaction would follow the business rules (when you add the customer logic with user-exit or field-exit...).
    I hope I got your problem, your description was a little bit ... around some corners?
    Regards,
    Christian

  • Batch program with COR1

    Hi :
    I want to create a batch program using call transaction for process order COR1.
    I need an example for this, by creating a recording " shbd " using COR1.
    Thanks.
    Rag

    hi,
    Go to SHDB transaction.
    Enter New Recording nameand Transaction Name as 'COR1', start new Recording
    You will get the First Screen: with Material No, Production Plant, Planning Plant,
    PO type etc, Enter the Mandatory fields, enter you will get the second screen , again enter the Mandatory fields in that SAVE the recording.
    Then go to PROGRAM in the Menu.It will create a Program  automatically.
    Then You have to modify that program littlebit as per your requirements, similar to a common BDC program.
    Hope this helps.
    Regards,
    Anji

  • Java batch program with wakeup

    I am interested in developing a batch java program which will hopefully perform the following I need to know how to get started with a timed-event.
    Application description:
    I would like the java batch program to wakeup at 7:00 am each morning and read a database and fire an email with the resultset of the database query. I can handle the database query portion. I am looking for a solution for the wakeup at 7:00 am and the email.
    Any direction would be helpfull.

    Look up java.util.Timer, and java.util.TimerTask. It does exactly what you need in terms of a batch event running at 7:00am every morning. Alternatively, you can do it up as a simple program, and create a cron job.
    As for e-mail, JavaMail isn't really that difficult. Look it up :)

  • How to run batch programs using SUBMIT command without any interaction need

    Hello ABAP gurus,
    I have created a batch program in SE38 which calls many other SE38 Programs (Reports).
    I have used the command SUBMIT to call the sub programs. There are about 15 sub programs that this main batch program is calling.
    It works fine, but after calling each subprogram it stops and I have to manually click on 'Back Button' in green on the sap screen to run the next program in the list. Like this I have to do 15 times to run all the programs in the batch.
    Is there a way to avoid this manual intervention and make the program run all the sub programs on its own.
    Your feedback will be highly appreciated.
    Thanks
    Ram

    Thanks Sampath for the response.
    Yes I am using the option "AND RETURN". So it is coming out of each sub program, and it is at this stage it waits for me to click on 'backward green arrow' to continue to the next.
    Here is the code I have used
      SUBMIT Z_AS_BI_F0005_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_DIVISION_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_COMPANY_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_CUSTOMER_EXTRACT WITH  S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_BRANCH_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_BUS_UNIT_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_ADDRESS_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_CUSTOMER_GROUP_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_GROUP_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_PMT_TERMS_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_REGION_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_TERRITORY_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
    Any other suggestions or feedback will be appreciated.
    Tks
    Ram

  • Create FI payment batch error

    we are using BCM, we run F110, run id HET , date: 25.03.2014. payment list and payment order is generated, cross payment run
    we then run fbpm1, input run id HET and run date  25.03.2014 under "payment run" tab, it says:
    Program SAPFPAYM_MERGE: No records selected
    Message no. F0073
    Diagnosis
    The system did not find any data to be processed in the payment dataset.
    Procedure
    Check the selection criteria with which you started the payment medium program SAPFPAYM_MERGE and compare it with the payment list.
    why no batch created? thanks

    Check Note: 234846.1 - APXPAWKB Errors With ORA-01422 ORA-06512 FRM-40502 When Creating A New Batch After Navigating To The Document Field
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=234846.1

  • Create DN by batch for consignment SO

    Hi experts,
    is it possible to use VL10/VL10A/VL10BATCH to create DN by batch for consignment SO? How to do this?
    thanks,
    Colin

    Hello,
    from VL10C create a variant with the relevant selection criteria. Then follow the menu path "Program --> Execute in backgroundground job will be started.
    Then from SM37 you can copy the job and schedule it according to the required timing.
    Best regards,
    Andrea

  • Error : batch program

    Hi :
      I had created a bdc program using call transcation.When i execute in mode 'A',im selecting a record from my ALV list and creating a process order.
    but when i execute in mode 'N', it says "no records are seelcted', since im not selecting any record from the ALV .
    My recording did not show any field for selecting the record in the batch program, how can i select a particular record from ALV list and execute it mode N'.
    Thx .
    Rah

    Hello,
    do you want to process all entries of your alv list or only one entry? How do you know in background task which entry you want to process ?
    You can check for batch mode (sy-batch = 'X') and display the alv only in online version. for background task you loop over your alv output table to fill your bdc structure and then process call transaction.
    regards sven

  • MICN - batch program

    Hello
    We want to run this t-code by batch program. while executing the program on background ,it is not creating the physical inventory document . any suggestion please'
    Thanks
    Nick

    Hi Nick
    Hope the below information helps
    Batch Input: Create Physical Inventory Documents For Cycle Counting
    Title
    Batch input: Creating physical inventory documents for cycle counting
    Purpose
    You use this report to create: batch input sessions physical inventory documents for the cycle counting physical inventory procedure.
    Requirements
    This report only takes materials with cycle counting indicators into account. Before running the report, at plant level you must set this indicator for all materials that are to be included in the cycle counting procedure. Set the cycle counting indicator in one of the following ways:
    Manually in the storage data of the material master record
    Automatically using the report RMCBIN00
    Authorization check
    If you want to create batch input sessions with this report, you need authorization to enter physical inventory documents for all required plants (authorization object Physical inventory: Physical inventory document in plant, activity 01).
    This authorization check is carried out even if you define with the Create batch input indicator that at first only a control list of the data to be processed is to be issued.
    Features
    In addition to unrestricted-use stock, you can include stock in quality inspection and blocked stock in the selection.
    By specifying a threshold value, you can define that only stocks above or up to a particular level are included.
    Selection
    On the initial screen, you can restrict your selection.
    Output
    The system issues a list containing the following data:
    It lists all stock management units for which no physical inventory documents can be created.
    It then lists the stock management units for which a physical inventory is already active, but has not been completed within the predefined float time and therefore must be completed urgently. These stock management units are not included when the batch input session is created because active physical inventory documents already exist.
    In addition, the list contains all materials for which cycle counting is required within the planned interval (specified interval for the planned count date). If a physical inventory had already been due prior to the planned interval, the planned count date would be highlighted.
    Thanks/Karthik
    Edited by: Karthik on Jul 24, 2009 8:48 AM

  • Batch program run

    Hi Gurus,
    Can anybody please provide details on batch program run? How do we set these program? Is there any dcoumentation which I can use?
    thnaks,
    Khan

    Hi
    You can execute any program through background.
    Initially you need to create a variant using SE38
    In se38, give the program name and execute,
    In the screen, enter your required parameters and save them as variant
    with a name and description.
    Some parameters, you may require as dynamic, eg. range of dates,
    for which, select the "Selection variable - check box" against the parameter.
    and press Selection variable button on left hand top.
    here select the date form, it will chagne to green.
    Then, you may give the date range from the pull down menu. and Save the variant.
    Then enter SM36,
    Give the batch job name.
    Press on steps button,
    Give Program and select variant.
    Give user , Spool recepient and print specifications etc., to your requirement.
    and for second program, pick the earlier program line item and again pick STEPs icon.You may proceed with the same step and save.
    The batch job will be scheduled now.
    Then enter SM37 - here you can monitor the batch jobs.
    Here, you may give program name and execute,
    In next screen, select the batch job and press"start conditions"
    Give, batch job run date, and time and its frequency.
    In case of repeat batch job, please select periodic values and save.
    and save the batch job.
    Now, batch job is released and will run in the time and date specified.
    Hope this helps you
    Regards
    Sasi

Maybe you are looking for

  • Can I change the day/date format from US (month day year) to UK (date month year)?

    When I view databases through Firefox, the date/day format is set at month, day, year (US style), whereas I need day, month, year, I work in the UK and the "wrong" format is VERY confusing and could lead to errors/mistakes. IE has that format but I d

  • Chart of Accounts Upload

    Hi , I am working on upload of Chart of Accounts. Here I have to upload the Group Chart of Accounts and then the Operational Chart of Accounts( company code level ). Can you please suggest a detailed right approach to do it  ? I am currently  using t

  • HT2534 The none button found with the credit card information is missing.

    it's just not there. And it's mentioned completely in a help article. Did they remove it?

  • Mac mini mid 2010 fan/thermal sensor connector issue

    Hi, so, the fan wont' power down in my mini (always on max when power on, smc reset no help, cpu not running hot); i opened the case and noticed that the connector for the heat sensor for the optical drive seems to be missing (cf. picture, if I have

  • Cisco Training

    I am looking for any training on Developing solutions for Cisco IP Phones. I have done a small bit of work in this area but would like to find an offical training course. Does anyone know of any CISCO courses? or even the names of the courses. Locati