Skipping errors in WBS elements closure with a SAP / Excel script.

Hai there!
I have a Excel / SAP macro for closing WBS elements in transaction CJ20N. This macro works fine until error messages occur (or warnings) in SAP because something was not completed on the WBS element.
So then I thought the macro may be able to skip the WBS element that has errors on it and continue trying to close the next one instead? And then make a little mark in my list of WBS elements to close. That would save loads of time.
Is this possible? This is what I have in the code right now.
WBSToClose = ActiveCell.Offset(0, 1).Value
session.findById("wnd[0]").maximize
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").topNode = "         23"
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[0]/shell/shellcont[0]/shell").pressButton "OPEN"
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").Text = WBSToClose
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").SetFocus
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").caretPosition = 0
session.findById("wnd[1]").sendVKey 0
session.findById("wnd[0]/mbar/menu[1]/menu[1]/menu[6]/menu[0]").Select '<--- This is the close button, after this errors sometimes occur.
session.findById("wnd[0]/tbar[0]/btn[11]").press '<--- save button.
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").topNode = "         23"
Below is an example of an error message popping up while trying to close.
session.findById("wnd[0]").maximize
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").topNode = "         23"
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[0]/shell/shellcont[0]/shell").pressButton "OPEN"
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").text = WBSToClose
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").setFocus
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").caretPosition = 18
session.findById("wnd[1]").sendVKey 0
session.findById("wnd[0]/mbar/menu[1]/menu[1]/menu[6]/menu[0]").select '<--- Selecting close
session.findById("wnd[1]/usr/btnOPTION2").press '<--- Here I click "Continue" on the error message
session.findById("wnd[0]/tbar[0]/btn[3]").press '<--- Back button
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").topNode = "         23"
I would also like the script to put a little mark in my excel file showing which WBS elements that had errors on them. Just a number or so. But thats a bonus.
Is this possible?
Thanks, Mattias

Hello again!
Thanks alot! I got it to work perfectly with some modifications to the code.
Posting the solution in case someone can find it useful.
If (ActiveCell.Value = 0) Then
Row = 2
Column = 1
WBSToClose = ActiveCell.Offset(0, 1).Value
session.findById("wnd[0]").maximize
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").topNode = "         23"
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[0]/shell/shellcont[0]/shell").pressButton "OPEN"
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").Text = WBSToClose
session.findById("wnd[1]/usr/ctxtCNPB_W_ADD_OBJ_DYN-PRPS_EXT").SetFocus
session.findById("wnd[1]").sendVKey 0
session.findById("wnd[0]/mbar/menu[1]/menu[1]/menu[6]/menu[0]").Select '<-- Selecting close
session.findById("wnd[0]/tbar[0]/btn[11]").press '<-- Save button.
On Error Resume Next
session.findById("wnd[1]").Close '<-- Close window button on any error message or warning
If Err.Number = 0 Then
ActiveCell.Value = 2
session.findById("wnd[0]/tbar[0]/btn[3]").press '<--- Back button if error message
End If
On Error GoTo 0
session.findById("wnd[0]/shellcont/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").topNode = "         23"
Row = Row + 1
End If
If ActiveCell.Value = 2 Then GoTo Fortsaett '<-- Skipping writing "1" in "processed"
ActiveCell.Value = 1
Fortsaett:
n = n + 1
ActiveCell.Offset(1, 0).Select
'Some looping hereafter
Points awarded.
Thanks, Mattias

Similar Messages

  • Message error Item wbs element budget exceeded

    Hi
    when I do a purchase requisition imputed to WBS element, WBS element consuming, but when I'm going to make the budget document of the reserve (R) in a transaction FMX1 jumps me an error message:wbs element budget exceeded ,it is trying to consumed WBS element , when it has consumed in the purchase requisition.
    I have solved it error with limits tolerance but in the funds commitments consumed other time , we see these results  in the report S_ALR_8713558.
    Where is the problem????
    Than you

    You have to differentiate the beaviour of the availability control in customizing for PS > Costs > Budget > Define tolerance limit
    With the "transaction group" you can differentiate for:
    ++     All activity groups
    00     Purchase requisition
    01     Purchase order
    07     Funds reservation
    Ciao
    Giorgio

  • Install error of Photoshop elements 9 with 32 bit window 7 Ultimate

    install error of Photoshop elements 9 with 32 bit window 7 Ultimate while all requirements are yes, Pl Help .                                                                        below message is coming " Please check application vendor that this is a valid window installer package"  Thanks 

    Try going directly to program files and if you can see the Editor application double click to launch it.

  • Error in WBS element while doing the purchase requisition

    Dear All,
    While doing the purchase requisition in ps
    the error is : Item 010 WBS element IN05-PR09-16 . 04 budget exceeded.
    Kindly parovide any solution.
    Best Regards,
    Venkat.

    Hi Venkar,
    Check the available budget against WBSE - IN05-PR09-16 . 04 (S_ALR_87013558 - Budget/Actual/Commitment/Rem Plan/Assigned ), and the PR amount. Available Budget should be more than PR amount. Based on the tolerance limits set for the  budget profile, maintain the Current Budget with budget updates and try to create a PR accordingly.
    Hope this solves your problem !!
    Br
    Hari.
    Edited by: Hari Krishna Kudaravalli on Aug 20, 2009 3:25 PM

  • Runtime Error Project/WBS Element

    Hello,
    I am getting a Runtime error (statement message 'E') every time i search in the match code for either a Project or a WBS Element, regardless of what transaction they appear in.
    Can anyone help me with this?
    Stephen

    Did you make any changes to the project coding masks? This error could happen as result in changes to the mask. Project numbers which were valid as per earlier masks may not be fit as per new masks.
    If above is a reason implement the note 453280 - Conflicting coding mask and project/WBS element
    Regards
    Sreenivas

  • PS report: wbs element relation with PO, Pur Req. and vendor

    Hello,
    I need to build a report on WBS element which also shows PO number, Pur. Requisition, vendor details along with budget, actual, committements.
    I found datasources that can provide informations except PO, Pur Req.
    Can anyone help in providing a soln to build a relation between wbs and vendor to bring the correct PO and pur req related to wbs.
    Thanks
    Anima

    Hi Sushil,
    Which version of BW are you using?
    If its BW 7, then look at the datasource 2LIS_02_ACC
    http://help.sap.com/saphelp_nw04s/helpdata/en/ed/62073c44564d59e10000000a114084/frameset.htm
    Hope this help you
    Anima

  • WBS Elements upload with settlement rule& classification

    I have created project profile & WBS elements with a BAPI bapi_project_maintain.
    Now i need to apply characterstic values and settlement rules to those WBS elements.
    I have been searching for a FM since long time.
    I tried with LSMW also,it did not work.
    Only way left to me is to write a BDC programs to full fill this.
    If anybody has got some solution for this let me know.
    regards
    KTSS

    Sreenivas,
    I´m afraid that none of the 3 options is available via standard tools
    I´m so sorry.
    Rgds
    Martina

  • WBS element integration with Trade Claims Management Module

    Hi All,
    anybody knows if Trade Clams Management module of CRM is integrated with management of WBS elements?
    We actually want to post the amounts paid to customers through Trade Claims Management into CO-PA; we're trying to understand if using WBS element is a viable solution. Moreover if this is the case i'd be curious also to understand how COPA posting of accruals would work.
    Regards
    C

    m

  • Update termination error "Enter WBS element" while confirming Tranfer Order

    Hi Gurus,
    I am getting an update termination "Enter WBS element" while confirming Transfer Order. One thing that i noticed is that this issue is occuring with line items that are having special stock indicator "K".
    Please let me know as to what could be root cause and how could this be avoided.
    Do let me know for any clarification.
    Regards,
    Trishul

    Any suggestions?
    Regards,
    Tanuj Parikh

  • Validating department in WBS element code with dept in Investment program

    Hello Guru's,
    While assigning Investment program, in WBS  in CJ20N or CJ11, in our current business process we need to to validate the Department code in both WBS code and Investment program code.
    At present we have planned to used same department code in WBS Code and Investment program code.
    Need to to do this enhancement for our current project.
    Please suggest the way to do it.
    Regards,
    Amlan

    Hi,
    I assume this "Department Code" is one of your customer specific field that is made available both in WBS as well as the iM program. If that is the case then either you can use any of the user exits for the WBS Elements to write your code or create a validation for the WBS and put your code in one of those exits invalidation.
    Regards
    Sreekanth

  • XML parser error; when XPath elements starts with "_"

    Hi,
    I have a problem in extracting elements from XML which is starting with "_". please check the queries below executed on Oracle 10g.
    Query 1:
    SELECT EXTRACTVALUE(XMLTYPE('<A><_B>1</_B><_C>2</_C><_D>3</_D><E>4</E></A>'),'/A/_B') FROM DUAL;
    Error starting at line 1 in command:
    SELECT EXTRACTVALUE(XMLTYPE('<A><_B>1</_B><_C>2</_C><_D>3</_D><E>4</E></A>'),'/A/_B') FROM DUAL
    Error report:
    SQL Error: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/A/_B'
    31011. 00000 - "XML parsing failed"
    *Cause:    XML parser returned an error while trying to parse the document.
    *Action:   Check if the document to be parsed is valid.
    Query 2:
    SELECT EXTRACTVALUE(XMLTYPE('<A><_B>1</_B><_C>2</_C><_D>3</_D><E>4</E></A>'),'/A/E') FROM DUAL;
    EXTRACTVALUE(XMLTYPE('<A><_B>1</_B><_C>2</_C><_D>3</_D><E>4</E></A>'),'/A/E')
    4
    Oracle version:
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Please let me know if there is any workaround for this.*
    Thanks,
    Veerababu Kanumilli.

    Hi MichaelS,
    - I have executed the queries provided by you, but I am not able to get the result in 10g when I am trying to access elements with "_" in XPath.
    select * from v$version where rownum = 1;
    select extractvalue (xmltype ('&lt;A&gt;<_B>1</_B><_C>2</_C><_D>3</_D><E>4</E>&lt;/A&gt;'), '/A/_B') "_B" from dual;
    select extractvalue (xmltype ('&lt;A&gt;<_B>1</_B><_C>2</_C><_D>3</_D><E>4</E>&lt;/A&gt;'), '/A/E') "E" from dual;
    Output:
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    Error starting at line 4 in command:
    select extractvalue (xmltype ('&lt;A&gt;<_B>1</_B><_C>2</_C><_D>3</_D><E>4</E>&lt;/A&gt;'), '/A/_B') "_B" from dual
    Error report:
    SQL Error: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/A/_B'
    31011. 00000 - "XML parsing failed"
    *Cause:    XML parser returned an error while trying to parse the document.
    *Action:   Check if the document to be parsed is valid.
    E
    4
    Thanks,
    Veerababu Kanumilli

  • Error in WBS Element Hierarchy load after ECC 6.0 Upgrade

    Hi All,
    After ECC 6.0 Upgrade in R/3, we are doing test load in a Test server. While doing, we have encountered an issue with 0WBS_ELEMENT Hierarchy load. The message in the monitor is like below.
    "Node ID 00014240 has not been included in the hierarchy
    Message no. RH207"
    When I run the same hierarchy in another system which is not upgraded , it works fine.
    Anybody has faced similar kind of issues and can throw some light on this issue?
    Thanks,
    Mohan

    Try activating the Heirarchy in R/3 and re-trigger the load, error is very specific to structure of the hierarchy. there is a possibility that this Hierarcy could have got inconsistent after the upgrade.
    Thanks,
    Amit

  • Wbs element show with '/'

    i have zprojn type projn(i tried ps_pnr too)
    and after i made conversion func i see my number is==004800
    but i need to see it like this 4/008 or 4.800  how i can do it???

    Dear Szymon,
    this the setting of allocation structure
    Assignment 10
    Source
    Settle Cost Element
    Assignment 30
    Source
    Settle Cost Element
    need your advice.
    Thank you,
    Iwan S

  • Error while creating WBS element.. regarding source structure

    I am creating a project and then a WBS element. Its a investment project. While creating WBS element XXX, it gives me error that "WBS element XXX: SOurce assignments for source structure A1 missing in Investment Profile ZZZZZ."
    What shall I check? what could be the reason?
    Thanks,
    A

    hi,
    In this IMG activity, you define the source structures used when settling and costing joint products.
    A source structure contains several source assignments, each of which contains the individual cost elements or cost element intervals to be settled using the same distribution rules
    Just consult with your CO Consultant...
    Venkatesh

  • Error in creating WBS element BAPI_BUS2054_CREATE_MULTI

    Hi
    I am calling BAPI_BUS2054_CREATE_MULTI  for creating WBS elements for the blocked project . I am passing the detailed project definitiion with level ( like A5/01/01) . I am getting error that WBS element for the object could not be created  error 076 that BAPI is not initialized .
    Now to solve this I called BAPI_PS_INITIALIZATION first then am calling BAPI_BUS2054_CREATE_MULTI then its throwing dump  and if I want to run thru se37 then still giving the same error mentioned above
    Please let me know what should I need to do to remove the error .
    Helpful answer will definetly ..
    Thanks a  lott in advance

    Hi ,
    I want to create a WBS element using the BAPI's  BAPI_BUS2054_CREATE_MULTI .
    I did this sequence of test  :
    BAPI_PS_INITIALIZATION
    BAPI_BUS2054_CREATE_MULTI
    And I have this return
    S    CNIF_PI              004     Individual check for creating the object WBS Element U008-F033-001 required    
    CAn you tell me what to do in order to resolve this problem ( calling a commit after this sequence leads to 'DUMP' bacause no precommit is called before )
    can u send me a code Plz...
    Thanks in advance

Maybe you are looking for

  • Export To Excel in new popup window

    Hi all, I am trying to implement the 'exportToExcel' functionality in which will open a XL file in a new window(which has to be the MS EXcel window,not the browser).My code snippet is as follows: public ModelAndView exportToExcel(HttpServletRequest r

  • Scrolling data in a region

    Hi, Is there any way to have true scrolling of the data output of a region? Using region header footer div tags isn't really scrolling the data itself, just the first set. I still have to use the pagination options (which don't include scrolling). I'

  • How to activate BADI

    Hi Experts, I already implement BADI ZBBP_CREATE_BE_PO_NEW, but i've got problem in activating it. when i click activate button, object is activate, but if i move to other screen and back to BADI screen, object back to inactive status. please advise

  • Imovie was unsaved and needs to be recovered how do i do this?

    Hi I really need help a big project I was working on for days in imovie suddenly malfunctioned and I really really need to recover it please i need help with this i would really apericiate it!!!!!!!

  • How do I burn a BDMV Folder onto a Blu-Ray Disc on my Mac os 10.8.3?

    How can I burn a BDMV Folder to a Blur-Ray Disc on my Mac osx? Do I need 3rd Party Software? If so, which one? I built it in Encore CS 5 Thanks. Mac Pro Intel Xeon Mac OS 10.8.3 10 Gb RAM