Function modules invoked in wrong sequence  bapi_po_create

trying to use bapi_po_create in se37
enter purch org     vendor   doc type    purch group 
when test get the following
function modules invoked in wrong sequence
what does that mean?
how an i create

Not sure, but  I do think you need more information than that.  Here is an example program calling the BAPI.
report zrich_0001.
constants : c_x value 'X'.
data: del_date type sy-datum.
data: pohead  type bapimepoheader.
data: poheadx type bapimepoheaderx.
data: exp_head type bapimepoheader.
data: return  type table of bapiret2 with header line.
data: poitem  type table of bapimepoitem with header line.
data: poitemx type table of bapimepoitemx with header line.
data: posched  type table of bapimeposchedule with header line.
data: poschedx type table of bapimeposchedulx with header line.
data: ex_po_number type bapimepoheader-po_number.
parameters: p_matnr type ekpo-matnr.
parameters: p_werks type ekpo-werks.
parameters: p_lgort type ekpo-lgort.
parameters: p_menge type ekpo-menge.
parameters: p_lifnr type ekko-lifnr.
parameters: p_ekorg type ekko-ekorg.
parameters: p_ekgrp type ekko-ekgrp.
parameters: p_bukrs type ekko-bukrs.
* Header Level Data
pohead-comp_code = p_bukrs.
pohead-doc_type   = 'NB'     .
pohead-creat_date = sy-datum   .
pohead-vendor = p_lifnr.
pohead-purch_org = p_ekorg.
pohead-pur_group = p_ekgrp.
pohead-langu      = sy-langu   .
pohead-doc_date   = sy-datum.
poheadx-comp_code  = c_x.
poheadx-doc_type   = c_x.
poheadx-creat_date = c_x.
poheadx-vendor     = c_x.
poheadx-langu      = c_x.
poheadx-purch_org  = c_x.
poheadx-pur_group  = c_x.
poheadx-doc_date   = c_x.
* Item Level Data
poitem-po_item  = 1.
poitem-material = p_matnr.
poitem-plant    = p_werks.
poitem-stge_loc = p_lgort.
poitem-quantity = p_menge.
append poitem.
poitemx-po_item    = 1.
poitemx-po_itemx   = c_x.
poitemx-material   = c_x.
poitemx-plant      = c_x .
poitemx-stge_loc   = c_x .
poitemx-quantity   = c_x .
poitemx-tax_code   = c_x .
poitemx-item_cat   = c_x .
poitemx-acctasscat = c_x .
append poitemx.
* Schedule Line Level Data
posched-po_item        = 1.
posched-sched_line     = 1.
posched-del_datcat_ext = 'D'.
del_date = sy-datum + 1.
write del_date to posched-delivery_date.
posched-deliv_time     = '000001'.
posched-quantity       = p_menge.
append posched.
poschedx-po_item        = 1.
poschedx-sched_line     = 1.
poschedx-po_itemx       = c_x.
poschedx-sched_linex    = c_x.
poschedx-del_datcat_ext = c_x.
poschedx-delivery_date  = c_x.
poschedx-quantity       = c_x.
append poschedx.
call function 'BAPI_PO_CREATE1'
     exporting
          poheader         = pohead
          poheaderx        = poheadx
          testrun          = ' '
     importing
          exppurchaseorder = ex_po_number
          expheader        = exp_head
     tables
          return           = return
          poitem           = poitem
          poitemx          = poitemx
          poschedule       = posched
          poschedulex      = poschedx.
call function 'BAPI_TRANSACTION_COMMIT'
     exporting
          wait = 'X'.
if not ex_po_number is initial.
  call function 'DEQUEUE_ALL'.
else.
  call function 'DEQUEUE_ALL'.
*  message i036.
endif.
Regards,
RIch Heilman

Similar Messages

  • Function module to get the sequence numbers based on PERNR & payroll period

    Hi,
        Right now i am using the function module 'CU_READ_RGDIR' to get the sequence number based on the PERNR. Once i get the data i am filtering based on payroll periods (begin date and end date). Is there any function module to get the sequence number directly based on PERNR and payroll period dates? if so could you let me know.
    Thanks
    Satya

    I think thats the only way
    CALL FUNCTION 'CU_READ_RGDIR'
        EXPORTING
          persnr          = p0001-pernr
        TABLES
          in_rgdir        = it_rgdir
        EXCEPTIONS
          no_record_found = 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.
    check whether "Pay date for payroll result" with in Start Date and
                  End date, and "Reason for Off-Cycle Payroll" is initial
      LOOP AT it_rgdir WHERE paydt >= v_begda
                             AND paydt <= v_endda AND
                             void IS INITIAL
                             AND ocrsn IS INITIAL
                             AND srtza = 'A'.
        v_seqnr = it_rgdir-seqnr.
    ENDLOOP.
    Hope this helps.
    Thanks
    Kiran

  • Help required in creating function module which reads payroll clusters.

    Hi ,
    We have a requirement where in we need to create a function module for reading a sequence of tables from payroll clusters. This function module does two functions:
    1.Read the payroll results from one system.
    2.write the payroll results to other system.
    please do the needful as soon as possible.
    Thanks in advance.
    Regards,
    Durga.

    hi
    Refer to the below thread
    Programming with Clusters for HR-Payroll
    Regards
    Sameer

  • RFC Error While Invoking A Remote Function Module.

    I am invoking A remote function module while invoking it get  an exception when i see the error logs
    com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException:      Screen output without connection to user.                           , error key: RFC_ERROR_SYSTEM_FAILURE at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClassExecutable.execute(DynamicRFCModelClassExecutable.java:101) at... [see details]
    can anyone pls tell me what the error is..
    regards
    Nilesh Taunk.

    Hi Nilesh Taunk,
    You can go through the following steps
    -o JCO Exceptions 1. http://help.sap.com/saphelp_nw04s/helpdata/en/f6/daea401675752ae10000000a155106/frameset.htm
    -o JCO Exceptions 2. http://help.sap.com/saphelp_nw04/helpdata/en/f6/e002416225f023e10000000a155106/frameset.htm
    -o Restart of the J2EE instance and try re-importing the RFC model. Sometimes it helps.
    -o Logon into WebDynpro Content Administrator as a J2EE Admin and check if the JCO Connections and User /pwd of your application is correct. You can <b>ping </b>or <b>test your JCO connections</b>. if something is wrong, enter the values again for JCO n retest them.
    -o Try undeploying or removing the complete application and redeploy it.
    Tu undeploy please go to
    Go to <b>Visual Admin -> Server -> Services -> Deploy ->
    </b>
    Under Runtime Tab
    select the server, open the tree , you would find the webdypro list there.
    Now select an application, first stop it, remove it and redeploy if necessary.
    Let us know if you could solve the problem or not, gud luck!
    Rgds,
    Sreenivas.

  • Problem with Remotely Invoked Function Module

    Hi All,
    I have a requirement to develop a Remote Enabled Function Module in SAP R/3 which will be invoked from an XI environment via an XML message.
    The purpose of this FM is to validate the incoming data(which comes as a pair of values) by comparing it with values in a corresponding SAP Table.
    If the incoming data is consistent with the values in the SAP Table, i need to return the data in the same format as it is passed. If any inconsistent record is encountered, then i just need to delete that particular record and return the rest of them.
    I used a TABLE for the Input/Output in the FM and tried it. Though it works fine stand-alone, when invoked from the XI environment, the calling system is able to receive only the name of the Table Structure that is used in the FM for I/O.
    I am unable to comprehend the format the input comes into SAP when the FM is invoked. So I'm not able to exactly pin-point the place where the problem arises.
    Please suggest a solution.
    Any pointers in this regard will be helpful.
    Thanks in Advance.

    Hi,
    You can view the incoming message in the local XI Message Monitor SXMB_MONI. There you will see if the input table parameter is correctly filled. In the same transaction, you can also see the reply that is sent to XI. If that is OK, you know that your function works correctly. When you are sure of that, and the calling system does not get the same parameters returned as you could see, that means the mapping in XI is wrong.
    good luck,
    Peter Glas

  • Invoking  Remote Function Module.

    Hi
    I am invoking a remote function module from a web dynpro application(External Appln ).
    The FM contains the following code snippet
    first it inserts the parameters passed into a table
    and then the code is
    SUBMIT <report name > with parameter passing.
    when i comment out the Submit statement and invoke the function module the parameters get populated in the table..but when i enable the SUBMIT statement the same set of parameters dont even get populated in the table. and i get the following exception in the logs of SAP J2ee appln server .
    WDDynamicRFCExecuteException:      Screen output without connection to user.                           , error key: RFC_ERROR_SYSTEM_FAILURE
    i am not able to find a solution to this problem .
    Please help.
    regards
    Nilesh Taunk.

    HI
    GOOD
    GO THROUGH THIS LINKS,THEY MIGHT HELP YOU TO GIVE YOU SOME MORE IDEA.
    Re: RFC Error While Invoking A Remote Function Module.
    RFC Error While Invoking A Remote Function Module.
    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5303c390-0201-0010-e0b2-bfae018377f0
    THANKS
    MRUTYUN

  • Invoking a Remote function module for every 5days

    Hi Experts,
    How to invoke a remote function module in R/3 from XI for every 5days?
    After invoking tht i need to post data to a FTP server! Could any one tell me how to achive this
    Thnx
    RAMS

    Hi Ram,
                 If your scenario is R3 -- > XI -- > FILE .
    My suggestion is to go for ABAP Client proxies. It is fast and we can move huge data .
                 1. Generate abap proxy from Outbound interface from R3system .
                  2. Write ABAP  report , call  RFC , fill TABLE structure of abap and send to XI ( IS) . then according to the Receiver determination . It will create flate file .
                3. Schedule report  once in 5 days .
                     Please refer how to work with abap client proxy   and steps to activae  
    How do you activate ABAP Proxies?
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
    ABAP Proxy Runtime
    http://help.sap.com/saphelp_nw04/helpdata/en/02/265c3cf311070ae10000000a114084/frameset.htm
    ABAP CLIENT PROXY
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1387proxies [original link is broken] [original link is broken] [original link is broken] .
    Assign points if u found helpful
    Regards.,
    V.Rangarajan
    Message was edited by:
            ranga rajan

  • Formal error: Invalid calling sequence for function modules

    Hi All,
    I have developed a function module for FQEVENT 620 Payment: Transfer Line Items for Clearing.
    The clearing works fine.
    After clearing the open items i need to post an FI-CA Document(BAPI : BAPI_CTRACDOCUMENT_CREATE) for each open item(cleared item)
    I have used the bapi : BAPI_CTRACDOCUMENT_CREATE in the same function module that i have developed for FQEVENT 620 Payment: Transfer Line Items for Clearing.Here i am getting an error "Formal error: Invalid calling sequence for function modules".
    So please let me know where i can use this bapi to post fi-ca document.Is there a BAdi or Enhancement Spot where i can use this BAPI or tell me what should i do to overcome this error.
    Regards
    Venkat

    Venkat:
    While I am confused about your business process - creating an open item when clearing one seems strange.  Look into event 0020 which is called after documents are posted - it may present the opportunity to post process additional documents.
    regards,
    bill.

  • How to control sequence of Function Modules processed in update task?

    Hello,
    I've some questions regarding following process that needs to be extended: a Function Module (FM) 'Save' calls several other FM e.g. 'X1' and 'X2' in update task. Those update modules are independent from each other and write data to the database that finalize the save process.
    Now a third FM 'X3' needs to be called in update task. This one is also independent from 'X1' and 'X2' but it calls a further FM 'X4' in background task as separate unit which starts a job. This job  requires the data from FM 'X1' and 'X2' already persistent on the database. By the way: the FM 'X3' triggers the Access Control Engine (ACE) notification that calculates the authorization data in the mentioned job. Therefore this process needs to be the last FM call in update task in the queue of calls in FM 'Save'.
    Questions:
    (1) Is it possible to control the process sequence of the FM 'in update task' simply by the sequence they are called in FM 'Save'.
    (2) Presumed that all FM beside 'X3' have processing type "Update with immediate start" or "Immediate start, no restart" (in short  V1) would it be another solution to specify FM 'X3' with type 'Delayed' to control the process sequence? When a delayed FM will be processed?
    (3) Is it uncritical to call in FM 'X3' (already running in update task) the FM 'X4' with addition in background task as separate unit  that furthermore starts a job by an event? I'm afraid that this nesting could lead to unexpected errors.
    Thank you in advance for your help!
    Best regards,
    Oliver

    ya it will this be in  the same sequence only...........
    Regards
    Anbu

  • What are the sequence of function modules executed in payroll result

    Dear all,
    what are the sequence of function modules executed  while retrivieng pryroll result.or
    functionmodule sequence in payroll programming.
    By
    bose

    Hi Bose,
    The sequence of FM executed in payroll result are
    1. cu_read_rgdir ---> from this u will get the country key.
    2. cd_read_last -
    > from this fm u will identify the seqnr for the latest record and finally for the payroll result
    3. pyxx_read_payroll_result.

  • Problem with Remote Invoked Function Module

    Hi All,
    I have a requirement to develop a Remote Enabled Function Module in SAP R/3 which will be invoked from an XI environment via an XML message.
    The purpose of this FM is to validate the incoming data(which comes as a pair of values) by comparing it with values in a corresponding SAP Table.
    If the incoming data is consistent with the values in the SAP Table, i need to return the data in the same format as it is passed. If any inconsistent record is encountered, then i just need to delete that particular record and return the rest of them.
    I used a TABLE for the Input/Output in the FM and tried it. Though it works fine stand-alone, when invoked from the XI environment, the calling system is able to receive only the name of the Table Structure that is used in the FM for I/O.
    I am unable to comprehend the format the input comes into SAP when the FM is invoked. So I'm not able to exactly pin-point the place where the problem arises.
    Please suggest a solution.
    Any pointers in this regard will be helpful.
    Thanks in Advance.

    Hi Keerthivasan,
    My requirement also same,
    please send me the source code.Please help me urgent.
    Thanks.

  • Test sequence for function module

    i want to perform a test sequence in which, what is the out put of the first funtion module i want to pass them to the second function module .
    i want to know that whether i can do that or not if yes how?.
    thanks in advance.

    Hi u can do that by doing like this.
    Call 'function1'
    exporting
    var1 = var1
    improting
    var2 = var2
    if var2 is not initial.
    Call 'function2'
    exporting
    var3 = var2
    importing
    var4 = var4
    endif.
    Mark points if helpful.
    Regs
    Manas Ranjan Panda
    Message was edited by: MANAS PANDA

  • How to invoke RFC function module from XI interface

    Hi all,
    I am having one question, How to invoke RFC function module from XI interface.
    Please reply me as soon as possible.
    Thanks in advance,
    Radhika

    Hi,
    To call the RFC in mapping u need to create the RFC lookups...check these links.
    How we have to create the lookups?
    Check this weblogs with some screenshots on how to achieve this:
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    lookups in xi
    XI Design Guidelines
    Re: RFC Lookup API
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    Regards,
    Phani

  • Function Module to open a new session displaying a method of a class

    Hello All,
    I have a method A of class B.
    Now, in my current session, I have a button. When the user clicks on this button, what I expect is that a new session be opened and in the new session method A of class B be displayed.
    This is similar to the debugger, wherein, in the debugging mode, we can bring up the context menu in the Source Code (Edit Control) tool, and then select "Go To Source Code".
    So basically, I am looking for a Function Module which does the same.
    I came across Function Module CC_CALL_TRANSACTION_NEW_TASK, however, this will only create a new session.
    I could specify the transaction as SE24, but it then opens a new session with this transaction. That is it.
    My objective is to display the method of a class in a new session.
    Is there any Function Module in this case?
    Regards,
    Mithun
    Edited by: Mithun Kamath on Aug 9, 2011 5:35 PM

    Hello Sandra,
    Thank you very much. That was exactly what I was looking for.
    However, instead of calling EDITOR_PROGRAM directly, what I instea did was the following:
    1) Created a RFC enabled Function module.
    2) Inside this function module, I wrote the following code:
      SUBMIT tpda_editor_start AND RETURN
       WITH prgm  = is_alert_det-program_name
       WITH incl = is_alert_det-include_name
       WITH dynp = space
       WITH line = is_alert_det-line_no.
    The parameters above were similar to the one proposed by you.
    Borrowed the above from the class CL_TPDA_SERVICES_TOOLS, method NAVIGATE_TO_SOURCE.
    The above is basically called in the debugger, when we use the context menu in the editor tool and invoke the "Goto Source Code" functionality. This eventually calls the EDITOR_PROGRAM FM.
    The reason why I did this is because when I was testing the FM, it did not allow me to specify the include as CL_TEST=====CM01. I do not know why, probably I was doing it wrong. But it gave me a message saying that the object does not exist in table TADIR.
    Anyway, I did the above steps and it worked exactly as I wanted it to.
    I would like to thank you again.
    Best Regards,
    Mithun
    P.S. Forgot to add, I called the above RFC enabled FM as a new task.
    Edited by: Mithun Kamath on Aug 10, 2011 4:19 PM

  • Function Module in FQEVENTS

    Hi all,
         We have a ZFM created for the event 0395 (DUNNING REVERSAL) and has been assigned a sequence number. But that Function Module is not getting invoked when we run the transaction FPVC to cancel the Dunning that was created.
         Is there any other setting needs to be done for that FM to be called at the right place?
    Thanks and Regards,
    Ram.

    Hi,
    Are you calling this FM in an exit?
    If so, check the exit is activ in the enhancement. You can do this by transaction CMOD.
    Regards,
    Bharadwaj

Maybe you are looking for

  • Sending material outside for repair

    All SAP Gurus, We want to send some material outside our company premises for maintenance work. For this I have made a service PO. Now, how to send this material out (which mvt. Type to be used)? And after wards how to take it back Regards,

  • Two questions, maybe stupid ones

    Hi Two iPhoto questions if that is OK. The first one may be irrelevant depending on the answer to the second. By way of background,I organised my digital photos on previous computers into a directory by year, this has been on PCs until now. Then I na

  • Help regarding BI Certification

    Hello, I have done my certification in SAP-ABAP by following the 5 SAP ABAP TAB's and was able to clear my certification. Now i want to do certification in SAP BI 7.0 and wanted to know will it be a sufficient to follow the BI TAB's this time also. I

  • Playing rental movies with front row

    Is there any way that they can upgrade front row so that i can watch rented movies through it? I'm a very lazy person and i want to watch my rented movies from my bed without moving. I can use the remote to watch most things but it won't let me play

  • FINALLY Lightroom delivers on nearly all fronts

    Since Lightroom 1, I've been frustrated by its great workflow and toolset combined with dismal-quality RAW conversions. I chose Apple's Aperture over the original Lightroom, even though its toolset for severely more limited simply because the quality