Problems creating background job for program (job open, submit and close)

Hi gurus,
im trying to start a background job using the FM BP_START_DATE_EDITOR to show the start date to the job or if it's imediate. this FM it's working fine, after call it im opening a job, submiting it and call the job close FM and the job close FM creates me the job.
The problem it's when i go to the sm37 to see the job status the job has been canceled, and the job log says that i have to give a start date to the job.
What i dont understand it's either the job is imediate or i choose a date to start the job always gives me this error...
Below goes my code,
any ideas will be rewarded
  CLEAR: stdt_modify_type, stdt_output.
  CALL FUNCTION 'BP_START_DATE_EDITOR'
       EXPORTING
            stdt_dialog                    = 'Y'
            stdt_input                     = stdt_input
            stdt_opcode                    = 14
       IMPORTING
            stdt_modify_type               = stdt_modify_type
            stdt_output                    = stdt_output
       EXCEPTIONS
            fcal_id_not_defined            = 1
            incomplete_last_startdate      = 2
            incomplete_startdate           = 3
            invalid_dialog_type            = 4
            invalid_eventid                = 5
            invalid_opcode                 = 6
            invalid_opmode_name            = 7
            invalid_periodbehaviour        = 8
            invalid_predecessor_jobname    = 9
            last_startdate_in_the_past     = 10
            no_period_data_given           = 11
            no_startdate_given             = 12
            period_and_predjob_no_way      = 13
            period_too_small_for_limit     = 14
            predecessor_jobname_not_unique = 15
            startdate_interval_too_large   = 16
            startdate_in_the_past          = 17
            startdate_is_a_holiday         = 18
            startdate_out_of_fcal_range    = 19
            stdt_before_holiday_in_past    = 20
            unknown_fcal_error_occured     = 21
            no_workday_nr_given            = 22
            invalid_workday_countdir       = 23
            invalid_workday_nr             = 24
            notbefore_stdt_missing         = 25
            workday_starttime_missing      = 26
            no_eventid_given               = 27
            OTHERS                         = 28.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    MOVE 'X' TO gv_flag.
  ENDIF.
  DATA jobname LIKE tbtcjob-jobname.
  DATA jobcount LIKE tbtcjob-jobcount.
  DATA job_release LIKE  btch0000-char1.
  DATA job_imediate TYPE c.
  CLEAR: jobname, jobcount, job_release.
  CONCATENATE 'MAPAEXEC' sy-uname sy-datum
               INTO jobname SEPARATED BY space.
  CALL FUNCTION 'JOB_OPEN'
       EXPORTING
            jobname          = jobname
       IMPORTING
            jobcount         = jobcount
       EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
  IF sy-subrc <> 0.
    MESSAGE i003(zmapas).
    EXIT.
  ENDIF.
  SUBMIT z_mapa_execucao_orcamental
         VIA JOB jobname NUMBER jobcount
         WITH ano EQ ano
         WITH so_perio IN so_perio
         WITH so_date IN so_date
         WITH so_org EQ so_org
         WITH so_num IN so_num
         AND RETURN.
  IF stdt_output-startdttyp EQ 'I'.
    CLEAR job_imediate.
    job_imediate = 'X'.
  ENDIF.
  CALL FUNCTION 'JOB_CLOSE'
       EXPORTING
            calendar_id                 = stdt_output-calendarid
            event_id                    = stdt_output-eventid
            event_param                 = stdt_output-eventparm
            event_periodic              = stdt_output-periodic  "?
            jobcount                    = jobcount
            jobname                     = jobname
            laststrtdt                  = stdt_output-laststrtdt
            laststrttm                  = stdt_output-laststrttm
            prddays                     = stdt_output-prddays  "??
            prdhours                    = stdt_output-prdhours  "?
            prdmins                     = stdt_output-prdmins  "??
            prdmonths                   = stdt_output-prdmonths
            prdweeks                    = stdt_output-prdweeks  "?
            predjob_checkstat           = stdt_output-checkstat
            pred_jobcount               = stdt_output-predjobcnt
            pred_jobname                = stdt_output-predjob
            sdlstrtdt                   = stdt_output-sdlstrtdt
            sdlstrttm                   = stdt_output-sdlstrttm
            strtimmed                   = job_imediate
            targetsystem                = stdt_output-instname
            start_on_workday_not_before = stdt_output-notbefore
            start_on_workday_nr         = stdt_output-wdayno
            workday_count_direction     = stdt_output-wdaycdir
       IMPORTING
            job_was_released            = job_release
       EXCEPTIONS
            cant_start_immediate        = 1
            invalid_startdate           = 2
            jobname_missing             = 3
            job_close_failed            = 4
            job_nosteps                 = 5
            job_notex                   = 6
            lock_failed                 = 7
            OTHERS                      = 8.
  IF sy-subrc <> 0.
    MESSAGE i003(zmapas).
    EXIT.
  ELSE.
    MESSAGE i004(zmapas) WITH jobname.
  ENDIF.
Thanks in advance,
Best Regards
João Martins

Hello João.
In debug mode, check the value of variables you passed to parameters sdlstrtdt and sdlstrttm.
As aditional info, I usually achieve your goal without FM BP_START_DATE_EDITOR.
Check this code:
CALL FUNCTION 'JOB_OPEN'
      EXPORTING
           jobname          = w_jobname
      IMPORTING
           jobcount         = w_jobcount
      EXCEPTIONS
           cant_create_job  = 1
           invalid_job_data = 2
           jobname_missing  = 3
           OTHERS           = 4.
CHECK sy-subrc = 0.
CLEAR seltab_wa.
MOVE: t_jobs-param TO seltab_wa-selname,
t_processar-line+34 TO seltab_wa-low.
APPEND seltab_wa TO seltab.
seltab_wa-selname = 'P_LOJA'.
seltab_wa-low = t_processar-ficheiro+7(4).
APPEND seltab_wa TO seltab.
*** Submete o programa para o JOB
SUBMIT (t_jobs-repid)
  WITH  SELECTION-TABLE seltab
  USER sy-uname
   VIA JOB w_jobname NUMBER w_jobcount
   AND RETURN.
*** Encerra o JOB
  l_hora = sy-uzeit.
  ADD 60 TO l_hora.
CALL FUNCTION 'JOB_CLOSE'
   EXPORTING
      jobcount           = w_jobcount
      jobname           = w_jobname
      sdlstrtdt            = sy-datum
      sdlstrttm           = l_hora
      targetserver       = w_servidor
   IMPORTING
      job_was_released     = l_liberado
   EXCEPTIONS
      cant_start_immediate = 1
      invalid_startdate    = 2
      jobname_missing      = 3
      job_close_failed     = 4
      job_nosteps          = 5
      job_notex            = 6
      lock_failed          = 7
      OTHERS               = 8.
Regards.
Valter Oliveira.

Similar Messages

  • Schedule jobs witj job open, submit and close

    Hi gurus,
    I need to know if there is any way to schedule various jobs using the FM job_open job_submit and job_close. Like schedule the first job for a date and a hour and schedule others jobs to run after the first job sequential.
    Its this possible?
    Thk in advance

    Hi
    see the sample code for the Job scheduling using the fun modules
      IF p_bjob = 'X'.
        CONCATENATE sy-cprog sy-datum sy-uzeit
                    INTO jobname SEPARATED BY '_'.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = jobname
          IMPORTING
            jobcount         = jobcount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          IMPORTING
            out_archive_parameters = arc_params
            out_parameters         = print_params
            valid                  = valid
          EXCEPTIONS
            archive_info_not_found = 1
            invalid_print_params   = 2
            invalid_archive_params = 3
            OTHERS                 = 4.
        IF valid = chk.
          SUBMIT yREP  WITH s_kunnr IN s_cust
                          AND RETURN
                          USER               sy-uname
                          VIA JOB            jobname
                          NUMBER             jobcount
                          TO SAP-SPOOL
                          SPOOL PARAMETERS   print_params
                          ARCHIVE PARAMETERS arc_params
                          WITHOUT SPOOL DYNPRO.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = jobcount
              jobname              = jobname
              strtimmed            = 'X'
            EXCEPTIONS
              cant_start_immediate = 1
              invalid_startdate    = 2
              jobname_missing      = 3
              job_close_failed     = 4
              job_nosteps          = 5
              job_notex            = 6
              lock_failed          = 7
              invalid_target       = 8
              OTHERS               = 9.
          IF sy-subrc <> 0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
            MESSAGE i029 WITH jobname.
          ENDIF.
        ELSE.
          MESSAGE s000 WITH text-003.
          STOP.
        ENDIF.
      ENDIF.
    Regards
    anji

  • Error in background job for program RSGET_SMSY error message No active job

    Hello!
    I would like to set up the Change Request Management functionality in SAP Solution Manager.
    The only red warning by executing Test-button in Tcode “SOLAR_ADMIN_PROJECT” is:
    <b>Error in background job for program RSGET_SMSY error message No active job found</b>
    Can someone please tell me how to solve this problem?
    (tcodes, technical steps)
    Thank you very much!
    regards
    Thom

    Thank you very much!
    Can you also help me with the warning "Errors occurred during synchronization of the system landscape" in tcode SOLAR_PROJECT_ADMIN" --> System landscape --> Change requests --> "Refresh"?
    The second issue I cannot see any projects in Tcode "/TMWFLOW/CMSCONF"
    according to the SPRO-step "Set Project Assignment of Requests as Mandatory"
    Thank you!
    regards

  • Is it possible to create a batch job for program RPRCCC00

    Dear All,
    I want to create a schedul batch job for program RPRCCC00. Have you come across with this scenario.
    Thanks in advance
    Regards
    Shanu

    Hi,
    Yes, you can create a batch job of the program RPRCCC00.
    Using SM36 transaction, you can create a batch job.
    Hope this helps.
    Thanks,
    Prashanth

  • Create BDC recording for position,job,role

    hi all,
    i want to create BDC recording for position,job,role . what is the transaction for creating postion,job, role?/??
    and i have to check wheather for one job , role is there or not? if not i have to create that role.. similiarly i have to check for position that there is corresponding job is there or not.. if not i have to create the job???
    how would i do that??
    thanks
    SAchin

    Hi Sachin,
    1) Creating BDC is an ABAP-ers job and being functional its not ur responsibility. If u really want to do that then u can do it through T.Code - SHDB.
             While creating BDC for Position u have to go through T.Cdoe - SHDB and in that give PP01 in the TRANSACTION CODE feild. Then go on for recording.  After that ask the help of an ABAP-er.
    2) To Check if a POSITION or a JOB is there, then Go to T.Code - PP01, under Obj Abbr. feild put S for POSITION and C for JOB and press enter after entering the POSITION and JOB id. U'll get the result. OK
    3) To check for ROLE, u have go to T.Code - PFCG and there check for the particular ROLE u r looking for. Here in this T.Code u can actually create, change and delete the ROLES.OK
    Hope this helps,
    ARNAV...

  • SAP Scheduler. Multiple jobs for one job definition issue.

    Hi.
    I am facing one problem concerning scheduling jobs. I've created a job definition and deployed it on server. In onJob(...) method system queries to DB for a single result, when this result matches some conditions job is finished, otherwise it waits for a minute and then queries again. Then I tried to create several tasks for this job definition and set similar execution time for all tasks to check their simultaneous behavior. I was surprised to find out that only one job status is 'RUNNING' and for others status is 'STARTING'. But I expected to see all my jobs in status 'RUNNING'. At first I thought the problem was in MDB pool stuff(e.g. InitialSize of beans or something like that), supposing that there is only one working bean and huge queue  of messages. But nothing changed after setting different values for pool params.
    So, can anyone help me to make at least 2 simultaneous working  jobs for one job definition, if it possible, off cause. Or may be I am wrong somewhere. (By the way, I used Threads in MDB for waiting).
    Thanks in advance.

    May be I described my problem rather messy. The main question is it possible to create several jobs for one job definition and see them running at the same time (simultaneously)?
    Thanks.

  • How to create menu function for link to open file

    Hi,
    I need help how to create menu function for link to access file and allow user to save the file when click on it.
    The file will keep inside server.
    Thank you.
    Regards,
    Wilson

    I need help how to create menu function for link to access file and allow user to save the file when click on it.
    The file will keep inside server.AFAIK, you have to write a custom code to achieve this and Oracle does not provide this functionality.
    If you want to store the file as an attachment, please see (How to Store Image/PDF Attachments on the File System in 11i and R12 (like Attachment File Directory) [ID 294525.1]).
    Thanks,
    Hussein

  • I can't make ADE the default program to open EPUB and MOBI files

    Hello, I can't seem to be able to make ADE the default program to open EPUB and MOBI files. I use Windows 7. I used to use a Firefox plug-in to view these files, and before that I used Calibre. I have been told that these are both inadequate. When I go into the Control Panel to change the default program to open these files, however, ADE is not listed as one of the possibilities (only Firefox and Calibre are), and when I search it just brings up Adobe Acrobat. Any advice? Thanks, Bill.

    I think I have answered my own question. This time I clicked on Browse for the program to set as the default, and I selected the Downloads program, and there it was. For some reason I had to re-install it several times, and it kept re-installing and re-installing. But all seems to be OK now. 

  • Collapsible Panels - Links to open one, and close others

    Hi,
    I am new to Dreamweaver and have been creating my site by
    learning as I go along. I have already read through all the other
    related topics associated with Collapsible Panels on this blog and
    have still not found an answer. I have been able to open and close
    Collapsible Panels by using links - but unfortunately, I need more
    than just opening and closing.
    On my site i have approximately 5 pages, all with the same
    header and Menu bar. The Information (that i have presented in
    numerous Collapsible Panels) does however vary from page to page.
    What I need to try and figure out is:
    How can I open one collapsible panel and close all others? I
    have seen the one example which leads to my next question:
    How can I group Panels? Some examples of how to open one and
    close all others use this grouping. Is there any other way of
    opening one and closing all others without grouping?
    Lastly, is it possible to set up a link that can be viewed on
    one page which when clicked opens the relevant page and collapsible
    panel? i.e. on my About Us page there is a link (using the Menu
    bar) for one of my several services on the services drop down menu
    (but services is on a different page with the same setup). When a
    viewer clicks on the specific service, is it possible to get the
    site to open the services page, and open the relevant collapsible
    panel (with all other Panels closed)?
    Any assistance would be greatly appreciated - I have been
    searching for days now and cannot seem to find any
    answers/directions in laymans terms.
    Kind regards,
    John

    wlsjoh013 wrote:
    > Hi,
    >
    > I am new to Dreamweaver and have been creating my site
    by learning as I go
    > along. I have already read through all the other related
    topics associated
    > with Collapsible Panels on this blog and have still not
    found an answer. I
    > have been able to open and close Collapsible Panels by
    using links - but
    > unfortunately, I need more than just opening and
    closing.
    >
    > On my site i have approximately 5 pages, all with the
    same header and Menu
    > bar. The Information (that i have presented in numerous
    Collapsible Panels)
    > does however vary from page to page. What I need to try
    and figure out is:
    >
    > How can I open one collapsible panel and close all
    others? I have seen the one
    > example which leads to my next question:
    This page has an example that has a link that can open and
    close a panel:
    http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/collapsible_panel_sample. htm
    One way to do this would be to have a single link that would
    open one of your panels using the code, but then add to it code
    that closes each of the other panels, for example:
    <a href="#"
    onclick="CollapsiblePanel4.open();CollapsiblePanel5.close();CollapsiblePanel6.close();">O pen
    4, close 5 and 6</a>
    To make this work, you'll need to look that the panel
    constructors at the bottom of your page and make sure to match up
    the panel variable names i.e. "var CollapsiblePanel1 =...." the
    variable is CollapsiblePanel1.
    You could also write a function that gathers together the
    various panels you have on the page and then pass to it only the
    panel that you want kept open. For now, though, it might be best to
    use the above method, given your expertise. And taking that even
    further, you could apply the function call unobtrusively. Both the
    function call and the unobtrusive part you can work on later to get
    this working for now.
    > How can I group Panels? Some examples of how to open one
    and close all others
    > use this grouping. Is there any other way of opening one
    and closing all
    > others without grouping?
    This is a little confusing, on one hand you ask about how to
    group, but then ask how not to group. There is a concept of a
    collapsible panel group:
    http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/CollapsiblePanelGroupSamp le.html
    But there is another type of group, that may be more what
    you're looking for, and that's an Accordion panel, which is similar
    to the collapsible panel group, with the exception that it can only
    have one panel open at a time.
    > Lastly, is it possible to set up a link that can be
    viewed on one page which
    > when clicked opens the relevant page and collapsible
    panel? i.e. on my About Us
    > page there is a link (using the Menu bar) for one of my
    several services on the
    > services drop down menu (but services is on a different
    page with the same
    > setup). When a viewer clicks on the specific service, is
    it possible to get
    > the site to open the services page, and open the
    relevant collapsible panel
    > (with all other Panels closed)?
    Probably the easiest way to do this particular one would be
    to make sure that you have all of the panels set to be closed when
    the page loads, and then take a look at the code for the last
    example on this page:
    http://labs.adobe.com/technologies/spry/samples/utils/URLUtilsSample.html
    That example uses a tabbed panel, but the concept is the
    same, use a URL parameter to determine what to show. You'll need to
    link in the SpryURLUtils file in the Spry download package (look in
    the includes folder):
    http://labs.adobe.com/technologies/spry/home.html
    Essentially, your link will look similar to:
    sample.html?panel=1
    Then your code could look something like:
    var params = Spry.Utils.getLocationParamsAsObject();
    var CollapsiblePanel1 = new
    Spry.Widget.CollapsiblePanel("CollapsiblePanel1",
    {contentIsOpen:(params.panel==1 )} );
    var CollapsiblePanel2 = new
    Spry.Widget.CollapsiblePanel("CollapsiblePanel2",
    {contentIsOpen:(params.panel==2 )} );
    Basically what this is doing is creating an object from the
    URL parameters. Then for each of the panels the constructor has
    code that determines whether or not to expand the panel when the
    page loads. So it checks the value of params.panel to see if it
    matches 1 (for the first one), if it does, then that means that
    contentIsOpen is set to true, if it is some other number or is not
    present at all, then that means that the panel is closed. This
    would then be repeated down the line for how ever many panels you
    want to operate like that.
    Danilo Celic
    |
    http://blog.extensioneering.com/
    | WebAssist Extensioneer
    | Adobe Community Expert

  • Automatically open, save and close excel?

    I need import data from Excel to SQL.
    Now, I use tSQL to directly read the excel files and transform to the SQL table.
    As the user Excel is not a good format for SQL to read, I need use formula to transform the excel to be a SQL readable format.
    Now, I add a sheet to copy the data from the sheet which user input the data and then ask the user to copy the excel to a specific location for import.
    However, this will make the data in the excel double and result a large excel file.
    I am thinking if it is possible to create a excel to use formula to copy the data from another excel.
    Then, I need find some method to open that excel, let the content refresh from the source excel, save and close it.
    Then I can directly use this excel for data import.
    Is there any simple way to do so? I don't know marco much...
    Ivan

    No formula could do this (Automatically open, save and close excel).
    You need to recode a marco or write a macro. Why donot you ask in msdn?
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    example:
    Sub auto_open()
    Application.OnTime Now + TimeValue("00:01:00"), "wswx"
    End Sub
    Sub
    wswx() If Not ThisWorkbook.Saved
    Then ThisWorkbook.Save
    ThisWorkbook.Close
    End Sub
    KR

  • Open dataset and close dataset

    Hi
    I need to write log file in fileshare.
    I am using the following FM to create the file.
    Z_FILE_OPEN_OUT_UNICODE'
    I have following qns
    1. do i need to use open dataset and close dataset stmts, even I create the files with the FM?

    Hi,
    you can fill in the name of the FM in transaction SE37, then click 'Display' and look at the source code and the 'Tables' tab.
    It's a custom build FM, so you might have to look at the import parameters it needs... ( Tab 'Import' and 'Tables' ).
    To answer your question, as the name of the FM suggests it will write the file for you, so no open/close dataset. Please doublecheck tab 'Source code' and you might find these statements there...
    hope that helps,
    Rolf

  • Problem in creating Batch job for programs in different servers.

    Hi All,
    I have a requirement like i have 2 different programs ( PRG1,PRG2 ) running in 3 different SAP servers (SER1,SER2,SER3).
    I want to create a batch job for the programs.
    Here When I run the PRG1 in Server SER1,it will create a file1 in SER1 as well as the other 2 servers (SER2 and SER3).
    It just create a file and there is no content in the file.Once i start writing records to file1in SER1,the same record will be started writing in SER2 and SER3.This is using PRG1.
    Once PRG1 will complete writing records in file,Next PRG2 will run in SER2 using file created by PRG1.
    I want to create a batch job for PRG1.
    How to trigger the PRG2 after completing job1 for PRG1 without any manual interaction.
    Please help me for this.

    Hi Ambili
    You can set steps in these jobs in transaction SM36.
    You can define that Job 2 starts after Job1 complete sucessfully and same game for other jobs.
    Please, check attachment for detailed information about that
    Kind regards
    Edited by: Carlos Machado on May 27, 2010 6:01 PM

  • Create new session for each window opening

    From a jsp page i open a page called student.jsp by clicking on students admision no.Therefore lots of pages can be opend in new windows with relevent student details.
    but when i click on the link i called a servlet, get relevent details and redirect to student.jsp. The problem is ,all opened windows have same session id and there are session conflicts.
    How can i create new sessions for each page thru the servlet or is there any other alternatives

    I actually was working on a problem that was similar to this, and the problem is with how each web-browser works with sessions...
    Each browser window (Except in one case with IE) will use the same session in each window.
    However, you might be able to use URL-Rewritting to manage your sessions and get around using cookies for for session tracking. I personally haven't tried this, but I'm betting that it will work.
    Best of Luck,
    Nate

  • Problem creating Network ACL for a ROLE in Oracle 11gR2

    According to Oracle Documentation when you create a new Network ACL you can add privileges to a user or role.  I need to create a new ACL for the UTL_SMTP package for a specific role, but when I granted it the users who have that role are still getting the "ORA-24247: network access denied by access control list (ACL)" error when they try to send an email.  If I grant the ACL privilege to the same users directly it works fine.  Is there any step I'm missing?  This is the test I have made on my Solaris 10 - Oracle 11gR2 (11.2.0.3) Standard Edition server:
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 21 09:31:52 2013
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    SQL> CONNECT system/******@testdb
    Connected.
    SQL> SET LINES 1000
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> COLUMN host FORMAT A20
    SQL> COLUMN lower_port FORMAT 99999
    SQL> COLUMN upper_port FORMAT 99999
    SQL> COLUMN acl FORMAT A40
    SQL> COLUMN acl FORMAT A40
    SQL> COLUMN principal FORMAT A15
    SQL> COLUMN privilege FORMAT A10
    SQL> COLUMN is_grant FORMAT A8
    SQL> COLUMN status FORMAT A10
    SQL> SELECT host, lower_port, upper_port, acl FROM dba_network_acls;
    no rows selected
    SQL> SELECT acl,principal,privilege,is_grant FROM dba_network_acl_privileges;
    no rows selected
    SQL> CREATE USER testacl IDENTIFIED BY testacl;
    User created.
    SQL> GRANT CONNECT TO testacl;
    Grant succeeded.
    SQL>
    SQL> BEGIN
      2     dbms_network_acl_admin.create_acl('test_smtp.xml','TEST SMTP ACL','TESTACL',true,'connect');
      3     dbms_network_acl_admin.assign_acl('test_smtp.xml','localhost',25);
      4     commit;
      5  END;
      6  /
    PL/SQL procedure successfully completed.
    SQL> SELECT host, lower_port, upper_port, acl FROM dba_network_acls;
    HOST                 LOWER_PORT UPPER_PORT ACL
    localhost                    25         25 /sys/acls/test_smtp.xml
    SQL> SELECT acl,principal,privilege,is_grant FROM dba_network_acl_privileges;
    ACL                                      PRINCIPAL       PRIVILEGE  IS_GRANT
    /sys/acls/test_smtp.xml                  TESTACL         connect    true
    After creating this ACL I test it like this:
    SQL> CONNECT testacl/testacl@testdb
    Connected.
    SQL> SELECT host, lower_port, upper_port, privilege, status FROM user_network_acl_privileges;
    HOST                 LOWER_PORT UPPER_PORT PRIVILEGE  STATUS
    localhost                    25         25 connect    GRANTED
    SQL> DECLARE
      2     c utl_smtp.connection;
      3  BEGIN
      4     c := utl_smtp.open_connection('localhost', 25); -- SMTP on port 25
      5     utl_smtp.helo(c, 'localhost');
      6     utl_smtp.mail(c, 'Oracle11.2');
      7     utl_smtp.rcpt(c, '[email protected]');
      8     utl_smtp.data(c,'From: Oracle'||utl_tcp.crlf||'To: [email protected]'||utl_tcp.crlf||'Subject: UTL_SMTP TEST'||utl_tcp.crlf||'');
      9     utl_smtp.quit(c);
    10  END;
    11  /
    PL/SQL procedure successfully completed.
    SQL>
    This works fine and I receive the email correctly.  Now if I try to do the same thing for a role:
    SQL> CONNECT system/******@testdb
    Connected.
    SQL> BEGIN
      2     dbms_network_acl_admin.drop_acl('test_smtp.xml');
      3     commit;
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SQL> SELECT host, lower_port, upper_port, acl FROM dba_network_acls;
    no rows selected
    SQL> CREATE ROLE testacl_role;
    Role created.
    SQL> GRANT testacl_role TO testacl;
    Grant succeeded.
    SQL> ALTER USER testacl DEFAULT ROLE ALL;
    User altered.
    SQL>
    SQL> BEGIN
      2     dbms_network_acl_admin.create_acl('test_smtp.xml','TEST SMTP ACL','TESTACL_ROLE',true,'connect');
      3     dbms_network_acl_admin.assign_acl('test_smtp.xml','localhost',25);
      4     commit;
      5  END;
      6  /
    PL/SQL procedure successfully completed.
    SQL> SELECT host, lower_port, upper_port, acl FROM dba_network_acls;
    HOST                 LOWER_PORT UPPER_PORT ACL
    localhost                    25         25 /sys/acls/test_smtp.xml
    SQL> SELECT acl,principal,privilege,is_grant FROM dba_network_acl_privileges;
    ACL                                      PRINCIPAL       PRIVILEGE  IS_GRANT
    /sys/acls/test_smtp.xml                  TESTACL_ROLE    connect    true
    SQL>
    And now I test it again with the same user:
    SQL> CONNECT testacl/testacl@testdb
    Connected.
    SQL>
    SQL> SELECT host, lower_port, upper_port, privilege, status FROM user_network_acl_privileges;
    no rows selected
    SQL> DECLARE
      2     c utl_smtp.connection;
      3  BEGIN
      4     c := utl_smtp.open_connection('localhost', 25); -- SMTP on port 25
      5     utl_smtp.helo(c, 'localhost');
      6     utl_smtp.mail(c, 'Oracle11.2');
      7     utl_smtp.rcpt(c, '[email protected]');
      8     utl_smtp.data(c,'From: Oracle'||utl_tcp.crlf||'To: [email protected]'||utl_tcp.crlf||'Subject: UTL_SMTP TEST'||utl_tcp.crlf||'');
      9     utl_smtp.quit(c);
    10  END;
    11  /
    DECLARE
    ERROR at line 1:
    ORA-24247: network access denied by access control list (ACL)
    ORA-06512: at "SYS.UTL_TCP", line 17
    ORA-06512: at "SYS.UTL_TCP", line 267
    ORA-06512: at "SYS.UTL_SMTP", line 161
    ORA-06512: at "SYS.UTL_SMTP", line 197
    ORA-06512: at line 4
    SQL>
    I'm aware that role privileges doesn't apply inside procedures, functions or packages by default, but this is an anonymous block so it should use the active roles for the user.  I also tried adding a "dbms_session.set_role('TESTACL_ROLE');" at the beggining of the anonymous PL/SQL block but I got the same access error.
    Thanks in advance for any help you can give to me on this question, it would be very hard to grant the ACL to all the individual users as they are more than 1000, and we create more regularly.

    Thanks for your quick reply... I don't have a problem creating the basic ACL with the privileges granted for a user.  The problem appears when I try to create an ACL with privileges for a ROLE.  You can see here http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_networkacl_adm.htm#BABIGEGG than the official Oracle documentation states that you can assign the ACL principal to be a user or role:
    Parameter
    Description
    acl
    Name of the ACL. Relative path will be relative to "/sys/acls".
    description
    Description attribute in the ACL
    principal
    Principal (database user or role) to whom the privilege is granted or denied. Case sensitive.
    My issue is that when I try to create the ACL for a role it doesn't work.
    Have you ever created an ACL for a role? if so please send me an example or let me know which step I might be missing.  Cheers.

  • Problem creating transactional iview for BW system

    Hi gurus
    We are facing one problem creating a transactional iview for a BW 3.5 system . We wanto to call transaction SU01 in our BW system using an iview. When we use SAP for html, we have all the menu on the iview , I mean the same result as if we use smen, not SU01.
    And if we use SAP GUI , we are always having the same GUI Error
    Sapgui 640 [Build 8986] Wed Apr 01 12:25:05 2009
    : 'service '' unknown
    Time          Wed Apr 01 12:25:03 2009
    Component     NI (network interface)
    Release          640
    Version          37
    Module          ninti.c
    Line          505
    Method          NiPGetServByName2: service '' not found
    Return Code     -3
    System Call     getservbyname_r
    Counter          1
    Please, can you help us?
    Thanks in advance and best regards.

    Thanks Bala for your quick reply. I´ve tried with function module RSBB_URL_PREFIX_GET  and all the settings were OK. Still the same result.
    Adding more information. We have another WAS 6.40 server with different Module(we have RM and XRPM , not BW) and we are having the same problems. I am wondering if its related with some special config or activation 
    Maybe  I´ve forgot some service activation in SICF? I´m able to reach the SMEN, but not the SU01
    or I´m missing some config elsewhere?
    Thanks in advance.
    Best regards.
    Edited by: Jose Ignacio Arlandis on Apr 2, 2009 8:41 AM

Maybe you are looking for