How To Read text with BOL programming

How to read text lines of an order with bol programming:

  DATA: lr_core             TYPE REF TO cl_crm_bol_core,
        lr_entity           TYPE REF TO cl_crm_bol_entity,
        lr_adminh           TYPE REF TO cl_crm_bol_entity,
        lr_texts_all        TYPE REF TO if_bol_entity_col,
        lr_iterator         TYPE REF TO if_bol_entity_col_iterator,

        lv_text             TYPE string.


  lr_core = cl_crm_bol_core=>get_instance( ).
  CHECK lr_core IS BOUND.

  TRY.
      lr_entity = lr_core->get_root_entity( iv_object_name = 'BTOrder'
                                             iv_object_guid = iv_guid ).
    CATCH cx_root.
      "CATCH cx_crm_genil_general_error . 
      lr_core->load_component_set( 'ONEORDER' ).
      lr_entity = lr_core->get_root_entity( iv_object_name = 'BTOrder'
                                             iv_object_guid = iv_guid ).
  ENDTRY.

  CHECK lr_entity IS BOUND.
  lr_adminh = lr_entity->get_related_entity( iv_relation_name = 'BTOrderHeader' ).

  CHECK lr_adminh IS BOUND.
  lr_entity = lr_adminh->get_related_entity( iv_relation_name = 'BTHeaderTextSet' ).

  CHECK lr_entity IS BOUND.
  lr_texts_all = lr_entity->get_related_entities( iv_relation_name = 'BTTextHAll' ).

  CHECK lr_texts_all IS BOUND.
  lr_iterator = lr_texts_all->get_iterator( ).

  CHECK lr_iterator IS BOUND.

  lr_entity = lr_iterator->get_first( ).
  WHILE lr_entity IS BOUND.
    IF lr_entity->get_property_as_string( 'TDID' ) EQ 'ZH47'. 
      lv_text = lr_entity->get_property( 'CONC_LINES' ).
      EXIT.
    ENDIF.
    lr_entity = lr_iterator->get_next( ).
  ENDWHILE.
  



ABOUT Uğur Kaya

http://linkedin.com/in/kayau

RELATED POSTS

COMMENTS

comments powered by Disqus