cancel
Showing results for 
Search instead for 
Did you mean: 

Create Docflow between Items with BOL

Former Member
0 Kudos

Hello everybody,

recently I try to create a dowflow relationship between two items (BUS1000130) below opportunities (BUS1000111). As there no BOL method for docflow creation exists below BOL relation BTItemDocFlowSet/BTDocFlowAll, I was wundering if maybe the method createDocFlow of BTOrderHeader can be facilitated in some way also to create docflow between items.

I tried this and gut a dump which says, that an item docflow linkage cannot be created without a header docflow linkage. This sounds sensible but actually a doflow relation between the two parent opportunities of the items exists. So I'm not sure if I the parameters which I hand over to the method createDocFlow are correct. I call the method this way:


TRY.

       CLEAR lt_params.

       CLEAR ls_params.
       ls_params-name  = 'OBJKEY_A'.
       ls_params-value = ir_main_file->get_property_as_string( 'GUID' ).
       APPEND ls_params TO lt_params.

       CLEAR ls_params.
       ls_params-name  = 'OBJTYPE_A'.
       ls_params-value = 'BUS2000130'.
       APPEND ls_params TO lt_params.

       CLEAR ls_params.
       ls_params-name  = 'OBJKEY_B'.
       ls_params-value = ir_supdlv_file->get_property_as_string( 'GUID' ).
       APPEND ls_params TO lt_params.

       CLEAR ls_params.
       ls_params-name  = 'OBJTYPE_B'.
       ls_params-value = 'BUS2000130'.
       APPEND ls_params TO lt_params.

       CLEAR ls_params.
       ls_params-name  = 'RELTYPE'.
       ls_params-value = iv_rel_type.
       APPEND ls_params TO lt_params.

       CLEAR ls_params.
       ls_params-name  = 'BREL_KIND'.
       ls_params-value = 'B'.
       APPEND ls_params TO lt_params.

       lr_parent_section ?= ir_supdlv_file->get_parent( )->get_parent( ).

       IF lr_parent_section IS BOUND AND lr_parent_section->get_name( ) EQ 'BTAdminH'.

         lr_parent_section->execute(
                     iv_method_name = 'createDocFlow'
                     it_param       = lt_params ).

       ENDIF.

I create try to create the docflow underneath the start opportunity named "lr_parent_section". OBJKEY_A is the GUID of the item below lr_parent_section. The OBJKEY_B is the GUID of the item underneath the other opportunity. As I see no possibility to hand over a GUID for the header of this opportunity, I'm not sure how to transport the header linkage of the two opportunities. As this docflow already exists, no check seems to be made between within the docflow creation method.

Can anybody give me a hint how to handle this problem? Would be great...

Thanks and best regards,

Markus

Accepted Solutions (0)

Answers (2)

Answers (2)

kapilpatil
Active Contributor
0 Kudos

Hello Markus,

Did you solve your doc flow linking issue?

I have a similar requirement to link opportunity line item BUS2000130 to Quotation item BUS2000149.

Unable to link the line items, but only headers. Opportunity being the next document linked to quotation.

Former Member
0 Kudos

Hello Kapil,

unfortunately I discovered, that the BOL API does not support this feature. Neither the way using the create_docflow BOL entity method of BTAdminH nor the way by creating a related entity relationship manually worked.

I postponed the implementation of this feature but I plan to realize it creating an own Z-relation in the BOL model which allows to link to items on GUID level without using the standard docflow.

Sorry that I cannot provide any better solultion.

Best regards,

Markus

sumeet_gehlot
Contributor
0 Kudos

Hi Markus,

you can create Docflow using this way as well.

DATA : lr_doc_flow_set  TYPE REF TO cl_crm_bol_entity,

              lr_doc_flow_all  TYPE REF TO cl_crm_bol_entity.

 

  DATA : lv_relation_name TYPE crmt_relation_name,

              es_attributes    TYPE crmst_docflow_btil.

" First you have to get the instance of BTAdminH : you vvan take help from this blog http://scn.sap.com/community/crm/webclient-ui-framework/blog/2013/11/28/sample-codes-for-bol-program...

  IF lr_btadminh IS BOUND.

    lr_doc_flow_set = lr_btadminh->get_related_entity( iv_relation_name = 'BTHeaderDocFlowSet' ).

    IF lr_doc_flow_set IS NOT BOUND.

      TRY.

          lr_doc_flow_set = lr_btadminh->create_related_entity( iv_relation_name = 'BTHeaderDocFlowSet' ).

        CATCH cx_crm_genil_model_error cx_crm_genil_duplicate_rel. "#EC NO_HANDLER

          "   should never happen

      ENDTRY.

    ENDIF.

    IF lr_doc_flow_set IS BOUND.

      es_attributes-ref_guid  = iv_opp_guid.

      es_attributes-objkey_a  = iv_opp_guid.

      es_attributes-objtype_a = 'BUS1000130'.

      es_attributes-objkey_b  = iv_parent_guid.

      es_attributes-objtype_b = 'BUS1000111'.

      es_attributes-vona_kind    = 'A'.

      es_attributes-reltype      = iv_rel_type..

      es_attributes-brel_kind    = 'A'.

      es_attributes-related_guid = iv_opp_guid.

DATA: lr_rel_entity     TYPE REF TO cl_crm_bol_entity.

  IF  lr_doc_flow_set IS BOUND.

    TRY.

        lr_rel_entity =   lr_doc_flow_set->create_related_entity( iv_relation_name = 'BTDocFlowAll' ).

      CATCH cx_crm_genil_duplicate_rel.

        "     should never happen

        RETURN.

      CATCH cx_crm_genil_model_error .                  "#EC NO_HANDLER

    ENDTRY.

    " Set entity attribute structure

    lr_rel_entity->set_properties(  EXPORTING is_attributes = es_attributes ).

  ENDIF.

Let me know if u required more help

Regards,

Sumeet

g

Former Member
0 Kudos

Hello Sumeet,

thanks for the fast response to my question.

Unfortunately I also tried the way you suggested before and it didn't work that way. A new related entity for docflow was created but rejected after commit to bol core. Maybe the problem is caused by the same check for header docflow linkage which is announced in the dump from the execute method.

Best regards,

Markus

sumeet_gehlot
Contributor
0 Kudos

Hi Markus,

Try to replicate the same in UI.

Also please check the config  in SPRO Define Item Category Determination when Copying-Here you have to assign Source Item Cat.to Source Item Cat.

you can also try implement the CRM_COPY_BADI. Implement the DOC_FLOW method in the interface.

if your problem is not resolved, can you please elaborte your business requirement in detail,

I will try in my system and let u know.

Regards,

Sumeet

Former Member
0 Kudos

Hello Sumeet,

tried to replicate UI process and found out that it is not possible to create a docflow linkage vor items in the related assignment block within item overview. The button for subsequent assingment of items is de-activated. I debugged and found out that there is not object linkage profile entry in customizing for items. I tried to change this by changing the entry for my object linkage profile in CRM_PSL_OBJECTR1. For some reason it is not possible to set here the checkbox item at opportunities. When I save the changed custmizing entry, the set checkbox for "Item" disappears. Is it possible that the docflow for items is only possible for some certain object types but not for opportunities?

If this is true, the other ways you suggested may also not be possible...

Best regards,

Markus

dhruv_mehta
Active Contributor
0 Kudos

do u want to use FM? if yes then i think i can help