Macro swc_set_objectkey in ABAP Class

Hello,
I want to use macro swc_set_objectkey in ABAP class.  macro swc_set_objectkey is present in include <object>. I can not include <object> in ABAP class because it gives syntax error "You may only define classes, interfaces, or types in a CLASS-POOL". Can you please let me know what should be done in this case ?
Edited by: Ashwin Sonkusare on Apr 6, 2011 1:55 PM

Hi Rick,
Is possible to use macros in abap classes ,
review link
http://help.sap.com/saphelp_nw70/helpdata/en/c5/e4b130453d11d189430000e829fbbd/frameset.htm
Regards.
maopacheco.

Similar Messages

  • ABAP Classes & Macros ( CNTN02 & CNTN03 )

    Good day
    Background:
    Inside a Workflow BADI (def BBP_WFL_APPROV_BADI ) implementation. I need get approval agents by to evaluating Rule (eg: AC9000001).
    I found SAP Help (link below) which says I can use <CNTN02> & <CNTN03> "To use the macros in ABAP classes, the include files <CNTN02> and <CNTN03> must be included. In the Class Builder, include the include file <CNTN02> by choosing Goto >> Class Local Types >> Macros. Include the include file <CNTN03> by choosing Goto >> Class Local Types >> Local Class Definitions/Types."
    [SAP Help -- To use the macros in ABAP classes|http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4b130453d11d189430000e829fbbd/frameset.htm]
    Problem:
    The option Goto >> Class Local Types >> Macros  is greyed out. Means I cannot include <CNTN02>
    The option Goto >> Class Local Types >> Local Class Definitions/Types is available and I can enter <CNTN03> as per SAP Help
    Question:
    Has anyone come across this problem? How did you get past it?
    System:
    SAP_ABA      640 level 18
    SAP_BASIS   640 level 18

    Hi,
    This is still the approved method so stick with this.
    It works perfectly ok so there is no view to changing it.
    Cheers
    Colin

  • Create Attachment in workflow through ABAP Class in ECC 5.0

    Hi,
    Wr are using SAP ECC 5.0 and i am trying to create attachment through ABAP class.
    Here in ECC 5.0, macro INCLUDE cntn01_swc is not available.
    I am getting an error in declaration of SOFM object, because again SWC0_OBJECT is not available.
    I've tried creating the parameter as type SOFM and of type table of SOFM but it also not working.
    Can anybody help me how i can create SOFM instance in ABAP class in ECC 5.0?
    Regards,
    Smit

    Hi
    I am not very much sure about ECC 5.0 environment. Firstly are you looking to create a SOFM object inside any class or program or Function module , If yes then you need to include a include INCLUDE CNTN01_SWC (No arrow brackets) if this include is not available then use INCLUDE<CNTN01>  then declare a variable of type SWC0_OBJECT if you are using first include or declare of type SWC_OBJECT.
    Once you include any of the includes then by making use of SWC macros you can create a object
    SWC0_CREATE_OBJECT <VARAIBLE> <BOR NAME> <BORKEY> for first include.
    SWC_CREATE_OBJECT <VARAIBLE> <BOR NAME> <BORKEY> for second include.
    Regards
    Pavan

  • ABAP Class reference in persistent container

    Hi all,
    Has anyone ever tried to read an abap class reference from a rule container in the rule's function module?
    This doesn't seem to work, unless I am doing something wrong...
    Here is the scenario:
    I have an abap class ZCL_CLASS instantiated in my workflow container. In one of my workflow steps I pass that class object reference to a rule (Function Module based). In the rule function module I use macro swc_get_element to try to get the class object reference. And there it is not getting anything.
    I have already tried the following:
    - Try to run macro swc_container_to_runtime on the rule container before retrieving the object reference -> doesn't work. The internal table ac_container doesn't even look different before and after having run this macro.
    - Try to replace the declaration of include <CNTN01> by <CNTN02> + <CNTN03>. Doesn't change anything either.
    When I look at ac_container in debugging it seems my object reference is there but looks a bit strange:
    ELEMENT | TAB_INDEX | ELEMLENGTH | TYPE | VALUE
    WFIBF_PORTAB | 000011 | 004 | u | SWFTSTRUCT
    WFIBF_PORTAB | 000012 | 032 | C | STEP
    WFIBF_PORTAB | 000014 | 032 | C | 1CCC1000C
    WFIBF_PORTAB | 000015 | 104 | C | <object key>    <class>    CL
    Any idea of how I should proceed to retrieve my object reference?
    For the moment the workaround I found is to pass the object key to the rule and to reinstantiate the class in the rule function module. Not a very elegant solution...
    Thanks in advance and kind regards,
    Patrick

    Hi Mike,
    I understand what you're saying. But the problem is that the swc_get_element macro does not even get me the LPOR value, and therefore I can't call the FIND_BY_LPOR method.
    That means I have two solutions:
    - Passing the LPOR instead of the object reference to the rule container => Not a very nice solution, for many different reasons.
    - Find an alternative to swc_get_element to get the LPOR value.
    I had a look at class cl_swf_cnt_container, and it seems it can do the trick for me.
    So what I will finally do is:
    1. Convert the BOR container into an instance of cl_swf_cnt_container.
      DATA: lo_cnt    TYPE REF TO if_swf_cnt_container,
                 lt_container TYPE swconttab.
      lt_container[] = ac_container[].
      TRY.
          CALL METHOD cl_swf_cnt_container=>if_swf_cnt_conversion~create_from_bor_container
            EXPORTING
              values                = lt_container
            RECEIVING
              container           = lo_cnt.
        CATCH cx_swf_utl_obj_create_failed.
      ENDTRY.
    2. Get my container element.
    DATA: lo_myobj TYPE REF TO zcl_class.
    CALL METHOD lo_cnt->if_swf_ifs_parameter_container~get
      EXPORTING
        name       = 'MyContainerElement'
      IMPORTING
        value      = lo_myobj
    I didn't take the time to debug that deep in the standard SAP code, but I assume the if_swf_ifs_parameter_container~get re-instantiates my class for me.
    Please feel free to comment.
    Kind regards,
    Patrick

  • Include in ABAP class for Workflow

    Hi,
    In order to use BOR macros inside ABAP class, (From SAP help) came to know that we need to use include <cntn02> .
    How to add this include to ABAP class for workflow?
    Regds,
    Akshay

    Hi Akshay,
    Slight difference, I said "keeping the class clean of BOR <i>code</i>". By all means use BO's in the class: basically create a ZCL_MATERIAL, and use BUS1001 as an attribute (I use a naming convention BO_* for these). As long as it's the right type (SIBFLPORB I think - no system handy right now), and the key values are populated correctly the system will instantiate it as necessary. So in WF I can refer to ZCL_MATERIAL.BO_MATERIAL whenever I need any of the BO's functionality.
    You are correct though, creating a proper business class which you can instantiate such as material does involve a fair bit of effort and coding to set up. e.g. my last project I ended up creating one ZBOR subtype because all I needed was one new attribute - definitely not worthwhile creating a new class for. (USR01.zEmailAddress for what it's worth).
    I've said before somewhere, it's not without pain, so if you're under time pressure etc, then it may be better to do whatever's quickest. There's nothing wrong with using BOR macros, it will still work for quite a few versions. I just meant to say that pure class(y) code is a preferred way to go if it makes sense to do so. This is not always the case.
    Hope that helps,
    Mike

  • Binding ABAP Class Attribute with BUS2038 in a Standard WF task

    Hi,
    I need help as mentioned in the subject line.
    In my standard task I am capturing event for BUS2038. In the General tab I have a ABAP class which has implemented IF_WORKFLOW. From BUS2038 I just need notification number.
    Since my source is a BO and my target is a class. How do I make this conversion and pass the data to my class?
    I know there are several solution but none have solved my concern.
    Thanks,
    Sridhar Karra.

    Hi,
    If you want to access teh attributes of the BOR inside a class emthod then you have to make use of teh MACROS.
    1. include INCLUDE CNTN01_SWC  in the class local macros section. and in the type groupsof the class include SWC0.
    2. Now if you know the key of the BOR instance then create a BOR object inside the class method as below
    DATA lo_object   TYPE SWC0_OBJECT.
    SWC0_CREATE_OBJECT lo_object '<BUSXXXX>' '<Key of the BOR>.
    the above line will create the instance of the bor inside the class method
    now inorder to access the attributes of the BOR  use the below code
    DATA lv_notif_no   TYPE  <type of the notification>.
    SWC0_GET_PROPERTY lo_object '<ATTRIBUTE NAME> lv_notif
    In this way you can access the BOR attributes inside a class method.
    Regards
    Pavan
    Edited by: Pavan Bhamidipati on Dec 15, 2011 11:01 PM

  • ABAP class mapping in PI (7.0)

    I just switched from XI (3.0) to PI (7.0).
    I tried to move one of my interfaces, but in Interface Mapping there is no "ABAP-class" option. How to use ABAP mapping in PI?

    Hi Mariuszu
    you need to enable it as described here
    in the exchange profile
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    or you can ask us directly via mail
    Regards,
    michal

  • Shooping cart creation in SRM 7.0 using web dynpro ABAP classes.

    Hi,
    We have recently upgraded to SRM 7.0 from SRM 4.0. We are using customized portal application for the creation of the shopping cart.I am planning to create custom FM which will use the standard Web dynpro ABAP classes to create the shopping cart.
    Could you please guide with the classes that are need to be implemented and the sequence of the classes used in the shopping cart creation.
    I think these are the classes that are used in the standard web dynpro ABAP component.
    CL_FPM_EVENT ->                  Creates an instance of this class based on an event ID.
    CL_BADI_FLT_DATA_TRANS_AND_DB -> Data Handling: Transport and Database.
    CL_EXITHANDLER ->               Class for Ext. Services Within Framework of Exit Technique.
    CL_EX_BBP_DOC_CHANGE_BADI ->     BAdI Class CL_EX_BBP_DOC_CHANGE_BADI.
    CL_BBP_OBJECTS_ACCESS ->         Access Functions for Object Types.
    /SAPSRM/CL_PDO_BO_SC ->          Shopping Cart BO.
    Your expert comments will be appreciated...
    Regards,
    Naresh

    Dear Poster,
    As no response has been provided to the thread in some time I must assume the issue is resolved, if the question is still valid please create a new thread rephrasing the query and providing as much data as possible to promote response from the community.
    Best Regards,
    SDN SRM Moderation Team

  • File to Proxy Scenario using ABAP Class and DB Multi Connect

    Hello Friends,
    I have a scenario below and a proposed solution. I would like some input as to whether i am headed the right way.
    Scenario: Thousands of records come in from the legacy accounting system. The fields of these records need to be mapped to SAP fields using cross-reference tables stored in DB2. Finally, summarize the records by deleting a few fields and feed to R/3.
    Solution i proposed:
    (1) File Adapter is used to send the file
    (2) Although JDBC adapter comes first to mind but since i need to access the DB2 tables multiple times for each record i propose to use an ABAP class for the mapping. Within the ABAP class the intent is to open an database connection to DB2, read the relevant cross tables using native SQL and finally generate the output XML.
    (3) Reciever is Proxy which feeds this generated XML to SAP for creating posting via BAPI_ACC_DOCUMENT_POST
    Question: Is the above solution correct or is there a better method to implement this scenario?
    Please let me know.
    Thanks,
    Minhaj.

    Looks fine. Few observations -
    1. Whether it is ABAP class or Mapping in RFC lookup, you are making multiple trips to the database.
    2. It looks like PI is being used only for reading the file and converting it to XML.
    3. If using PI is not mandatory, then a complete ABAP class on ECC it self would be faster than swtching between PI Java, PI ABAP then round trips to DB2 finally data push to ECC.
    If you could look at something like fetching all the required RFC look up data in one go and then map the fields according, might save u on processor and network resources.
    VJ

  • ABAP Class not displaying in operation mapping.

    HI,
    I have created abap class using se24 for throwing exception message in sxmb_moni, this abap class needs to be called in operation mapping, even though i have activated this abap class in PI environtment, i couldnt see the abap class option in the operation mapping.
    Could any one please let me know any change profiles requirements are required,
    Thanks,
    --Sai

    Hi Sai,
    Yes, you do have to register ABAP Class Mapping in the Exchange Profile to see this option in the Operation Mapping. Follow these step-by-step configuration guidelines:
    http://www.riyaz.net/sap/xipi-how-to-register-abap-mapping-in-exchange-profile/624/
    Hope this helps,
    Greg

  • Calling Portal event from ABAP class

    Hi Experts,
    I need a following clarificatrion, Please help,
    1. Is it possible to call a webdynpro method from a normal ABAP class?
    2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    3. Is there any ways with which we can call portal event from ABAP class?
    Thanks,
    Shabir

    >1. Is it possible to call a webdynpro method from a normal ABAP class?
    I wouldn't necessarily recommend this approach. You shouldn't try to trigger events or any of the standard WDDO* methods from outside the WD Component itself.  That said, you can pass the object reference (like the WD_COMP_CONTROLLER object reference or the View Object Reference) into methods of normal classes.  Be careful if you are finding yourself calling a lot of your added methods from outside WD.  This is probably a sign that these methods should be in the Assistance Class or some other Class functioning as a Model Object.
    >2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    What exactly do you want to do here?  Do you just want to get the relaxation script?  For what purpose?  You should never need to inject the relaxation script into WDA. 
    >3. Is there any ways with which we can call portal event from ABAP class?
    To what purpose.  Do you just want to delegate the triggering of the event that is inside WD Component to be called from a class?  If so you can pass the portal API object reference into a class from the WD Component.  However this only works while running within WD.
    How is this class used?  Are you running in WD?  Are you trying to generate some HTML code that runs in the portal independent of WD?

  • Macros In HR ABAP

    Hi Everyone,
       We can filter the records when we are using provide.
    Example - provide........
              where .....
       Can we filter the records when we are using macros for example - rp_provide_from_last.
      Please let me know.
    Regards,
    Sandy

    Hi Dude,
    Macro contains some part of source code which it will be useful for number of applications.( Like function modules ).  It already holds the data.. you can not doo may modification to that.. by using the begin date and end date you can do filter the records..
    Generally we use two macros in HR ABAP
    1. RP-PROVIDE-FROM-LAST
    2. RP-PROVIDE-FROM-FRST
    The macro RP-PROVIDE-FROM-LAST retrieves the last(latest) data record which is valid in the data selection period.
    The macro RP-PROVIDE-FROM-FRST retrieves the first(start)data record which is valid in the data selection period.
    Macros can only be used in the program the are defined in and only after the definition are expanded at compilation / generation. Subroutines (FORM) can be called from both the program the are defined in and other programs
    Ex :
    Tables : PERNR.
    INFOTYPES : 0001,0002.
    Start-of-selection.
    Get PERNR.
       RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
       Write : / P0001-PERNR.

  • TYPES statement in abap class to include structure

    hi ,
    i have declared following in a abap class...
    TYPES:
          zts_alv_line TYPE zmat_pr_costest_alv.
         TYPES:BEGIN OF ts_alv_line,
                include type zts_alv_line,
                matkl type mara-matkl,
                t023t type t023t-wgbez,
                lvorm type mara-lvorm,
                end of ts_alv_line.
         TYPES: tt_alv_data TYPE STANDARD TABLE OF ts_alv_line WITH DEFAULT KEY.
         DATA:
          alv_data TYPE tt_alv_data.
    now while refering to alv_data-matnr the sap is giving error that this component does not have matnr.
    please help.
    Edited by: Suhas Saha on Feb 3, 2012 1:11 PM

    TYPES: zts_alv_line TYPE zmat_pr_costest_alv.
    TYPES:BEGIN OF ts_alv_line,
                include type zts_alv_line,
                matkl type mara-matkl,
                t023t type t023t-wgbez,
                lvorm type mara-lvorm,
                end of ts_alv_line.
    Actually by defining this you've defined include as field of ts_alv_line. Actually ts_alv_line is a nested structure.
    I think you need to re-define the structure definition as:
    TYPES:BEGIN OF ts_alv_line.
          INCLUDE TYPE zts_alv_line.
    TYPES: matkl TYPE mara-matkl,
           t023t TYPE t023t-wgbez,
           lvorm TYPE mara-lvorm.
    TYPES: END OF ts_alv_line.
    BR,
    Suhas

  • Error handling in Abap Class for SAP Workflow

    Hi Experts,
    I would like to know if we have an option in abap classes used in workflows to send errors to the workflow log. We can achieve this in BOR Object methods by using the EXIT_RETURN <CODE> var 1 var 2 to send the errors back to the workflow, but how is this achieved through methods from classes  used in workflows.
    Appreciate your quick responses,
    Chaitanya

    Just raise exceptions in the normal OO way. Any exception that is a subclass of CX_BO_ERROR should be automatically available in workflow. Use subclasses of CX_BO_TEMPORARY for temporary errors.

  • How to Handle Business Object event in ABAP class

    Hello Everybody,
    I wanted to know if it was possible to reference BOR objects in ABAP class and handle BOR events in ABAP Objects.
    Thanks in advance.

    Hi,
    Catch the et_VALIDATE event, when InnerEvent = False and ItemChanged = True.
                If pVal.EventType = BoEventTypes.et_VALIDATE Then
                    If pVal.InnerEvent = False And pVal.ItemChanged Then
                        'TODO Your code here...
                    End If
                End If
    Regards,
    Vítor Vieira

Maybe you are looking for

  • Can't mount Adobe Flash dmg on OSX 10.6.7

    I can't mount the dmg file after I download the Adobe Flash 10.3.181.34. I got a brand new MacBook Pro with OSX 10.6.7. I can install every other program I download, the problem seems to persist only with Adobe Flash.. Any ideas?

  • Muse problems after update...

    I updated my Muse CC application and after the update, I tried to open up the program and I received an error. Something to the effect of some install or update files didn't properly install and then I was no longer able to use Muse. I tried to re do

  • Qualifed update is deleting exising records

    Hello, We recently installed MDM 5.5 SP06 Patch03 Release (Note 1234675) and now I cannot use Import Manager to update fields on a Qualified records.  The was working perfect prior to this patch. Issue:   Qualified table is Partner Functions Non Qual

  • HD showing 74.21GB when it is a 110GB Drive

    After using my MacPro for about 6 months I noticed the overall space on my HD decreasing. I am not talking about space available but overall capacity. Info is now telling me that my 110GB drive is 74.21GB. I have run Disk Utility and everything was r

  • Notice from websites that I need to upgrade my browser: I have a macbook pro, version 10.6.8 What do I need to do here?t

    I've started receiving alerts from websites like Pandora , et al that might browser needs to be updated. What to do? Does this require a new version of Safari? If so is there anything else I need to be doing or installing for compatibility? Model Nam