Subroutine called from a Dynamic Action.

Calling a subroutine in a program via a dynamic action, works in foreground, but not in background? Any ideas why?

What's a dynamic action and what are you actually trying to achieve?

Similar Messages

  • Call a Automatic Row Fetch from a Dynamic Action

    Hi,
    can I execute the Automatic Row Fetch from a dynamic action?
    I only found this post (Dynamic Actions to call Automatic Row Processing (DML) but the link where the solution is does not work :(
    Thanks,
    Edited by: Elena.mtc on 09-nov-2012 5:46

    Elena.mtc wrote:
    I forgot to say, for several reasons, I don't want to submit the page. So that's where I find the complexity in calling the ARf.
    Thanks.You cannot fire the ARF because it is designed to run when the page is rendered and it cannot be called as a standalone
    Create a dynamic action as follows to fetch the form detials
    Action: Execute PL/SQL Code
    PL/SQL Code:
    begin
      select ename, job, mgr, hiredate, sal
        into :P4_ENAME, :P4_JOB, :P4_MGR, :P4_HIREDATE, :P4_SAL
        from emp
       where empno = :P4_EMPNO;
    exception
      when others then
        null;
    end;
    Page Items to Submit: P4_EMPNO
    Page Items to Return: P4_ENAME,P4_JOB,P4_MGR,P4_HIREDATE,P4_SAL
    See this working example: http://apex.oracle.com/pls/apex/f?p=32940:4
    Login as test/test
    If you want to make it more dynamic you can query the APEX metadata to find the form items on your current page
    select * from apex_application_page_db_items
    where page_id =:APP_PAGE_ID
    and application_id = :APP_ID;

  • Returning System Messages From A Called Routine In Dynamic Actions

    I am triggering a call to a custom ABAP program from a Dynamic Action.  This program is doing updates and the user was asking me if I could return any system messages back so that the person doing the action would see them.   I've done some looking and can't seem to find an answer so I've come to the experts.  Any help is appreciated.

    Problem solved.

  • Calling a BI Publisher report from a dynamic action

    Greetings,
    I am working with Apex 4.1.0. I have created a BI Publisher query and layout and defined them in the Shared Components for my application. I also created a button defined as 'Download Printable Report Query'. When I press the button, everything works as expected. The page variable is passed to the report and the report prints as it should.
    My question is, can I run this report using a Dynamic Action instead of a button?
    Thanks
    Larry

    Hi,
    All that such a button does is submit the page and branch to page zero passing in the request field something like this:
    PRINT_REPORT=my_report
    So, to do the same in a dynamic action, use an "execute javascript code" action with something like this in it:
    location.href = 'f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=my_report';
    Luis

  • Info group being not called while using Dynamic Actions

    Hi,
    I am facing a scenario that, while we execute some action from PA40 like termination, then it will call my subroutine for dynamic actions which will be calculating the last day worked and updating the same in Info Type 0041.
    For updating the IT 0041, i am using the function module HR_MAINTAIN_MASTERDATA. and IT0041 is getting updated properly. But now the problem is coming that when the control comes out of subroutine, it is going back to the PA40 Screen and not to the next screen of the Info group.
    What can be the cause for the same.
    RND I have done on my part: I have commented/uncommented the return parametre RP50D-Date1, commented/uncomented the use of function modules to lock and Unlock the pernr.
    Please give ur comments.
    Thanks in Advance.

    Hi Nisha,
    Not sure if I have understood correctly, but if you just wanted to calculate leaving date and write the same date in IT0041 then you don't need a function module:
    1. Create a small program, as follows:
    REPORT  ZHR_PY_R0008                           .
    INCLUDE MPPDAT00.
    TYPE-POOLS HRQTA.
    TABLES: P0000,
            RP50D,
            T001P.
    ROUTINE CALLED BY TABLE T588Z
    FORM CHANGE_DATE.
      RP50D-DATE1 = P0000-BEGDA - 1 .
    ENDFORM.                    " CHANGE_DATE
    This program will give you the last working day written to RP50D-DATE1
    2. Simply enter the following lines into table T588Z:
    0000 04 499*- LEAVING ACTION - Populate Infotypes with leave date -*
    0000 04 500 P T001P-MOLGA='08'
    0000 04 501 P PSPAR-TCLAS='A'
    0000 04 502 P PSPAR-MASSN='*'/X   (* equals your leaving action types)
    0000 04 503 P PSPAR-MASSN='*'/X   (* equals your leaving action types)
    0000 04 504 F CHANGE_DATE(ZHR_PY_R0008)
    0000 04 505 ******** INF.0041  ********
    0000 04 506 I COP,0041,,,(P0000-BEGDA),(P0000-ENDDA)/D
    0000 04 507 W P0041-DAR07='*'   (* equals your date type)
    0000 04 508 W P0041-DAT07=RP50D-DATE1
    or if you are simply looking to delimit IT0041 with the leave date then replace lines 506-508 with:
    0000 04 506 I MOD,0041,,,(RP50D-DATE1),(RP50D-DATE1)/D
    0000 04 507W     P0041-ENDDA=RP50D-DATE1
    This will solve your problem : - )

  • Reading a session variable from a dynamic action

    I have a select list on a page and a button next to the select list. The button calls a dynamic action which opens a page and sends the value in the select list. The page is not submitted. The DA has a step with a dummy PL/SQL block that submits the select list item. Then the page is called with the select list in the URL.
    The value is not being sent. If I go into edit mode then run the page again then the correct value is sent.
    When I look at session in Administration the select list is in session and set properly but is not sent unless the page is submitted.
    Why if it is in session is it not being passed correctly? What does submitting the page do other than update session?

    Hi,
    could you share the exception trace ?
    Frank

  • Subroutine call from SAP Script

    Hi,
    I need to calculate required/outstanding qty. hence am passing existing values of reservation#/item# and issued qty.
    both req/out qty are returned blank by the code. please help.
    Following is my code segment for a external routine call from SAP Script.
    /:   PERFORM P_GET_QTY IN PROGRAM ZTEST
    /:   USING &MSEG-RSNUM&                     
    /:   USING &MSEG-RSPOS&                     
    /:   CHANGING &REQ_QTY&                     
    /:   CHANGING &MSEG-MENGE&                  
    /:   CHANGING &OUT_QTY&                     
    /:   ENDPERFORM
    REPORT ztest .
    TABLES resb.
    DATA: wa_resb TYPE resb,
          req_qty TYPE resb-bdmng,
          isd_qty TYPE mseg-menge,
          out_qty TYPE resb-bdmng.
    FORM p_get_qty TABLES input  STRUCTURE itcsy
                          output STRUCTURE itcsy.
      DATA: avlbl TYPE resb-bdmng.
      READ TABLE input WITH KEY 'MSEG-RSNUM'.
      CHECK sy-subrc = 0.
      wa_resb-rsnum = input-value.
      READ TABLE input WITH KEY 'MSEG-RSPOS'.
      CHECK sy-subrc = 0.
      wa_resb-rspos = input-value.
      READ TABLE input WITH KEY 'REQ_QTY'.
      CHECK sy-subrc = 0.
      req_qty = input-value.
      READ TABLE input WITH KEY 'MSEG-MENGE'.
      CHECK sy-subrc = 0.
      isd_qty = input-value.
      SELECT SINGLE * INTO wa_resb
                      FROM resb
                      WHERE rsnum = wa_resb-rsnum
                      AND   rspos = wa_resb-rspos.
      CHECK sy-subrc = 0.
      avlbl   = wa_resb-bdmng - wa_resb-enmng.
      req_qty = avlbl - out_qty.
      out_qty = req_qty - isd_qty.
      output-name = 'REQ_QTY'.
      output-value = req_qty.
    MODIFY output TRANSPORTING name value WHERE name = 'REQ_QTY'.
      APPEND output.
      output-name = 'OUT_QTY'.
      output-value = out_qty.
    MODIFY output TRANSPORTING name value WHERE name = 'OUT_QTY'.
      APPEND output.
    ENDFORM.
    Thanks,
    Ram.

    Hi Ram,
    I think you have to use MODIFY instead of append for the OUTPUT table.
    MOdify the table with KEY. This should resolve the problem.
    Ram, you can check this code and see how the MODIFY is to be used.
    REPORT YLSD999A.
    DATA  W_LENGTH TYPE I.
    *   GENERAL PURPOSE SUBROUTINES FOR CALLING FROM SAPSCRIPTS
    FORM DISPLAY_POUND TABLES IN_TAB STRUCTURE ITCSY
                              OUT_TAB STRUCTURE ITCSY.
      DATA: COUNT TYPE P VALUE 16.
      DATA: W_VALUE(17) TYPE C.        "defined as 7 chars to remove pence
      DATA: W_CHAR TYPE C.
      DATA: W_DUMMY TYPE C.
      DATA: W_CURR(3) TYPE C.
    *    Get first  parameter in input table.
      READ TABLE IN_TAB INDEX 1.
      WRITE IN_TAB-VALUE TO W_VALUE .
    * get second parameter in input table
      READ TABLE IN_TAB INDEX 2.
      MOVE IN_TAB-VALUE TO W_CURR.
      IF W_CURR = 'GBP'.
        W_CURR = '£'.
      ENDIF.
      W_LENGTH = STRLEN( W_CURR ).
    *    look for first space starting at right.
      WHILE COUNT > -1.
        W_CHAR = W_VALUE+COUNT(1).
    *  W_CHAR = IN_TAB-VALUE+COUNT(1).
        IF W_CHAR = ' '.
          COUNT = COUNT - W_LENGTH + 1.
          W_VALUE+COUNT(W_LENGTH) = W_CURR.
          COUNT = -1.
        ELSE.
    *     W_VALUE+COUNT(1) = W_CHAR.
          COUNT = COUNT - 1.
        ENDIF.
      ENDWHILE.
    * read only parameter in output table
      READ TABLE OUT_TAB INDEX 1.
      OUT_TAB-VALUE = W_VALUE.
      MODIFY OUT_TAB INDEX SY-TABIX.
    ENDFORM.
    Cheers
    VJ

  • GetURL:javascript blocked when called from a frame action in flash?

    Hi,
    I'm wrapping a load of flash/html eLearning content into air
    packages - or at least I was!
    The content is really old - flash 6 - and part of how it
    works is once it has loaded, it calls a javascript function, via a
    frame action. Each eLearning module relies on this call getting
    made...
    Sadly, this javascript call is never received - and having
    done a test it is purely down to the call being from a frame rather
    than a button (or other user interaction).
    eg. a movie with 10 frames. frame 10 has this action:
    (remember this is flash 6!)
    stop();
    getURL("javascript:foo());
    foo is never called.
    But put a button in with:
    on(release){
    getURL("javascript:foo());
    that works fine. Same call, but via a button.
    So really the question is - with air (or even is it something
    in new flash security?) - is there some reason why a frame action
    cannot call javascript? And if so - is there a parameter that can
    be set (like allowScriptAccess type thing - although tried that!)
    that will allow it again? Basically with over 1000 different flash
    movies, I'm not really in a position to re-code (eg.
    ExternalInterface does work! But can't recode 1000 movies to use
    that!).
    I've searched and can't see anything saying specifically a
    frame action call to javascript will be ignored, but clearly it
    is...
    Any idea, anyone?
    Thanks.

    You are calling the script while the mouse button is still
    down-- a
    hijacking truck.
    While it still works in older/unpatched IE, Microsoft has
    disabled
    resizeBy/To and moveBy/To while the mouse button is down.
    Obviously, when
    you have to click the Alert dialog's OK button, the mouse is
    no longer down.
    You'll need to take a different approach.

  • Cancel a Event and it's further execution from a Subroutine called from that event.

    First I will explain my requirement:
    Consider the following snippet.
    Private Sub SomeEvent(Byval sender as Object) Handles SomeControl.SomeEvent
    --Do Something_1
    --Do Something_2
    --Do Something_3
    call A()
    --Do Something_4
    --Do Something_5
    --Do Something_6
    End Sub
    Private Sub Procedure_A ()
    --Do Something_1
    --Do Something_2
    --Do Something_3
    call B()
    --Do Something_4
    --Do Something_5
    --Do Something_6
    End Sub
    Private Sub Procedure_B ()
    --Do Something_1
    --Do Something_2
    --Do Something_3
    'Exception Ocurs...Here
    --Do Something_4
    --Do Something_5
    --Do Something_6
    End Sub
    In the above exception, if the exception occurs at the said location in Procedure_B then, 
    1. Remaining Statements in Procedure_B should not execute.
    2. Remaining Statements in Procedure_A should not execute.
    3. Remaining Statements in SomeEvent should not execute.
    Please not that:
    I know this can be handled by using Try..Catch in every Subroutine and Raise an exception from there. But it cannot be implemented due to some reason.
    The solution I am looking for is
    1. To somehow cancel the ProcessThread the SomeEvent has started.
    Or
    2. If I could programatically Set Next Statement

    I think that you only need Try-Catch in
    SomeEvent, not in every procedure:
        --Do Something_1
        --Do Something_2
        --Do Something_3
        Try
            Call A()
            --Do Something_4
            --Do Something_5
            --Do Something_6
        Catch
        End Try
    It is also possible to distinguish specific exceptions.
    It is not clear why you cannot use Try-Catch. Then use
    On Error instead:
        --Do Something_1
        --Do Something_2
        --Do Something_3
        On Error GoTo Error1
        Call A()
         --Do Something_4
         --Do Something_5
         --Do Something_6
        Return
    Error1:

  • Dynamic action setvalue from pl/sql function

    Hi,
    I have a currency table with exchange rate column.
    I created a form that allow user to select currency from the table and get the rate into Px_RATE page items.
    I would like to implement it using Dynamic action in apex 4
    Please help me on this case
    Thanks & regards

    Hi,
    You can achieve this by defining a dynamic action as follows...
    #1 - Right click on the page item used to select the currency (let's call it P1_CURRENCY for purposes of this example) and select 'Create Dynamic Action'
    #2 - Select 'Advanced' as we're going to use the 'Set Value' dynamic action type, which is not available in the 'Standard' branch of the wizard.
    #3 - Name your dynamic action, say 'GET RATE', click 'Next'.
    #4 - Leave the 'When' attributes as default, this just defines that the dynamic action will fire whenever the currency item changes, click 'Next'.
    #5 - For the 'True Action > Action' select 'Set Value'
    #6 - Think about whether you want to set the value on page load from the dynamic action also, if so leave the 'Fire on Page Load' checkbox checked.
    #7 - [Assuming you have a simple PL/SQL API that returns the rate, say get_rate for example] Select 'Set Type' of 'PL/SQL Function Body'
    #8 - For 'PL/SQL Function Body' specify something like: return get_rate(:P1_CURRENCY);#9 - For 'Page Items to Submit', specify the currency item P1_CURRENCY and click 'Next'
    #10 - For the 'Affected Elements' specify 'Item' and then select the page item where you want to return the rate value, say P1_RATE.
    #11 - Click 'Create'.
    Let me know if this works for you or if you have any further questions.
    Regards,
    Anthony.

  • Call a routine in a dynamic action.

    Hi Experts,
    i want to write a routine in which i can give the error msg while saving the infotype 0002 incase the given condition is not fulfilled.
    Can you tell me where i can write this routine and how to call it in a dynamic action.
    i hav written other types of dynamic actions before but never called any routine before
    Plz give me the detailed info regarding writing a routine.
    regards
    TS

    Hello TS,
    You can do that using F in Indicator for step but iam not sure whether it will return an error message. We have user exits for this which might solve your issue. We have userexit PBAS0001 and in this EXIT_SAPFP50M_002 Function module, we need to write the code which ever you want to do.
    For Calling FORM in Dynamic actions.
    P - Check conditions
    I - Maintain infotype record
    W - Set default values when creating a new record
    V - Reference to another step
    F - Call routine
    M - Send mail
    Say you have a program ZTEST. In this you need to write the form that needs to be called in dynamic action and say for ex:form_test.
    You can fill only structure RP50D values, because these values you can get it back to dynamic action. ypu can check for examples in dynamic actions it self which have 'F' indicator step.
    Regards,
    Kiran I

  • How to process Dynamic Action in BDC

    Hi friends.
    We are using HR_INFOTYPE_OPERATION to update some infotypes. The problem is that dynamic action does not get triggered as SY-BINPT = 'X' when we use this FM or BDC to update.
    Now, is there any workaround so that we can process dynamic actions via our program?
    Can somehow we call the subroutine DYN_ACTION from our program? Can the values of PSAVE etc be availabe in our program?
    Thanks in adv!

    Hi
    Its kind of complicated to code dynamic actions in your BDC code. However , I would try my best to make you understand.
    1. Make a BDC recording of the source screen.
    2. Dynamic actions are stored in table: T588Z. Now during your screen processing of BDC data, you have to check the conditions yourself whether this was the condition which triggers the dynamic action.
    3, Make another BDC recording of the target screens which are called due to dynamic actions. Now if the condition in the source screen is fullfilled and you have to call a dynamic action then direct your program flow to the BDC recording of the target screen and update all the fields which would be updated by Dynamic Actions in the normal user interaction of that screen.
    In short, you have to program all those things which Dynamic action does since BDC does not support dynamic actions.
    Reward points, if helpful.
    Regards
    Waz

  • Dynamic Action On Date Picker

    Hi,
    I need help with understanding dynamic actions. I have two date pickers, I want the value of the first date picker to be the minimum date of the second date picker. To achieve this I have a hidden item whose value I want to reflect the selected date in the required format. In the dynamic action on the date picker I have no condition, and the true action is set to execute the following pl/sql code
    :P200220000_Y_MIN_DT := TO_CHAR(TO_DATE(:P200220000_Y_STR, 'DD-MON-YYYY'), 'YYYYMMDDHH24MI');. The items to submit field contains both the first date picker and the hidden item.
    The "P200220000_Y_MIN_DT" is now passed into the minimum date field of the second date picker. The problem is when the date is changed the hidden item does not get the value until the page is refreshed.
    Am I doing something wrong or just have not mastered the use of dynamic action or are my colleagues right use AJX call backs not dynamic actions.
    Thanks
    Aderemi

    Hi Aderemi,
    first of all as already explained, the min/max values are already used on the server side when the necessary code for the date picker is rendered. When you changed the referenced values in the browser, these values will not change the behavior of the client side date picker widget. But when you submit the page, the new min/max values will be used by the date picker validation check on the server.
    To over the client side date picker display issue, you could directly call the date picker JavaScript code and pass in the new min/max values. Have a look at http://jqueryui.com/demos/datepicker/
    So for example you could have a dynamic action of type "Execute JavaScript code" which executes the following Javascript code.
    apex.jQuery('#P200220000_MY_DATE_PICKER').datepicker("option", "minDate", "-1m");I think that should work. Note: I haven't tested if that really works and it's also some kind of unsupported, because it uses the underlaying jQueryUI APIs the APEX date picker is using. This could change in the future and would invalidate your code.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins

  • Dynamic Action on new row in Tabular Form

    Hi Guys,
    APEX version is 4.1
    I created a dynamic action on change of a select list, if changed then disable the related fields on the same row.
    This is working fine for all EXISTING rows on the tabular form.
    However, if I click on ADD ROW button, a new row is added to the page, but the change event on select list is
    not triggerred from the dynamic action.
    Is there any thoughts or workaround on this interesting problem?
    Thanks in advance,
    Frank

    I got it working by adding a onchange event which is triggering js function on the page.

  • How to raise Error Message in foreground through Dynamic Action?

    Hi,
    I have a requirement where I have to raise an error message in foreground so as to stop processing whenever HR_INFOTYPE_OPERATION fails to update a record in a dynamic program. I tried using MESSAGE statement but it did not work, as the error message was not displayed properly on the Infotype screen that calls the dynamic action.
    For ex.: If infotype PA0000 is calling PA0014 through dynamic action, then I want the error message to be displayed on the Actions Screen of PA0000.
    Is there any specific way to raise error messages through dynamic action programs?
    Quick answers will be appreciated.

    HI Sanjana,
    In the Substitution exits you can create the message in the configuration it self.
    You dont't need raise message explicitly.
    Thanks,

Maybe you are looking for