How to call a transaction from ABAP code

Hi everybody,
How do I run a transaction from my ABAP code?
For example, through my ABAP code, I want to call the ME24 transaction (Maintain Purchase Order).
Thanks for the help,
Roy

CALL TRANSACTION
Syntax
CALL TRANSACTION ta { [AND SKIP FIRST SCREEN]
                    | [USING bdc_tab [bdc_options]] }.
Extras:
1. ... AND SKIP FIRST SCREEN
2. ... USING bdc_tab [bdc_options]
Effect
The statement CALL TRANSACTION calls the transaction whose transaction code is contained in data object ta. The data object ta must be of character type and must contain the transaction code in uppercase letters. If the transaction specified in ta cannot be found, an untreatable exception is triggered. The additions suppress the display of the initial screen and allow you to execute the transaction using a batch input session.
At CALL TRANSACTION the calling program and its data is kept, and after exiting the called transaction, processing is resumed in the calling program after the call.
When the transaction is called, the ABAP program linked with the transaction code is loaded in a new internal session. The session of the calling program is kept. The called program runs in an SAP LUW of its own.
If the called transaction is a dialog transaction, after loading the ABAP program the event LOAD-OF-PROGRAM is triggered and the dynpro defined as initial dynpro of the transaction is called. The initial dynpro is the first dynpro of a dynpro sequence. The transaction is finished when the dynpro sequence is ended by encountering the next dynpro with dynpro number 0 or when the program is exited with the LEAVE PROGRAM statement.
If the called transaction is an OO transaction (as of release 6.10), when loading all programs except class pools the event LOAD-OF-PROGRAM is triggered and then the method linked with the transaction code is called. If the method is an instance method, implicitly an object of the corresponding class is generated and referenced by the runtime environment. The transaction is finished when the method is finished or when the program is exited using the LEAVE PROGRAM statement.
After the end of the transaction call, program execution of the calling program resumes after the CALL TRANSACTION statement.
Note
At the statement CALL TRANSACTION, the authorization of the current user to execute the called transaction is not checked automatically. If the calling program does not execute a check, the called program must check the authorization. To do this, the called program must call function module AUTHORITY_CHECK_TCODE.
Addition 1
... AND SKIP FIRST SCREEN
Effect
This addition suppresses the display of a screen of the initial dynpro of a called dialog transaction. The addition AND SKIP FIRST SCREEN suppresses the first screen under these prerequisites:
For the initial dynpro, in the Screen Painter the own dynpro number must not be specified as the next screen number.
All mandatory input fields of the initial dynpro must be filled completely and with the correct values by the SPA/GPA parameters
If these prerequisites are met, that screen of the dynpro is displayed that is specified in the Screen Painter as the next dynpro of the initial dynpro.
Example
If the static next dynpro of the initial dynpro of the called dialog transaction FLIGHT_TA is not the initial dynpro itself, its screen is suppressed, because its input fields are filled using the SPA/GPA parameters CAR and CON.
DATA: carrid TYPE spfli-carrid,
      connid TYPE spfli-connid.
SET PARAMETER ID: 'CAR' FIELD carrid,
                  'CON' FIELD connid.
CALL TRANSACTION 'FLIGHT_TA' AND SKIP FIRST SCREEN.
Addition 2
... USING bdc_tab [bdc_options]
Effect
Use this addition to pass an internal table bdc_tab of row type BDCDATA from the ABAP Dictionary to a dialog transaction. The additions bdc_options control the batch input processing. When a transaction with addition USING is called, the system field sy-binpt is set to value "X" in the called program - while this transaction is running, no other transaction can be called with this addition.
The internal table bdc_tab is the program-internal representation of a batch input session and must be filled accordingly. The structure BDCDATA has the components shown in the table below.
Component Description
PROGRAM Name of the program of the called transaction
DYNPRO Number of the dynpro to be processed
DYNBEGIN Flag for the beginning of a new dynpro (possible values are "X" and " ")
FNAM Name of a dynpro field to be filled or batch input control statement, for example, to position the cursor
FVAL Value to be passed to the dynpro field or to the control statement
Using the internal table bdc_tab, you can provide any number of screens of the called transaction with input and user actions.
System Fields
sy-subrc Description
0 The batch input processing of the called transaction was successful.
< 1000 Error in the called transaction. If within the transaction a message was sent, you can receive it using the addition MESSAGES.
1001 Error in batch input processing.
Note
Outside of ABAP Objects you can specify the additions AND SKIP FIRST SCREEN and USING together. However, this does not make sense, because the addition AND SKIP FIRST SCREEN is desigend only to fill the mandatory input fields using SPA/GPA parameters, while the batch input table specified with USING controls the entire transaction flow including the display of the screens.
Example
Call of the Class Builder (transaction SE24) and display of class CL_SPFLI_PERSISTENT. The internal table bdcdata_tab contains the input for the batch input processing of the first dynpro (1000) of the transaction. Using structure opt, the batch input processing is set to suppress the first screen and to display the next screen in the standard size.
DATA class_name(30) TYPE c VALUE 'CL_SPFLI_PERSISTENT'.
DATA: bdcdata_wa  TYPE bdcdata,
      bdcdata_tab TYPE TABLE OF bdcdata.
DATA opt TYPE ctu_params.
CLEAR bdcdata_wa.
bdcdata_wa-program  = 'SAPLSEOD'.
bdcdata_wa-dynpro   = '1000'.
bdcdata_wa-dynbegin = 'X'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_CURSOR'.
bdcdata_wa-fval = 'SEOCLASS-CLSNAME'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'SEOCLASS-CLSNAME'.
bdcdata_wa-fval = class_name.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_OKCODE'.
bdcdata_wa-fval = '=CIDI'.
APPEND bdcdata_wa TO bdcdata_tab.
opt-dismode = 'E'.
opt-defsize = 'X'.
CALL TRANSACTION 'SE24' USING bdcdata_tab OPTIONS FROM opt.

Similar Messages

  • How to call  java program from ABAP

    Hi Experts,
         My requirement is to call java programs from ABAP. For that i have set up SAP JCO connection by using this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/739. [original link is broken] [original link is broken] [original link is broken] Connection gets sucessfully. After this how to call java program from ABAP as per our requirement. Please help me out.
      Also i tried this way also.. but while executing the DOS Command line appear & disappear in few seconds. So couldnt see the JAVA output. Please help me out to call java programs in ABAP..
    DATA:command TYPE string VALUE 'D:Javajdk1.6.0_20 injavac',
    parameter TYPE string VALUE 'D:java MyFirstProgram'.
    CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
    application = command
    parameter = parameter
    OPERATION = 'OPEN'
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    bad_parameter = 3
    file_not_found = 4
    path_not_found = 5
    file_extension_unknown = 6
    error_execute_failed = 7
    OTHERS = 8.
    Thanks.

    This depends on the version of your Netweaver Java AS. If you are running 7.0, you will have to use the Jco framework. The Jco framework is deprecated since 7.1 though. If you want to build a RFC server in 7.1 or higher, it is adviced that you set it up through JRA.
    Implement an RFC server in 7.0:
    http://help.sap.com/saphelp_nw04/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
    Implement an RFC server in 7.1 or higher:
    http://help.sap.com/saphelp_nwce72/helpdata/en/43/fd063b1f497063e10000000a1553f6/frameset.htm

  • Calling Java Services from ABAP code

    Hi,
    How to call Java services (not web service) from ABAP code?
    I have a requirement where JAVA team has developed some services that can be called from URL or from a Java application.
    Ex:  when this URL is executed,
    http://localhost:8080/artemis7_802/triton/mycompany.remoteFunctions.RequirementsList.a7x?requestid=3023&requestname=I6PRAO1&skill=SAP&skill=JAVA
    It returns a XML file on browser.
    And I have no idea about the 2nd way i.e. from Java application!
    Now, how can ABAP call these java methods?
    I heard that something can be done via maintaining RFC destinations in SM59 to call Java services? Can this be done with my requirement?
    Please help.
    Thanks and regards,
    Amey

    Posted it in WD ABAP forum.

  • EEDM11 transaction from ABAP code

    Hi Experts,
    I need to call a transaction EEDM11 (Display point of delivery) from the code in such a way, that it will show me the info about specified point of delivery. The POD ID is known.
    So the question is - how do I specify the POD number to this transaction (so that the user doesn't have to specify it by himself)?

    It works fine, but I have further issue:
    I use this BOR method/FM in double click event in ALV. When I click on the row of the ALV, the POD details are shown.
    If POD is fine, then it works, but when there is a problem with POD (for example two supply services) the system shows message on status bar "More than one service with the service type <service type> in point of delivery <pod>" and then, after any action, it goes to the SAP Easy Access. My program is to correct those type of services, so I cannot assume that POD is fine.
    This is probably due to the message type in the screen processing, but I want the program to remain on my screen (with ALV),
    Any ideas, how to avoid going back to SAP Easy Access?
    Edited by: piotrzym on Apr 20, 2011 2:17 PM
    Edited by: piotrzym on Apr 20, 2011 2:25 PM

  • How to call Java script from java code?Can Jscript be executed at server?

    Hi All,
    We are using 'WebTrends' tool to analyze our site usage pattern.
    To use WebTrends, we need to :
    1) call Java Script code from the java code
    2)Java script has to be executed at server.
    Please comment on two points mentioned above. If yes, please let me know how to do them?
    Thanks in advnce,
    Regards,
    Ganga

    You can check out Rhino project.
    [http://www.mozilla.org/rhino/]

  • How to call UME API from ABAP?

    Hello all,
    I want to call the UME API using ABAP to change portal users from backend system.
    Is this possible without JAVA development? How?
    Thanks for your help,
    Regards,
    Guido Knapp

    Hi,
    Refer this link you wil get some idea
    http://help.sap.com/saphelp_nw04/helpdata/en/e0/3820a37edeec45a91dd6e45fba15b8/frameset.htm
    Regards,
    Senthil K.

  • How to call an URL from ABAP

    Hi,
    When an user clicks on a document display link in a SAP tranasction(for example FB02),an URL has to be called in the background(by ABAP) and the details of the URL should be displayed in a browser.
    What are the possilbe options available in SAP4.7 to meet the above requirement?
    Thanks in advance,
    Leo

    hi,
    you can use call browser function
    data url(200) type c.
    url = 'your_url'.
    CALL FUNCTION 'CALL_BROWSER'
      EXPORTING
        URL                          = url
       WINDOW_NAME                  = ' '
       NEW_WINDOW                   = ' '
       BROWSER_TYPE                 =
       CONTEXTSTRING                =
    EXCEPTIONS
       FRONTEND_NOT_SUPPORTED       = 1
       FRONTEND_ERROR               = 2
       PROG_NOT_FOUND               = 3
       NO_BATCH                     = 4
       UNSPECIFIED_ERROR            = 5
       OTHERS                       = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    for this you have to enable SSO on your server.
    hope this helps you, else revert back.
    regards,
    Hemendra

  • How to call CJ2ON transaction

    Hi All,
    How to call CJ20N transaction from custom transaction/custom program.
    generally some transaction having OPEN functionality for open other project,how to handle these type of transaction.
    Help me.
    Thanks,
    Srinivas Manai

    Hi,
    <b>You can neither do CALL TRANSACTION nor use BDC session method for transaction CJ20N</b>. This is a enjoy transaction and it works on Object oriented technology. These kind of transactions ( ME21N, ME22N, KE23N, ME51N etc..) does not support CALL TRANSACTION.
    Use transaction <b>CJ20</b> instead.
    Let me know your exact requirement, there may be an alternative to CALL TRANSACTION or BDC.
    Regards,
    RS

  • Call sap transaction from java

    can anyone tell me how to call SAP transaction from JCO,
    cheers
    Ajay

    Hi Ajay,
    You should find or create functional module which covers your requrements.
    Best regards, Maksim Rashchynski.

  • Is it possible to call web service from ABAP SAP 4.6 c..If yes how

    Hi Friends,
    Is it possible to call web service from ABAP-SAP 4.6 c..If yes Could you please let me know how.
    Thanks in Advance.
    Murali Krishna K
    Edited by: Murali Krishna Kakarla on Jan 26, 2008 7:09 PM
    Edited by: Murali Krishna Kakarla on Jan 26, 2008 7:11 PM

    Olivier CHRETIEN wrote:>
    > Hi Terry,
    >
    > So these function modules must use the SAPHTTPA RFC destination which uses the exe saphttp.exe ?
    >
    > How much abap code lines do you have for a web service call ?
    > Do you have to code the call specifically for each different web service ?
    > Are you able to use the WSDL ?
    >
    > Nice job if you have coded your own private SOAP runtime !
    >
    > But I don't think this is an easy solution for everybody...
    >
    > Regards,
    >
    > Olivier
    Yes, SAPHTTPA (runs on application server) and/or SAPHTTP (runs on front-end pc), one of which, is required for HTTP communication.  So far, nothing too elaborate as far as SOAP goes, but the logic is simplistic.  Here's some sample code:
      DEST = 'SAPHTTPA'.
      TRANSLATE HOST TO LOWER CASE.
      MYURL = 'wssrvTest/Service.asmx/GetByOrderItem'.
      CONCATENATE HOST MYURL INTO MYURL.
      REQUEST_HEADERS-DATA = 
                  'Content-type: application/x-www-form-urlencoded'.
      APPEND REQUEST_HEADERS.
      CLEAR REQUEST_HEADERS.
    *........Convert Order Number to External Format........................
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
           EXPORTING
                INPUT  = ORDER
           IMPORTING
                OUTPUT = ORDER.
    *........Convert Item Number to External Format.........................
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
           EXPORTING
                INPUT  = ITEM
           IMPORTING
                OUTPUT = ITEM.
    *........Convert Material Number to External Format.....................
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
           EXPORTING
                INPUT  = MATERIAL
           IMPORTING
                OUTPUT = MATERIAL.
      CONCATENATE 'sOrder=' ORDER
                   INTO REQUEST_BODY-DATA.
      APPEND REQUEST_BODY.
      CLEAR REQUEST_BODY.
      CONCATENATE '&sItem=' ITEM
                   INTO REQUEST_BODY-DATA.
      APPEND REQUEST_BODY.
      CLEAR REQUEST_BODY.
      CONCATENATE '&sMaterial=' MATERIAL
                  INTO REQUEST_BODY-DATA.
      APPEND REQUEST_BODY.
      CLEAR REQUEST_BODY.
      CALL FUNCTION 'HTTP_POST'
           EXPORTING
                ABSOLUTE_URI          = MYURL
                RFC_DESTINATION       = DEST
                BLANKSTOCRLF          = 'X'
           TABLES
                RESPONSE_ENTITY_BODY  = RESPONSE_BODY
                REQUEST_ENTITY_BODY   = REQUEST_BODY
                RESPONSE_HEADERS      = RESPONSE_HEADERS
                REQUEST_HEADERS       = REQUEST_HEADERS
           EXCEPTIONS
                CONNECT_FAILED        = 1
                TIMEOUT               = 2
                INTERNAL_ERROR        = 3
                TCPIP_ERROR           = 4
                DATA_ERROR            = 5
                SYSTEM_FAILURE        = 6
                COMMUNICATION_FAILURE = 7
                OTHERS                = 8.
      CHECK SY-SUBRC = 0.  "more appropriate msg goes here
      LOOP AT RESPONSE_BODY.
        IF RESPONSE_BODY+0(7) <> '<string' AND
           RESPONSE_BODY+0(8) <> '</string' AND
           RESPONSE_BODY+0(5) <> '<?xml'.
          SPLIT RESPONSE_BODY-DATA AT '=' INTO FIELD_NAME FIELD_VALUE.
          TRANSLATE FIELD_NAME TO UPPER CASE.
          CASE FIELD_NAME.
            WHEN 'HEIGHT'.
              HEIGHT = FIELD_VALUE.
            WHEN 'WIDTH'.
              WIDTH = FIELD_VALUE.
            WHEN 'LENGTH'.
              LENGTH = FIELD_VALUE.
            WHEN 'WEIGHT'.
              WEIGHT = FIELD_VALUE.
            WHEN 'QTY'.
              QTY = FIELD_VALUE.
          ENDCASE.
        ENDIF.
      ENDLOOP.
    Hope this helps...
    Terry
    Edited by: Terry West on Feb 4, 2008 3:08 PM

  • Call of BW queries from ABAP code

    Has anybody information about how is it possible to call a BW query from ABAP code with parametrization (specifying characteristics) ? In our development project it's a crucial part, beacuse we have to provide interim function modules to carry out some conversion routine on BW provided data, before we put it on the screen embedded in a Visual composer Iview.

    Have a look at this:
    Calling BW queries programatically (also posted on BW forum)
    Hope it helps.
    Regards

  • How to call a transaction (in a new session) from a program

    Hi ,
    I need to call a transaction from my report on the click of a button in toolbar.
    But the transaction should open in a new session.
    This is the code that i have written, MM03 is getting opened in the same session.
    call transaction 'MM03' and skip first screen.
    Hope that my question is clear.
    Thanking you in advance..
    Shankar

    check this
    <b>CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'TEST'
      DESTINATION 'NONE'
      EXPORTING
          TCODE = 'SM59'
      EXCEPTIONS
        COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT
        SYSTEM_FAILURE        = 2 MESSAGE MSG_TEXT.
      IF SY-SUBRC NE 0.
        WRITE: MSG_TEXT.
      ELSE.
        WRITE: 'O.K.'.
      ENDIF.</b>
    <b>u can avoid such errors thru this FM
    check FI_DUPLICATE_INVOICE_SHOW program for sample code.</b>
    regards
    Prabhu
    Message was edited by: Prabhu Peram

  • Is it possible to call std. SAP transaction from abap wd

    Is it possible to call std. SAP transaction from abap wd so that transaction appears and work as in gui? Without portal ofcourse.
    I know that using webgui and/or ITS it is possible so then it must be somehow possible....

    Hi,
    see Web Dynpro ABAP call transaction in the foreground and just carry out a simple search in this forum, then you'll find several threads with similar questions...
    Regards, Heidi

  • How to call the RFC from R/3 to SRM, when we use webdynpro abap? (Urgent)

    Hello
    We use SRM Server 5.5 with classic scenario.
    We want to call RFC in R/3 from webdynpro ABAP.
    How can we do that?
    We are developing the web report using webdynpro abap.
    So we need some of R/3 data such like PR(EBAN)and PO(EKKO,EKPO).
    When user choose the search parameter, report diplay the Shopping cart, PR and PO data on webdynpro.  So we call the R/3 RFC to display the PR, PO data.
    But I tired to call the RFC in R/3, We could not call it.
    How to call the RFC from R/3 to SRM, when we use webdynpro abap?
    Thank you,
    Best Regards,
    SH.

    Hi
    <b>Please look at the following threads as well -></b>
    WebDynpro in SRM
    BAPI's /RFC's in SRM
    BAPI to Change Shopping Cart by RFC
    SRM60 and webdynpro
    Webdynpro Services Exception
    WebDynpro using BAPI has an error
    SRM60 and webdynpro...
    <b>SAP uses META Function modules in SRM to get data from R/3 back-end.</b>
    <u>For getting Purchase requistion data, use the function modules -></u>
    META_REQUISITION_CHANGE        Change purchase requisition              
    META_REQUISITION_CREATE        Create Requisition                       
    META_REQUISITION_DELETE        Delete/close purchase requisition        
    META_REQUISITION_GETDETAIL     Display requisition details              
    META_REQUISITION_GETITEMS      Display requisition items                
    META_REQUISITION_GETRELINFO    Get Releasease Info for requisitions
    <u>For getting Purchase order data, use the function modules -></u>
    META_PO_CREATE                 Create purchase order                    
    META_PO_DELETE                 Delete reservation                       
    META_PO_GETDETAIL              Display purchase order details           
    META_PO_GETITEMS               Display purchase order items             
    META_PO_GETRELINFO             Display purchase order release information
    Hope this will definitely help. Do let me know.
    Regards
    - Atul

  • How to send mail from ABAP code?

    Hi,
    I need to send e-mail from ABAP Code .
    e.g:  If sy-subrc ne 0.
         ( send e-mail to  "[email protected]" )
           endif.
    Please provide me any Function module for this or any code.
    Correct answear will be rewarded my maximum points.
    Thanks & Regards,
    Gaurav.

    Check this code sample
    * Send mail
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      loop at htmllines.
        mailtxt = htmllines.
        append mailtxt.
      endloop.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
      if sy-subrc  0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    Regards.

Maybe you are looking for

  • Crystal Report for Enterprise 4.1 develop error

    I user crystalreportviewer to access rpt file . When I download from crystal report server 2011/2013,if the file is create by crystal report 2011,it work well, else if it is created by crystal report for enterprise ,it will throw a error: [COMExcepti

  • Audit log files user rights

    Hello, I started binary audit some of my servers. It works fine. Generated files has 600 mask and root:root group:user. This makes my backup routines sick. Backup scripts work as another user and permission denied errors arises. How can i change audi

  • Airport Extreme - PS3 - DNS Error

    I've been using the Airport Extreme as my home network router for quite some time but now the PS3 seems to have issues with it. I've run the PS3 in wireless mode for a few weeks without a hassle but then I wanted to use its media capabilities and str

  • Editing String in.TDM file

    With Set Properties it is possible to add one or more strings to a .TDM file (or is it to another file that is linked to the .TDM file?). Similarly it is possible to read that string with Get Properties. My current impossibilities are: - If each meas

  • How to resize Labels size based on the column margin changes in JTable??

    I have a constructed JTable with 4 columns. Accordingly, I added 4 JLabels for each column. JTable and JLabels are attached to a scrollpane. That in turn, attached to a JFrame. What I need is, at the runtime, when I change the column margins of a col