SWC_get_property

I coded following to find the AGENT but anyhow its not working.I able to test object T024D with same object key in SWO1 but its not working in my report.
types: begin of ty_objectkey1,
Plant type WERKS_D,
Controller type DISPO,
end of ty_objectkey1.
data: ls_objectkey1 type ty_objectkey1 .
data: lf_T024D type SWC_OBJECT.
lt_agent TYPE SWP_AAGENT,
ls_objectkey1-plant = '5002'.
ls_objectkey1-Controller = 'B30'.
SWC_CREATE_OBJECT lf_t024d 'T024D' ls_objectkey1.
SWC_get_property lf_t024d 'Agent' lt_agent.

It corrects this line of the code :
Incorrect
  - SWC_get_property lf_t024d 'Agent' lt_agent.
The "Agent" attribute does not exist and yes the "Agents".
correct
If sy-subrc is initial.
- SWC_get_property lf_t024d 'Agents' lt_agent.
endif.

Similar Messages

  • Swc_get_property Issue

    Hi,
    I am having a problem in getting attribute data of the Business object.
    I am using swc_get_property. Please explain the parameters I need to pass. Also please tell me the definitions.
    KK.

    Parameters of Get Property
    Parameters: P1   Object Reference,  Input
                P2   Attribute Name, Input
                P3   Value of the attribute, Output
    Examples how to call:
    SWC_GET_PROPERTY SELF 'Owner'        DOMINANT-OWNER.
    swc_get_property self 'SalesDocument' salesdocument.
    swc_get_property salesorganization         
                     'SalesOrganization'       
                     verkaufsorganisation-vkorg.
    How to use:
    - Have a look into the program of OBject VBAK method Complete_rejection
    - the part get_property companycodecurrency changing container.
    Regards,
    JG

  • Can't send smartform to external mail address

    Hi, everyone.
    Now, after creating some self-defined smartforms, we want to send its
    PDF copy to
    our external mail address. From this point, I had some try.
    Reference to SAP Library, I make a testing program named 'YPDF_TEST'.
    However, one exception always exists when running and error message id
    is 'XS806' - means
    "No delivery to &, invalid recipient address"
    I filled the address with following fields.
    [ dev_mail_recipient-logsys = 'CLNT600'.
    dev_mail_recipient-objtype = 'RECIPIENT'.
    dev_mail_recipient-objkey = '[email protected]'. ]
    I just can't understand the real reason why it doesn't work.
    Through debugging, I found the error occurs when handling the following
    codes
    in function "SX_ADDRESS_TO_DEVTYPE".
    [ swc_create_object o_recipient 'RECIPIENT' recipient_id-objkey.
    swc_get_property o_recipient 'CommunicationType' m_recipient-type.
    get_property_longvalue o_recipient m_recipient-address. ]
    On the current situation, if can't come over this problem,
    we may not build the connection and don't provide information in time.
    Failed to send, I yet try another function - added the tail but on earthdidn't get it ~~~
    Would you give me some hints or advice ?
    Any help is appreciated.
    ====================
    <i>REPORT ypdf_test .
    DATA: fm_name TYPE rs38l_fnam.
    DATA: my_control_pars TYPE ssfctrlop. "for CONTROL_PARAMETERS
    DATA: my_output_info TYPE ssfcrescl. "for JOB_OUTPUT_INFO
    DATA: output_options TYPE ssfcompop.
    DATA: e_devtype TYPE rspoptype.
    DATA: gw_lcprint TYPE ziebsflc001.
    DATA: bin_file TYPE xstring,
    bin_filesize TYPE i,
    ndiv TYPE i, offset TYPE i,
    nmod TYPE i.
    DATA: BEGIN OF bin_table OCCURS 0,
    x TYPE xstring,
    END OF bin_table.
    DATA: lines LIKE tline OCCURS 0.
    DATA: dev_mail_sender LIKE swotobjid, "B20K061818
    dev_mail_recipient LIKE swotobjid.
    DATA: dev_mail_applobj_tab LIKE swotobjid OCCURS 10 WITH HEADER LINE.
    DATA: param LIKE itcpp.
    my_control_pars-no_dialog = 'X'.
    my_control_pars-getotf = 'X'.
    Get genereated function name of Smartform
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZDEMO_SMART_FORM_PPF'
    IMPORTING
    fm_name = fm_name
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    ENDIF.
    Get Device type
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
    EXPORTING
    i_language = sy-langu
    I_APPLICATION = 'SAPDEFAULT'
    IMPORTING
    e_devtype = e_devtype
    EXCEPTIONS
    no_language = 1
    language_not_installed = 2
    no_devtype_found = 3
    system_error = 4
    OTHERS = 5 .
    IF sy-subrc <> 0.
    ENDIF.
    output_options-tdprinter = e_devtype.
    set needed mail option
    my_control_pars-device = 'MAIL'.
    dev_mail_sender-logsys = 'CLNT600'.
    dev_mail_sender-objtype = 'RECIPIENT'.
    dev_mail_sender-objkey = 'CHI_DEV03'.
    dev_mail_recipient-logsys = 'CLNT600'.
    dev_mail_recipient-objtype = 'RECIPIENT'.
    dev_mail_recipient-objkey = '[email protected]'.
    CALL FUNCTION fm_name
    EXPORTING
    control_parameters = my_control_pars
    mail_recipient = dev_mail_recipient
    mail_sender = dev_mail_sender
    output_options = output_options
    ip_carrid = 'ID'
    ip_connid = '8290'
    ip_fldate = sy-datum
    ip_bookid = '12345678'
    ip_customid = '09876521'
    ip_luggweight = 90
    ip_wunit = 'KG'
    ip_smoker = 'X'
    IMPORTING
    job_output_info = my_output_info
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Another try ***
    *DATA: param LIKE itcpp.
    *DATA: BEGIN OF off_obj.
    INCLUDE STRUCTURE soodk.
    *DATA: END OF off_obj,
    ok TYPE c,
    msgid TYPE symsgid,
    msgno TYPE symsgno,
    msgv1 TYPE symsgv,
    msgv2 TYPE symsgv,
    msgv3 TYPE symsgv,
    msgv4 TYPE symsgv.
    *DATA: dev_mail_applobj_tab LIKE swotobjid OCCURS 10 WITH HEADER LINE.
    *CALL FUNCTION 'CONVERT_OTF_AND_MAIL'
    EXPORTING
    mailoptions = param
    mail_sender = dev_mail_sender
    mail_recipient = dev_mail_recipient
    IMPORTING
    office_objid = off_obj
    mail_ok = ok
    msgno = msgno
    msgid = msgid
    msgv1 = msgv1
    msgv2 = msgv2
    msgv3 = msgv3
    msgv4 = msgv4
    TABLES
    mail_application_object_ids = dev_mail_applobj_tab
    otf = my_output_info-otfdata.</i>

    Hi,
    You can follow a different approach. Send the output of the Smartform to the spool.
    You have a Function Module to read the spool and convert it to PDF . Then there is one more function module to attach the PDF and send it as a mail.
    You need to configure SMTP in Tcode : SCOT.
    Search the forum with emailpdfattachment
    You have umpteen postings available.
    Pls reward if useful.
    Regards,
    Laxman Nayak

  • Urgent help req : work item id not getting passed in the method

    Hi ,
    I have created a subtype zcats of business object CATS and delegated it .
    I have created a new method Approve1 ( with attributes  SYNCRONUS & DIALOG )  in zcats which is similar in coding  to Approve method of CATS ( DIALOG) .
    I have include the method Approve1 of business object zcats in a standard task .
    The problem is that when the eorkflow gets triggered ,  the workitem id is not getting passed in the method APProve1 of zcats.
    Can someone please help me with this .
    Points would surely be awarded .

    BEGIN_METHOD APPROVE1 CHANGING CONTAINER.                 
      DATA: WORKITEMID_IMP LIKE OBJECT-KEY-ITEMID.              
      DATA: WI_CHCKWI LIKE SWWWIHEAD-WI_ID.                     
      DATA: WORKITEM TYPE SWC_OBJECT.                           
       <u> WORKITEMID_IMP = OBJECT-KEY-ITEMID</u>.                     
        SWC_GET_ELEMENT CONTAINER '_WORKITEM' WORKITEM.         
        SWC_GET_PROPERTY WORKITEM 'WorkitemReference' WI_CHCKWI.
        IF SY-SUBRC EQ 0 AND NOT WI_CHCKWI IS INITIAL.          
          WORKITEMID_IMP = WI_CHCKWI.                           
        ENDIF.                                                  
        CALL FUNCTION 'CATS_WF_APPROVAL'                        
          EXPORTING                                             
            WORKITEMID_IMP = WORKITEMID_IMP                     
          TABLES                                                
            CONT_IMP = CONTAINER.                               
      END_METHOD.                                               
    hi ,
    the above is the code in the method .
    At the first step of execution underlined above , the work item id is appearing blank .
    I think that the value is not passed to the container , but i am not sure og how to pass data to this conatiner

  • Workflow for training and event management

    Hi,
    I have to develope a workflow regarding event type prebooking whic will be pre-booked thru pv02 , now my requirement is to send a workitem text  to manager ess account  who will appprove or reject this event type.
    After approval it shud make updation in database but not in the case of   rejection .After that Manager preebook a event for those who are alredy approved for the same event type and after event booking it shud also update the attendance table or infotype . 
    Thanks .

    Hi,
    Set the Values to the Business Object container
    SWC_SET_ELEMENT CONTAINER   'profit'  profit.
    Read the Values in the attribute
    swc_get_property SELF 'TravelerName'  Lv_traveller
    Also refer this [Link|https://wiki.sdn.sap.com/wiki/x/moOmAw]
    Regards,
    Surjith
    Edited by: surjith kumar on Mar 26, 2009 9:45 AM

  • Syntax for retrieving data from a task container

    Hello Workflow Fans !
    I have a Task with the following configuration:
    BASIC DATA - Object Method :
    Object Category: BOR Object Type
    Object Type: ZBusObj1
    Method: 022_Data_Upd
    CONTAINER :
    I have added a second BOR Object in the container called ZBusObj2
    In conclusion, when the task is executed within my WF run, the method ZBusObj1.022_Data_Upd is executed and both business objects (ZBusObj1 and ZBusObj2) should be available in my Task container.
    My question:
    How, in my method 022_Data_Upd, can I retreive (get) the value of the ZBusObj2 key field (Customer No)?
    Here is what I tried... obviously... without any success:
    BEGIN_METHOD O22_Data_Upd CHANGING CONTAINER.
      break-point.
    * Variable declarations
      DATA: lva_Risk_Cat    TYPE ZTCOMP_PDV-CTLPC.
      DATA: lva_Montant_V TYPE ZTCOMP_PDV-MONTANT_V.
      DATA: lva_Custno       TYPE KNA1-KUNNR.
    * Data retreival from the task container 
      SWC_GET_PROPERTY self 'RiskCategory' lva_Risk_Cat.
      SWC_GET_PROPERTY self 'MONTANT_V'    lva_Montant_V.
      SWC_GET_ELEMENT container 'ZBUSOBJ2.Customerno' lva_Custno.
    The last line (SWC_GET_ELEMENT...) is the one I'm strugling with...
    Any help will be appreciated.
    Thanks in advance.
    José

    So, my understading is that you need an instance of the second object OBJ2 inside the method of the first object OBJ1.
    First, if you only need the customer number, I recommend that you only pass the number itself. Here is what you need to do:
    1- Add an "Import" parameter to method 022_DATA_UPD and call it anything (I'll use PARAM): the parameter can be either an object or a field. You specify the type when you define the parameter. Parameters are added by "single" clicking the method name in SWO1 so that the pointer is on the method name then clicking the "Parameters" button.
    2- Inside the method, add the following code
    Case 1: parameter is an object
    DATA: lvo_custobj  TYPE swc_object.
    DATA: lva_custno TYPE KNA1-KUNNR.
    swc_get_element container 'PARAM' lvo_custobj.
    swc_get_property lvo_custobj '<CUSTOMER_NUMBER_PROPERTY_NAME>' customer_number.
    Case 2: parameter is just a field
    DATA: lva_custno TYPE KNA1-KUNNR.
    swc_get_element container 'PARAM' lva_custno.
    As you can see, adding only the customer number is easier to read. The method should work when you test it in SWO1 before you proceed into the next steps.
    3- Make sure the standard task calling the method is updated with the new parameter. Basically open the task in change mode and type an extra space in the description field then hit Enter. The system will ask you if you want to update the list of parameters.
    4- Update the binding of the task in the workflow template to pass either the customer object or customer number.

  • Can I write to a BO attribute straight from BO method-skipping container ?

    hi,
    We have created a single character virtual attribute in BO, we have created a method that will set the attribute to X if its blank and blank if its X.
    I have tried working with  object-attribute name but it does not set the values. I am trying to remove the container binding between method->task and task-->BO out of question by writing straight to BO.
    Is it possible ?
    thanks,
    GV

    You can code for Virtual attribute.
    You can call method using
    SWC_CALL_METHOD
    SWC_GET_PROPERTY
    Thanks
    Arghadip

  • How to put the sender name in the wf-system

    Hi,
    Can anybody pls tell me how to give the sender address in stead of WF-SYSTEM
    When ever a mail is triggered the mail is send to the mail inbox.in the mail inbox it is showing in the sender option : WF-SYSTEM...
    I want to put any name their .
    can i put any name their.
    please help me.....very urgent.
    For any clarification pls revert back.
    Thnks

    Hi,
    I've put the steps again here but this time I've put in Bold the lines that needs to be added in the different sources.
    • Copy the BO SOFM to ZSOFM
    And add to the method Send an import parameter
    SENDER like PA0105-USRID_LONG
    Then change the method SEND
    begin_method send changing container.                             
    data: result_object type swc_object.                              
    data: document_data  like sodocchgi1,                             
          document_type  like sofolenti1-obj_type,                    
          receivers      like somlreci1 occurs 1 with header line,    
          object_para    like soparai1  occurs 0 with header line,    
          object_parb    like soparbi1  occurs 0 with header line,    
          object_header  like solisti1 occurs 1 with header line,     
          object_content like solisti1 occurs 10 with header line.    
    data  folder_id      like soobjinfi1-object_id.                   
    data  new_object_id  like soobjinfi1-object_id.                   
    data  document_id    like sofolenti1-doc_id.                      
    data low_len like sy-tabix.                                       
    data  rcode          like sonv-rcode.                             
    <b>data : SENDER like pa0105-usrid_long.                             
    DATA : packinglist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.     
    DATA: tab_lines TYPE sy-tabix.                                    
    DATA : sender_address like SOEXTRECI1-RECEIVER.                   
    swc_get_element container 'SENDER' SENDER.       </b>
    * get receivers out of container                 
    perform extract_receivers tables receivers         
                                     container.        
    if object-key = space.                             
      * get document data out of the container       
      perform extract_document tables object_para      
                                      object_parb      
                                      object_header    
                                      object_content   
                                      container        
                               using  document_type    
                                      document_data.   
    <b>DESCRIBE TABLE object_content LINES tab_lines.     
    Packing List                                     
    CLEAR packinglist-transf_bin.                      
    packinglist-head_start = 1.                        
    packinglist-head_num = 0.                          
    packinglist-body_start = 1.                        
    packinglist-body_num = tab_lines.                  
    packinglist-doc_type = 'RAW'.                      
    APPEND packinglist.                                                                               
    move sender to sender_address. 
    * send document                                               
      call function 'SO_DOCUMENT_SEND_API1'                         
        exporting                                                   
          put_in_outbox = ''                                        
          document_data = document_data                             
          sender_address = sender_address                           
          sender_address_type        = 'SMTP'                       
          commit_work                = ''                           
       tables                                                       
          packing_list   = packinglist                              
          receivers      = receivers                                
          contents_txt   = object_content                           </b>   exceptions                                                    
          parameter_error = 23                                      
          too_many_receivers =  1                                   
          x_error =              1000                               
          operation_no_authorization =  13                          
          enqueue_error =     2                                     
          document_type_not_exist = 3                               
          document_not_sent =  15.                                  
      if sy-subrc ne 0.                                             
        exit_return 1023  document_data-obj_descr space space space.
      endif.                                                        
    * create now SOFM object of sent document                     
      if sy-subrc = 0.       
        perform insert_document_with_data using new_object_id        "870566
                                                document_data               
                                       changing folder_id                   
                                                rcode.                      
      else.                                                                 
        move sy-subrc to rcode.                                             
        exit_return 1900 'Document Insert' space space space. "#EC NOTEXT   
      endif.                                                                
    * create result element with object key                               
      if rcode = 0.                                                         
        perform create_result tables container                              
                              using folder_id                               
                                    new_object_id                           
                                    result_object.                          
        perform create_object using folder_id                               
                                    new_object_id.                          
      endif.                                                                
    else.                                                                   
      move object-key to document_id.                                       
      call function 'SO_OLD_DOCUMENT_SEND_API1'                             
           exporting                                                        
                document_id                =  document_id                   
                PUT_IN_OUTBOX              =                              
           IMPORTING                                                      
                SENT_TO_ALL                =                              
           tables                                        
                receivers                  =  receivers  
           exceptions                                    
                too_many_receiver          = 1           
                document_not_sent          = 2           
                document_not_exist         = 14          
                operation_no_authorization = 13          
                parameter_error            = 23          
                x_error                    = 6           
                enqueue_error              = 7           
                others                     = 1000.       
      if sy-subrc ne 0.                                  
        exit_return 1023  document_id space space space. 
      endif.                                             
    endif.                                               
    end_method.                                                                               
    • Copy the function SWW_SRV_MAIL_SEND to ZSWW_SRV_MAIL_SEND
    And add as import parameter SENDER TYPE COMM_ID_LONG.
    In this function it will create an object SOFM and call the method Send and link the container for this method. So now we’ll create our copy of SOFM and add SENDER as container.
    Set the object.
      swc_create_object office_object 'ZSOFM' space.
      swc_set_element local_container 'DocumentName' documentname.
      swc_set_element local_container 'DocumentTitle' documenttitle.
      swc_set_element local_container 'SENDER' SENDER.
      swc_set_table local_container 'DocumentContent' documentcontent[].
      swc_set_table local_container 'Receivers' t_receivers.
      swc_set_element local_container 'Express' express.
      IF NOT documentexpirydate IS INITIAL.
                  swc_set_element local_container 'DocumentExpiryDat'
                  documentexpirydate.
         ENDIF.
    •Create a subtype for BO SELFITEM
    Example : ZSELFWI
    Create a method “SendWithSender”
    Tab General : Check Synchronous & Result parameter
    Tab Result type : Object type SOFM
    Tab ABAP :  SWO_INVOKE
    Then you’ll have to copy all the parameter from the original function
    “SendTaskDescription” and add a new one
    SENDER(import like PA0105-USRID_LONG)
                Then copy the method “SendTaskDescription” to the code of “SendWithSender”
    Now you’ll have to do some modifications to call the copy of the function
    SWW_SRV_MAIL_SEND  and then delegate ZSELFWI &#61664; SELFITEM
    And now in your task call the method SendWithSender of Selfitem and bind an address to Sender.
    BEGIN_METHOD SENDWITHSENDER CHANGING CONTAINER.                  
    <b>DATA: WORKITEMID LIKE SWWWIHEAD-WI_ID.                           </b>
    DATA: receivers TYPE swc_object OCCURS 0.                        
    DATA: BEGIN OF address_objects OCCURS 3,                         
           a_object TYPE swc_object,                                 
          END OF address_objects.                                    
    DATA: return TYPE STANDARD TABLE OF swotreturn WITH HEADER LINE. 
    DATA: text_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE.  
    DATA: document_content TYPE so_txttab.                           
    DATA: ls_document_content TYPE LINE OF so_txttab.                
    DATA: workitem_task LIKE swwwihead-wi_rh_task,                   
          workitem_language LIKE swwwihead-wi_lang,                  
          workitem_short_text LIKE swwwihead-wi_text,                
          express LIKE sos04-l_***,                                  
          send_type LIKE sos04-l_art,                                
          send_language LIKE sy-langu,                               
          rc LIKE syst-subrc.                                        
    <b>DATA: SENDER like PA0105-USRID_LONG.                             </b>
    DATA: BEGIN OF address_strings OCCURS 3,                         
           a_string LIKE soxna-fullname,                             
         END OF address_strings.                                     
    DATA: attachments TYPE swc_object OCCURS 0 WITH HEADER LINE.     
    DATA: line_width LIKE thead-tdlinesize.                          
    DATA: wi_handle TYPE REF TO if_swf_run_wim_internal.             
    DATA: wi_container TYPE REF TO if_swf_cnt_container.             
    DATA: lv_excp TYPE REF TO cx_swf_run_wim.                               
    DATA: l_subrc TYPE sysubrc.                                             
    DATA: l_expiry_date TYPE sydatum.                                       
    DATA: l_settings TYPE swp_admin.                                                                               
    ~~ begin of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    PERFORM trc_init <b>in program SWWSI</b> .                                     
    ~~ end of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                               
    swc_container addr_crea_container.                                                                               
    Get the input parameters.                                             
    swc_get_table container 'AddressStrings' address_strings.               
    swc_get_element container 'TypeId' send_type.                           
    swc_get_table container 'Receivers' receivers.                          
    swc_get_element container 'Express' express.                            
    swc_get_element container 'Language' send_language.                     
    swc_get_table container 'Attachments' attachments.                      
    swc_get_element container 'LineWidth' line_width.                       
    <b>SWC_GET_ELEMENT CONTAINER 'SENDER' SENDER.                              
    SWC_GET_PROPERTY SELF 'WorkitemId' WORKITEMID.                          </b> ~~ begin of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    PERFORM trc_after_import_params <b>in program SWWSI</b>                        
                                    TABLES container                        
                                           address_strings                 
                                           receivers                       
                                           attachments                     
                                    USING send_type                        
                                          express                          
                                          send_language                    
                                          line_width.                      
    ~~ end of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
    Get some attributes of the object.                                   
    TRY.                                                                   
        CALL METHOD cl_swf_run_wim_factory=>find_by_wiid                   
          EXPORTING                                                        
            im_wiid     = <b>WorkitemId</b>                                       
          RECEIVING                                                        
            re_instance = wi_handle.                                       
        workitem_task = wi_handle->m_sww_wihead-wi_rh_task.                                                                               
    IF send_language IS INITIAL.                                       
          send_language = wi_handle->m_sww_wihead-wi_lang.                 
        ENDIF.                                                                               
    wi_container = wi_handle->get_wi_container( ).                     
      Perform variable substitution for task description.                
        CLEAR text_lines[].        
        IF line_width IS INITIAL.                      
         line_width = 75.                            
          line_width = 132.                            
        ENDIF.                                         
        CALL FUNCTION 'SWU_GET_TASK_TEXTLINES'         
          EXPORTING                                    
            task              = workitem_task          
            usage             = 'W'                    
            linewidth         = line_width             
            language          = send_language          
            container_handle  = wi_container           
          TABLES                                       
            ascii_text_lines  = text_lines             
          EXCEPTIONS                                   
            wrong_usage       = 01                     
            text_not_found    = 02                     
            text_system_error = 03.                    
        IF sy-subrc NE 0.                              
          exit_return 1004 space space space space.    
        ENDIF.                                                                               
    get work item text                               
        CALL METHOD wi_handle->get_witext              
          EXPORTING                                    
            im_language = send_language                
          RECEIVING                                                             
            re_witext   = workitem_short_text.                                                                               
    ~~ begin of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       
        PERFORM trc_after_text_generation <b>in program SWWSI</b>                      
                                          TABLES                                
                                             text_lines                         
                                          USING                                 
                                              wi_handle->m_sww_wihead           
                                              workitem_short_text               
                                              send_language                     
                                              line_width.                       
    ~~ end of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                               
    Fill the document content.                                                
        LOOP AT text_lines.                                                     
          ls_document_content-line = text_lines-tdline.   "note 510198          
          APPEND ls_document_content TO document_content.                       
        ENDLOOP.                                                                               
      * note 881594 - determine default expiry date for office documents      
        CALL FUNCTION 'SWP_ADMIN_DATA_READ'                                     
          IMPORTING                                                             
            wf_settings = l_settings.                                           
        IF NOT l_settings-doc_expiry IS INITIAL.                           
          l_expiry_date = sy-datum + l_settings-doc_expiry.                
        ENDIF.                                                                               
    *- There problems with the implementation of persistence service       
    *- of objects. The symptom of this problems is that sendorders         
    *- (SCOT) are not saved if an object pool exists. Therefore we         
    *- create a new session in this environments.                          
        DATA: t_receivers_por TYPE tswotobjid.                             
        DATA: t_attachments_por TYPE tswotobjid.                           
        DATA: receiver_object TYPE swc_object.                             
        DATA: attachment_object TYPE swc_object.                           
        DATA: por TYPE swotobjid.                                          
        DATA: result_por TYPE swotobjid.                                   
        DATA: rfcdest TYPE rfcdest.                                        
        DATA: documentname TYPE sodocchgi1-obj_name.                       
        DATA: documenttitle TYPE sodocchgi1-obj_descr.                     
        DATA: t_address_strings type swfstrtab.                                                                               
    LOOP AT receivers INTO receiver_object.                            
          swc_object_to_persistent receiver_object por.                    
          IF sy-subrc EQ 0.                                                
            swc_free_object receiver_object.                               
            APPEND por TO t_receivers_por.                                 
          ENDIF.                                                           
        ENDLOOP.                                          
        LOOP AT attachments INTO attachment_object.       
          swc_object_to_persistent attachment_object por. 
          IF sy-subrc EQ 0.                               
            swc_free_object attachment_object.            
            APPEND por TO t_attachments_por.              
          ENDIF.                                          
        ENDLOOP.                                          
        LOOP AT address_strings.                          
          append address_strings to t_address_strings.    
        endloop.                                                                               
    rfcdest = space.                                  
        IF cl_object_pool=>instance_exists( ) EQ 'X'.     
          rfcdest = 'NONE'.                               
        ENDIF.                                                                               
    documentname = 'Notiz'(001).                      
        documenttitle = workitem_short_text.              
        CALL FUNCTION <b>'ZSWW_SRV_MAIL_SEND'                </b>
          DESTINATION rfcdest                             
          EXPORTING                                       
            send_type               = send_type           
            send_language           = send_language       
            documentname            = documentname        
            documenttitle           = documenttitle                
            documentcontent         = document_content             
            receivers               = t_receivers_por              
            express                 = express                      
            documentexpirydate      = l_expiry_date                
            attachments             = t_attachments_por            
            address_strings         = t_address_strings            
            <b>SENDER                  = SENDER    </b>                   
          IMPORTING                                                
            result_por              = result_por                   
          EXCEPTIONS                                               
            document_not_send       = 1                            
            not_specified           = 2                            
            error_during_send       = 3                            
            error_during_attachment = 4                            
            OTHERS                  = 2.                           
        l_subrc = sy-subrc.                                        
    *~~ begin of trace specific coding ~~~~~~~~~~~~~~~~~~~~~       
        PERFORM trc_after_send <b>in program SWWSI</b> USING l_subrc.     
    *~~ end of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~       
      Check the result of the method call.                       
        CASE l_subrc.                                              
          WHEN 0.                                                  
            Set the return element (the SOFM object).               
            swc_set_element container result result_por.           
            commit work.                                           
          WHEN 1.                                                  
            exit_return 1001 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.  
          WHEN 2.                                                  
            exit_return 1002 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.  
          WHEN 4.                                                  
            exit_return 1005 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.  
            WHEN OTHERS.                                           
              exit_return 1003 space space space space.            
          ENDCASE.                                                                               
    CATCH cx_swf_run_wim INTO lv_excp .                          
        exit_return 1006 <b>workitemid</b> space space space.                                                                               
    ENDTRY.                                                                               
    END_METHOD.

  • Problem to access the object attribute in a code

    Hi guys,
    I need to pass the attribute of a business object to class.Below is the code but its throwing an error 'There is no component ZYBTT in l_bus2000116'.Since the business object conatins the attribute but its throwing an error.Could any one throw some light on the below code -
    data: l_BUS2000116 type swc_object,
          Z_BRF_Function_name TYPE FDT_UUID.
    swc_get_element ac_container 'Z_Quotation' l_BUS2000116.
    swc_get_element ac_container 'Z_BRF_Function_name' Z_BRF_Function_name.
    CALL METHOD ZYCLOTO_AGENTDTMT_BRF=>ZYOTOM_GET_AGENT_IDS_SING_LEV
      EXPORTING
        IM_FUNCTION_ID  = Z_BRF_Function_name
        IM_BTT          = l_BUS2000116-ZYBTT
       IM_COMPL_CAT    =
       IM_COUNTRY_CODE = ZYCOUNTRY
        IM_LEAD_BRAND   = l_BUS2000116-leadbrand
        IM_RISK_LEVEL   = l_BUS2000116-ZYRISKLEVEL
        IM_SALES_ORG    = l_BUS2000116-ZYsalesorg
        IM_TCV          = l_BUS2000116-ZYTCV.
    IMPORTING
       EX_FULL_NAME    =
       EX_RETURN       =

    Hi,
    Is ZYBTT a new attribute? Have you changed the status of the attribute to implemented or released (in SWO1: Edit -> Change release status)?
    And actually I think that your syntax is wrong too (BOR world is different compared to classes). If you want to use an attribute, I think that the syntax should be something like this:
    SWC_GET_PROPERTY <Object> <Attribute> <AttributeValue>.
    Read more here:
    http://help.sap.com/saphelp_nw04/helpdata/en/c5/e4acef453d11d189430000e829fbbd/content.htm
    Regards,
    Karri

  • Reg:Email to mutiple users

    Dear All,
           I created a work flow which will send mail to the user .But i got a new requirement of sending mail to multiple user .These multiple users vary from department to department in organization so I created a method in Bus object to get email address of theses users and stored them in an internal table .But as i am new to
    Work flow how could I send the internal table data to the Mail step ( or how can i bind the internal table content to Mail step )  so that mail would be sent to the users ?

    Create container element of type AD_SMTPADR of multiline.
    pass the container in the email step so that it sends email to multiple users...
    See the following code to get an idea.
    BEGIN_METHOD ZGET_EMAILS CHANGING CONTAINER.
    *--- Local Internal tables
    data: lt_agents type table of wfsyst,
          lw_agents like line of lt_agents,
          lt_emails type table of adr6,
          lw_emails like line of lt_emails.
    *--- Local Variables
    data: req_user type swc_object.
    Import Agents
    swc_get_element container 'ZACTUALAGENTS' lt_agents.
    loop at lt_agents into lw_agents where agent+0(2) = 'US'.
    Get Emails of Agents(Approvers)
      swc_create_object req_user 'BUS4101' lw_agents-agent+2.
      swc_get_property req_user 'EmailAddress' lw_emails-smtp_addr.
      append lw_emails to lt_emails.
    endloop.
    Export Emails
    swc_set_element container 'Z_AGENT_EMAILS' lt_emails.
    END_METHOD.
    Regards,
    PR.

  • Workflow Step type for Container Operation

    Hi,
    A STEP in a given Workflow has to have an Agent? Can't I create a Step to get data from the DB into the container and that's it?
    I have created a container variable called "Grade" and I need to fetch the Grade of a User (WF Inititator) from a DB table and populate the "Grade" variable from the container that will be used in further steps.
    The Workflow gets kicked off but when it reaches the STEP, it stays there waiting for something (Action from a user?).
    Thanks & Regards,
    Ernesto

    Ok, now this is getting weird. Will try to explain what I am doing for one single step:
    1) I have my workflow. On PFTC I Have a workflow Template. Under the Container Tab I created a Parameter called "Grade" with the Import/Export check-boxes set and a "CreatedBy" parameter with the import/export check-boxes set as well.
    2) Then on the Workflow Builder I created a Step called Get Grade. This step calls a Custom Task and processes in the background so there is no agent determination.
        2.1) Here I have two bindings: a) Binding Between Workflow Container and Task and between Task and BO Method       
               Get_grade.  The Method Get_grade has 2 parameters (CreatedBy, that is an attribute of the Object and is an import
               parameteter and Grade that it is an import/export parameter).
        2.2) The Binding between the WF Container and the Task is like this:
                  &PROCCONFIRMATION.CREATEDBY& --> &CREATEDBY&
                  &GRADE& <-- &GRADE&
        2.3) Binding Between Task and Method is:
                 &_WI_OBJECT_ID.CREATEDBY& --> &CREATEDBY&
                 &GRADE& <-- &GRADE&   
        2.4) The Code for my method is:
    begin_method get_grade changing container.
    DATA:
          lv_grade TYPE zmm_app_req_info-grade,
          lv_userid TYPE zmm_app_req_info-requestor
    swc_get_property self 'CreatedBy' lv_userid.
    SELECT SINGLE grade FROM zmm_app_req_info
    INTO lv_grade
    WHERE requestor = lv_userid.
    IF sy-subrc IS INITIAL.
      swc_set_element container 'Grade' lv_grade.
    ENDIF.
    end_method.
    The only thing I need is to get the Grade parameter of the WF Container populated. This parameter will be used later on.
    Thanks & Regards,
    Ernesto.

  • Problem in custom attributes in a B.O.

    Hi all,
    I've defined a custom virtual multiline attribute (a list of WBEs) in a B.O. (ZFIPP) and it correctly works using SWO1. Now I've added another custom attribute that needs the previous one to fill a table of corresponding agents, but when I debug the code of the second attribute the first table is empty. When I complete the run the first table is instead correctly filled.
    Is it possible to define an attribute that uses another one and how can I check the order in which they are filled?
    I used the following instruction at the beginning of the second attribute's code:
    SWC_GET_TABLE CONTAINER 'WBSElements' OBJECT-WBSELEMENTS.
    where WBSElements is the first table mentioned above.
    Thanks in advance for your help.
    Best regards,
    Angelo

    Thanks a lot, Ramki.
    I've changed the first code line in
    SWC_GET_PROPERTY self 'WBSElements' OBJECT-WBSELEMENTS.
    and now it works!
    Regards,
    Angelo

  • Programmed binding

    Hi there,
    I'm using a function module to implement the container to container binding (BOR). It is based on the  template SWA_TEMPLATE_EXECUTE_DATAFLOW. Unfortunatelly the macro SWC_GET_PROPERTY does  not return a value.
    *Direction of the dataflow
      CASE dataflow.
        WHEN lcworkflow_to_step.
    2nd: upon instanciating the step (resp. calling the method),
         transfer data 'CALLING_CONTAINER' ---> 'CALLED_CONTAINER'
          swc_container_to_runtime calling_container.
          swc_get_element calling_container 'SWITCHDOCUMENT' ls_switchobjid.
          swc_create_object wa_switchdocument 'ISUSWITCHD'   ls_switchobjid-objkey.
          swc_get_property  wa_switchdocument 'POINTOFDELIVERY'   lv_pod.
          swc_get_property  wa_switchdocument 'MoveInDate'   lv_move.
    Hoping for input.
    Thanks in advance
    Barbara

    Hi Rick,
    it seems so.
    runtime:
    wa_switchdocument
    1     HEADER     C     4      OBJH
    2     TYPE     C     4      SWO
    3     HANDLE     I     4       100000004
    4     CB_INDEX     C     40                                                                               
    5     CLSID     C     38                                                                               
    lv_pod
                            OBJHSWO #õá#                              
    lv_move
                            00000000                                  
    thanks,
    barbara

  • Z Program of subtype being incorrect??

    Hi experts.
    I've created a Z subtype of object BUS2009 and I have some problems regarding the containers.
    Well, It's a little complicated so I'll try to expose it as easy as I can.
    We have a problem with the Z-Object because of the "get_property" function on the original object program. As you know, when you create a subtype of some object, it requires a new program name, it's supposed that the code you write in this new program is added to the existing one (the one in the father object), so if you declare new methods, they are included on this new program, but you also have access to the methods of the father object.
    Well, when I debug some of the methods of the original object, there is a table, "_eban", that is used to retrieve the atributes of the object in the "get_property" code. But when I debug my own method, this table seems to be empty...I don't know why because the "get property" is supposed to be executed even if I call de Z version of the program in the subtype. Isn`t it?
    What do you think about that?
    Thank you all.
    Ismael

    Hall Ismael,
    the field <tablename> and the form get_table_property_xxx is generated when you create (new) object attributes with reference to a database table.
    These attributes are then stored in <tablename> as a cache. This function is executed for the first attribute on reading. So when you want to ensure, that you have current data, use the following statment in your method:
    swc_get_property self '<your-table-property>' prop.
    If this call returns with sy-subrc = 0, the complete _eban is now filled.
    Best wishes,
       Florin

  • How to get _WorkItem attributes in Object method

    I am trying to get the user id of the person who created the current workitem task being executes.
    I've tried the following:
    DATA: workingwi TYPE swc_object.
    DATA: next_agent LIKE wfsyst-agent.
    swc_get_element container '_Workitem' workingwi.
    swc_get_property workingwi 'CreatedByUser' next_agent+2(12).
    But all I get is the workflow item handle.
    What am I doing wrong?

    Check this code snippet
    swc_get_element  container     '_Workitem'          lv_wi_object.
    swc_get_property lv_wi_object  'Workitemid'         lv_wiid.    
    CALL FUNCTION 'SAP_WAPI_GET_WORKITEM_DETAIL'                    
      EXPORTING                                                     
        workitem_id     = lv_wiid                                   
      IMPORTING                                                     
        workitem_detail = ls_wiheader.                                                                               
    IF ls_wiheader IS NOT INITIAL.                                  
      lv_root_wiid = ls_wiheader-wi_chckwi.    " Parent Workitem ID                     
    ENDIF.                                                          
    here Iam getting the current task workitem ID and through it Iam getting the parent workitemid and the Iam  reading the parent workitem container for Wfinitiator which will give us who started the workflow.

Maybe you are looking for

  • Touchpad no longer working on hp pavillion dv6 after disassemble

    So, I went ahead and spilled a little bit of coffee on my laptop.  Not much, but as an extra bit of precaution, probably a bit too much, I disassembled it and let it dry.  Everything works perfectly now except for the trackpad.  The LED border is lit

  • When ipod shuts off with sleep timer, does power stay on?

    I want to use sleep timer in iPod nano but when music shuts off, will my ipod shut off also or will the battery run down?

  • Green box with registration marks appears from nowhere

    ...and I'd like to get rid of it, but how and what is it? In any AICS3 document I open, my default is now an art board that is 200"x200" with a green rectangle about 60"x12" in its center. The green rectangle has registration marks on its corners. Ev

  • FNDLOAD giving error while downloading

    Dear, We are using below mentioned command through applmgr user by switching off 'FND_TOP' and executed this but getting error as mentioned. FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct HR_Position_Functions.ldt VALUE_SET FLE

  • SanDisk Card Reader stopped working with OS X 10.4.7

    I have an older SanDisk single smart card reader, model SDDR-55. It worked fine with 10.2, but I cannot seem to get it to work with 10.4.7. When I reinstall the SanDisk driver (the most recent download available from them) and restart, I get an error