Quantcast
Channel: SCN : Discussion List - BOPF Application Framework
Viewing all 249 articles
Browse latest View live

How to achive saving draft BO entity ?

$
0
0

Dear Community Members,

 

we would like to use Business Objects in OData service. Since the OData service is based on REST protocol, we've no session memory between user interactions during updating the values through the UI. It means as soon as the user push the edit button, we need to keep the saved instance of the BO, but in addition save the changes done by the user, without memory in ABAP, so have no possibility to simply reset the changes.

This kind of Draft management is done using a darft flag as key in our tables. When user push the Edit button, we copy the active version(without draft flag) and set the draft flag in the copied  table entries. All changes of the user is done on the draft version, and when the User push save, we delete the current active version, and remove the draft flag from the entries updated by teh user.

Do you know, how to cover this draft management requirement using BOPF, where the backend data is managed by BO, and have to be saved after each change, and both active and temporary version have to be managed ? My idea would be to copy the instance when the user push the edit button. To support this for example, Is there a default copy operation provided by the BOPF API ? Might not this is the best solution, just an idea. If you have better suggestion, just tell me

 

Thank you,Attila


How to prevent the creation of a node?

$
0
0

Hi,

 

we try to connect a service which offers the possibility to prevent the manual creation of a node.

 

As a first try we used a determination which is called at creation and set et_failed_key by debugger but this did not work.

 

Better ideas?

 

Regards, Jürgen

BAPI calls in BOPF Actions how-to ?

$
0
0

Hello Experts,

could you pelase clarify, what is the proper way to call BAPIs from BO actions ? I'm doing a BAPI call in my action, which creates a document. After in AFTER_COMMIT determination when saving the transaction, I want to start a workflow, and add GOS attachments to the document created by the BAPI call, but this document not become persistent. What I know, that BOPF does the commit work automatically and the changes to BOPF data are done in an UPDATE task.

May I call BAPI_TRANSACTION_COMMIT in my BO action, or maybe use SET UPDATE TASK LOCAL statement before calling the BAPI? I do not want to "crash" the BOPF phase model with my own commits. The slave transaction manager is for the opposite case as far as I understood, where we do not want to allow the BOPF to commit, so does not apply. Any advice is welcome .

Thank you

Attila

Triggering a second transaction

$
0
0

Hi experts,

 

Is there a way to trigger a second save transaction from within a determination?  We are facing a situation where, when saving to a BOPF table, another standard table has to be maintained. 

 

In a normal situation we can control the two updates via the BOPF commit, but because of some unfortunate circumstances, the standard table has to be updated via an RFC call.  This means that the update of the standard table is already committed before the BOPF commit has succeeded, leaving room for inconsistencies between the two tables. The user should receive an error message if any of the two updates failed.

The current idea is to work with a status variable in the BOPF node:

- transaction 1 = BOPF update + commit; status = update pending;  for changed made by user

- transaction 2 = standard table update + commit; status = active; via determination after load, for all records where status = update pending.

 

I could trigger the second save via the transaction manager instance from the FPM application controller, but the BOPF model should also work from outside the FPM application.

 

I'm aware that this approach is not optimal.  Any other strategies to tackle this problem are welcome

 

Thanks in advance!

 

Kind regards,

Bjorn

BOPF Transaction Management

$
0
0

Hello experts,

 

is it possible to retrieve data from an bopf object, after save the transaction with pattern "save and exit"?

Bild 10.png

Using /BOBF/IF_TRA_SERVICE_MANAGER will dump because the transaction state is "finished".

 

Bild 20.png

 

But how can i clear the transaction or get a new one or rather read data from an bopf-object?

 

Changing the transaction pattern is not an option, because this is a standard implementation.

 

Thanks for your help!

 

Regards,

Thomas Deubel

Add customer action to the standard BOPF

$
0
0

Hello, experts!

Can I add my own action to stadart BOPF and execute it after standard action?

My task is to add new action into BOPF /SRMSMC/BO_SEV. That action will send the file to Sourcing after action "Complete" for evaluation of supplier. Action "Complete' is not ready for enhancement in that BOPF-object.

 

Please help me.

Additional driver person is created for preliminary data creation in offline form scenario

$
0
0

I have couple of offline forms for incident and near-miss recording, having sections to capture driver details for the vehicle involved cases. They are based on standard EHHSS_INCIDENT business object.

 

Problem arises when we have more than one driver persons with 'External' Person group (i.e. not an employee, so no Person Number). I create a row for involved person node with preliminary data updating person group and create person role, person initial, person statement node rows accordingly and updating driver details to respective vehicle asset node. The party key ID for such involved persons is auto-generated starting with an 'I' (like I00000631) instead of 'A' in case of an employee.

 

The row count of person involved node remains consistent with what I am intending to do till the end of persistent class STORE_DATA method where I am coding. However, after service manager SAVE() method at very end, I check in pre-exit of PERSON_GROUP determination and find that there are additional (duplicate) driver person created for 'External' Person group cases only and that too only for second such driver person onwards (not for first driver person). We have other sections on the form with other involved person roles like Reporting Person, Injured Person, Treatment Provider etc. but such discrepancy does not happen anywhere else.

 

This is a bit strange and I am yet to figure out where it is going wrong: my persistent class code or somewhere within service manager SAVE() method for any reason.

 

Please let me know if there is anything in BOPF that may drive this behavior. I am putting my code snippet below for better understanding:

 

    LOOP AT <ls_interf_str>-inv_pers-vehicle_drivers  REFERENCE INTO l_driver.    "Start of Driver Person Loop
      CLEAR: ls_driver_key_refs.
      zl_index = sy-tabix.
      lv_person_exist  = abap_false.
      lv_create_hr  = abap_false.
      lv_pers_no = l_driver->person_data-person_initial-person_number.
      lv_first_name = l_driver->person_data-person_initial-first_name.
      lv_last_name  = l_driver->person_data-person_initial-last_name.
      cl_ehhss_aif_inc_person_helper=>get_party_key_by_person_number(
        EXPORTING
          iv_person_number =  lv_pers_no "Personnel Number
          iv_first_name =  lv_first_name"First Name of Driver
          iv_last_name =  lv_last_name"Last Name of Driver
        IMPORTING
          ev_hr_per_exists = lv_person_exist"Driver Exist
          ev_party_key = ls_veh_dri_party_key"Combined Party ID
          ev_create_hr = lv_create_hr"HR data exist
      ).
      IF lv_person_exist = abap_true AND lv_create_hr = abap_true.
    "If an existing employee - this case works fine
    .
    .
    .
      ELSE.

*-----------------------------------------------------------------------------------------

* Invalid Personnel Number - unable to read the data by the proxy ( create person Initial)

*-----------------------------------------------------------------------------------------

* create  driver person - Combined Party ID is initial

     IF lv_driver_added EQ abap_false.
        lo_inv_pers = lo_root_node->get_subnode_by_key( if_ehhss_inc_c=>sc_association-root-person_involved ).
        lr_s_person_involved ?= lo_inv_pers->create_empty_row( ).
        lo_inv_pers->insert_and_focus( lr_s_person_involved ).
        lr_s_person_involved ?= lo_inv_pers->get_current_row( ).
        "Update Person Group
        IF l_driver->person_data-per_group IS NOT INITIAL.
              lr_s_person_involved->per_group = l_driver->person_data-per_group.
        ENDIF.
        CALL METHOD lo_inv_pers->update
          EXPORTING
                ir_s_update_row   = lr_s_person_involved
          RECEIVING
                rv_success          = lv_success.

* create  driver person initial

        lo_inv_pers_initial = lo_inv_pers->get_subnode_by_key( if_ehhss_inc_c=>sc_association-person_involved-person_initial ).
        lr_s_person_initial ?= lo_inv_pers_initial->create_empty_row( ) .

 

        IF   l_driver->person_data-person_initial-first_name IS NOT INITIAL
              OR l_driver->person_data-person_initial-last_name IS NOT INITIAL
              OR l_driver->person_data-person_initial-telephone_number IS NOT INITIAL
              OR l_driver->person_data-person_initial-email IS NOT INITIAL
              OR l_driver->person_data-person_initial-person_number IS NOT INITIAL.

 

 

          IF l_driver->person_data-person_initial-first_name IS  INITIAL
              OR l_driver->person_data-person_initial-last_name IS INITIAL.
            lv_otr = cl_wd_utilities=>get_otr_text_by_alias( alias = 'EHHSS_UI_INC_COMMON/UNKNOWN_PERSON' language = <ls_interf_str>-meta_data-langu ).
            lr_s_person_initial->last_name    = lv_otr.
          ELSE.
            lr_s_person_initial->first_name = l_driver->person_data-person_initial-first_name.
            lr_s_person_initial->last_name = l_driver->person_data-person_initial-last_name.

 

 

          ENDIF.

 

          lr_s_person_initial->telephone_number = l_driver->person_data-person_initial-telephone_number.
          lr_s_person_initial->email = l_driver->person_data-person_initial-email.

 

          lo_inv_pers_initial->insert( lr_s_person_initial ).

 

          "Statement
          IF l_driver->person_data-statem_of_pers-text IS NOT INITIAL AND l_driver->person_data-statem_of_pers-text NE space.
            lo_driver_stmt = lo_inv_pers->get_subnode_by_key( if_ehhss_inc_c=>sc_association-person_involved-person_statem ).

 

            lr_s_driver_stmt ?= lo_driver_stmt->create_empty_row( ) .
            lr_s_driver_stmt->text = l_driver->person_data-statem_of_pers-text.
            lr_s_driver_stmt->per_stat_date = <ls_interf_str>-basicinfo-start_date.

 

            IF <ls_interf_str>-basicinfo-start_time IS NOT INITIAL.
              CLEAR lv_ehfnd_time.
              CALL FUNCTION 'CONVERSION_EXIT_THHMM_INPUT'
                EXPORTING
                  input = <ls_interf_str>-basicinfo-start_time  
                IMPORTING
                  output   = lv_ehfnd_time
                EXCEPTIONS
                  time_invalid = 1
                  OTHERS    = 2.
              IF sy-subrc EQ 0.
                lr_s_driver_stmt->per_stat_time = lv_ehfnd_time.
              ENDIF.
            ENDIF.
            lo_driver_stmt->insert( lr_s_driver_stmt ).
          ENDIF.

* Create driver person role

          lo_veh_inv_pers_role = lo_inv_pers->get_subnode_by_key( if_ehhss_inc_c=>sc_association-person_involved-person_role ).

 

          lr_s_veh_driver_role ?= lo_veh_inv_pers_role->create_empty_row( ).
          lr_s_veh_driver_role->role = if_ehhss_inc_impl_c=>sc_person_role-vehicle_driver.
          lr_s_veh_driver_role->key_ref = lr_s_veh_driver_role->parent_key.
          lo_veh_inv_pers_role->insert( lr_s_veh_driver_role ).
          APPEND ls_veh_dri_party_key TO lt_veh_party_keys.

 

          "To update Driver under vehicle
          ls_driver_key_refs-driver_ref_key = lr_s_veh_driver_role->parent_key.
          ls_driver_key_refs-create_hr  = lv_create_hr.
          ls_driver_key_refs-exist_hr   = lv_person_exist.
          APPEND ls_driver_key_refs TO lt_driver_key_refs.
        ELSE.
          lo_inv_pers->delete( ).
        ENDIF.
        ENDIF.
      ENDIF.
      CLEAR:  lr_s_person_involved, lr_s_veh_driver_role, lr_s_driver_stmt, ls_driver_key_refs,
      lr_s_person_initial, ls_party_roles, ls_driver_key_refs, ls_veh_dri_party_key.
    ENDLOOP.   "End of Driver Person Loop

****-------------------------------------------------------------------------------------------------------

 

    LOOP AT lt_vehicle REFERENCE INTO l_vehicle.   "Start of Vehicle Loop
      zl_pass_index = sy-tabix.
    .
    .
    .
      READ TABLE lt_driver_key_refs INTO ls_driver_key_refs INDEX zl_pass_index.   
      IF sy-subrc EQ 0.   "Driver Added
        READ TABLE lt_veh_party_keys INTO ls_veh_dri_party_key INDEX zl_pass_index.
        IF sy-subrc EQ 0.   "Driver Added with Person Number - Employee
          IF ls_driver_key_refs-create_hr EQ abap_true AND ls_driver_key_refs-exist_hr EQ abap_true.
            lr_s_vehicle->driver_id  = ls_veh_dri_party_key-id_combined.
          ELSE.
            READ TABLE <ls_interf_str>-inv_pers-vehicle_drivers  REFERENCE INTO l_driver INDEX zl_pass_index.
            IF sy-subrc EQ 0.
              IF ls_veh_dri_party_key-id_combined IS NOT INITIAL.
                lr_s_vehicle->driver_id     = ls_veh_dri_party_key-id_combined.
              ELSE.   "Driver Added as External Person
                CLEAR: lr_s_person_involved, lr_s_veh_driver_role, lv_role_found.
                lo_inv_pers = lo_root_node->get_subnode_by_key( if_ehhss_inc_c=>sc_association-root-person_involved ).
                zl_count = lo_inv_pers->count( ).
                WHILE lo_inv_pers->has_more_rows( ) = abap_true.   "Get auto ID from Involved Person Node
                  lr_s_person_involved ?= lo_inv_pers->get_next_row( ).
                  IF lr_s_person_involved->key eq ls_driver_key_refs-driver_ref_key.
                    lr_s_vehicle->driver_id   = lr_s_person_involved->id.
                    EXIT.
                  ENDIF.
                ENDWHILE.
              ENDIF.
              lr_s_vehicle->driver_fi_name= l_driver->person_data-person_initial-first_name.
              lr_s_vehicle->driver_last_name  = l_driver->person_data-person_initial-last_name.
              CONCATENATE   l_driver->person_data-person_initial-first_name
                            l_driver->person_data-person_initial-last_name
                     INTO   zl_driver_name
              SEPARATED BY  space.
              lr_s_vehicle->driver_name   =  zl_driver_name.
              lr_s_vehicle->driver_email  = l_driver->person_data-person_initial-email.
              lr_s_vehicle->driver_tel_num= l_driver->person_data-person_initial-telephone_number.
            ENDIF.
          ENDIF.
          lv_driver_id  = ls_veh_dri_party_key-id_combined.
        ENDIF.
      ENDIF.

      .

   .   
      lo_inv_veh->insert_and_focus( lr_s_vehicle ).

      .

      .

      CLEAR:  lr_s_person_involved, lr_s_person_details, lr_s_veh_driver_role,
              ls_r_pers_role_rev_key, lv_role_found, lr_s_person_initial.
      lo_inv_pers = lo_root_node->get_subnode_by_key( if_ehhss_inc_c=>sc_association-root-person_involved ).
      zl_count = lo_inv_pers->count( ).

      "Setting Vehicle key into Driver Role node's key_ref field and Involved Person key as parent key for

      "person_role_rev_for_key node under vehicle

      WHILE lo_inv_pers->has_more_rows( ) = abap_true.
        lr_s_person_involved ?= lo_inv_pers->get_next_row( ).
        IF ( lr_s_person_involved->id eq lv_driver_id AND lv_driver_id IS NOT INITIAL ) or
           ( lr_s_person_involved->key eq ls_driver_key_refs-driver_ref_key ).
          lv_role_found = abap_true.
        ELSE.
          lo_inv_pers_details = lo_inv_pers->get_subnode_by_key( if_ehhss_inc_c=>sc_association-person_involved-person_detail ).
          zl_count = lo_inv_pers_details->count( ).
          WHILE lo_inv_pers_details->has_more_rows( ) = abap_true.
            lr_s_person_details ?= lo_inv_pers_details->get_next_row( ).
            IF lr_s_person_details->id eq lv_driver_id AND lv_driver_id IS NOT INITIAL AND lr_s_person_details->parent_key eq lr_s_person_involved->key.
              lv_role_found = abap_true.
              EXIT.
            ENDIF.
          ENDWHILE.
          IF lv_role_found ne abap_true.
            lo_inv_pers_initial = lo_inv_pers->get_subnode_by_key( if_ehhss_inc_c=>sc_association-person_involved-person_initial ).
            zl_count = lo_inv_pers_initial->count( ).
            WHILE lo_inv_pers_initial->has_more_rows( ) = abap_true.
              lr_s_person_initial ?= lo_inv_pers_initial->get_next_row( ).
              IF lr_s_person_initial->id eq lv_driver_id AND lv_driver_id IS NOT INITIAL AND lr_s_person_initial->parent_key eq lr_s_person_involved->key.
                lv_role_found = abap_true.
                EXIT.
              ENDIF.
            ENDWHILE.
          ENDIF.
        ENDIF.
        IF lv_role_found ne abap_true.
          CONTINUE.
        ENDIF.
        lo_veh_inv_pers_role = lo_inv_pers->get_subnode_by_key( if_ehhss_inc_c=>sc_association-person_involved-person_role ).
        zl_count = lo_veh_inv_pers_role->count( ).
        WHILE lo_veh_inv_pers_role->has_more_rows( ) = abap_true.
          lr_s_veh_driver_role ?= lo_veh_inv_pers_role->get_next_row( ).
          IF  lr_s_veh_driver_role->role EQ if_ehhss_inc_impl_c=>sc_person_role-vehicle_driver AND
              lr_s_veh_driver_role->parent_key EQ lr_s_person_involved->key .
                lr_s_veh_driver_role->key_ref = lr_s_vehicle->key.
                lo_veh_inv_pers_role->update( lr_s_veh_driver_role ).
          ENDIF.
        ENDWHILE.
        READ TABLE lt_driver_key_refs INTO ls_driver_key_refs INDEX zl_pass_index.  "zl_index.
        IF sy-subrc EQ 0.
          lo_pers_role_rev_key = lo_inv_veh->get_subnode_by_key( if_ehhss_inc_c=>sc_association-vehicle-person_role_rev_for_key ).
          ls_r_pers_role_rev_key ?= lo_pers_role_rev_key->create_empty_row( ).
          ls_r_pers_role_rev_key->key_ref = lr_s_vehicle->key.
          ls_r_pers_role_rev_key->role   = if_ehhss_inc_impl_c=>sc_person_role-vehicle_driver.
          ls_r_pers_role_rev_key->parent_key = lr_s_person_involved->key.
          lo_pers_role_rev_key->insert( ls_r_pers_role_rev_key ).
        ENDIF.
        CLEAR: lr_s_person_involved, lr_s_person_details, lr_s_veh_driver_role,
               ls_r_pers_role_rev_key, lv_role_found, lr_s_person_initial.
      ENDWHILE.
      CLEAR: lv_driver_id, lr_s_person_involved, lr_s_veh_driver_role, lv_role_found.
    ENDLOOP.   "End of Vehicle Loop

Attach File to BO Folder method fails to upload for certain plants in offline form scenario

$
0
0

Hi All,

 

I have couple of offline forms for incident and near-miss recording, based on standard EHHSS_INCIDENT business object.

 

I am calling  attach_file_to_bo_folder method of class to attach uploaded offline form file to BO node:

 

lo_attachment_node = lo_root_node->get_subnode_by_key( iv_assoc_key = if_ehhss_inc_c=>sc_association-root-att_document
                                                                                       iv_edit_mode = /bobf/if_conf_c=>sc_edit_exclusive ).

cl_ehhss_aif_inc_helper=>attach_file_to_bo_folder(
           EXPORTING
             io_attachment_node = lo_attachment_node
             iv_att_folder_id         = if_ehhss_inc_c=>sc_association-root-att_document_rev_for_key
             iv_key_ref                = lr_s_root->key
             iv_node_key_ref       = if_ehhss_inc_c=>sc_node-root
             is_form                   = is_form
             iv_filename              = iv_filename
             iv_file_content         = iv_filecontent
             io_service_manager = lo_service_manager
             iv_document_action = if_ehhss_inc_c=>sc_action-att_document-upload_document_in_bg
             iv_save_data           = iv_save_data
           IMPORTING
              ev_attach_rejected = lv_rejected
              ev_conf_key          = lv_attachment_reference  ).


However, the method cannot insert the attachment row into the lo_attachment_node node above and ends up raising cx_ehhss_aif_comn_exception for certain plants. It works for all others.


How come the method functionality be affected by form content? I can see that it uses file content when creating the file attributes structure for the attachment folder but the problem occurs even before when it tries to insert data into attachment node within this method.


Why it fails to work in certain cases whereas the values of parameters passed into this method are similar in all cases?


Please help.




Automatically create subnode for root node (on Change?) in BOPF

$
0
0

Hello BOPF-Experts,

 

 

i' m really new to BOPF and have a special question.

 

I want to create a subnote automatically when i chance a Value on the Root-Node Structure.

 

For example i have a root node with a field in the structure where i can enter a String(e.g. name).

After i have enterd that string the subnotes should automatically be created. (e.g. a subnode for each Businesspartner with that name and some more infos in the structure)

 

My idea was to create a determination for the root node (for update). In the Excecute Methode of the implemented class in try to create the subnode. But if i the business Object over BOBT ist dumps (after i changed the value in the root node).

 

 

In the dump description there aren't any helpful informations

 

"MESSAGE_TYPE_X"

"/BOBF/CL_FRW==================CP" bzw. /BOBF/CL_FRW==================CM013

"SET_APPLICATION_ERROR"

 

 

My Excecute method:

 

 

method /BOBF/IF_FRW_DETERMINATION~EXECUTE.

 

    "Alle passenden QUEUE Subnodes erstellen

 

     DATA lr_queue           TYPE REF TO zs_komb_queue.

 

         DATA(LO_SERVICE_MANAGER) = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( zif_con_bupa=>sc_bo_key ).

 

    CREATE DATA lr_queue.

 

    lr_queue->key = lo_service_manager->get_new_key( ).

    lr_queue->root_key = is_ctx-root_node_key.

 

    io_modify->create(

      EXPORTING

      iv_node            = zif_con_bupa=>sc_node-adress

        iv_key             = lr_adress->key

*       iv_node_cat        =

*       is_data            = lr_adress

*        it_changed_fields  =

*       iv_assoc_key       = zif_con_bupa=>sc_association-mappe-bupa_to_adress

        iv_source_node_key = zif_con_bupa=>sc_node-bupa

        iv_source_key      = is_ctx-root_node_key

        iv_root_key        = is_ctx-root_node_key

*      IMPORTING

*        ev_key             =

    ).

 

   endmethod.

 

 

What should i consider for my requirement?

I know there are not so much infos, but if anybody knows how i can solve my prolem or have a better idea to solve my requirement.

 

Would be great

 

Thank you!

Viewing all 249 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>