cancel
Showing results for 
Search instead for 
Did you mean: 

Insert text type and content in notes tab in Freight Order Fiori App

rohitsharma34673
Explorer
0 Kudos
190

I need to insert the text type and content in the notes tab of the Freight Order Fiori App. The text type has already been configured at the functional level. I need to add the text content and text type through an ABAP Program. Please anyone share any code or solution related to this requirement. One of the solutions I found on discussion page was an incomplete code. 

Accepted Solutions (1)

Accepted Solutions (1)

DominikTylczyn
Active Contributor

Hello @rohitsharma34673 

I think your best bet is /SCMTMS/CL_TXC_HELPER class (note 3146279 - Helper for Notes : Text Collection CRUD operations)

Here is a very simple test report to illustrate how to use the class

REPORT ztest.
PARAMETERS:
  tor_id TYPE /scmtms/tor_id OBLIGATORY,
  schema TYPE /bobf/txc_text_schema_id OBLIGATORY,
  type   TYPE /bobf/txc_text_type OBLIGATORY,
  text   TYPE string OBLIGATORY LOWER CASE.


DATA:
  srv    TYPE REF TO /bobf/if_tra_service_manager,
  keys   TYPE /bobf/t_frw_key,
  failed TYPE /bobf/t_frw_key,
  msg    TYPE REF TO /bobf/if_frw_message,
  tra    TYPE REF TO /bobf/if_tra_transaction_mgr.

START-OF-SELECTION.

  srv = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).

  srv->convert_altern_key(
  EXPORTING
    iv_node_key = /scmtms/if_tor_c=>sc_node-root
    iv_altkey_key = /scmtms/if_tor_c=>sc_alternative_key-root-tor_id
    it_key = VALUE /scmtms/t_tor_id( ( tor_id ) )
  IMPORTING
    et_key = keys
  ).

  msg = /bobf/cl_frw_message_factory=>create_container( ).

  CALL METHOD /scmtms/cl_txc_helper=>create
    EXPORTING
      iv_text_schema_id = schema
      iv_text_type      = type
      iv_host_node_key  = /scmtms/if_tor_c=>sc_node-root
      iv_host_bo_key    = /scmtms/if_tor_c=>sc_bo_key
      iv_host_inst_key  = keys[ 1 ]-key
      iv_text_content   = text
    IMPORTING
      eo_message        = msg
      et_failed_key     = failed.

  tra = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).

  tra->save( ).

Bear in mind, that is not a ready made solution, e.g. it misses error handling. 

Best regards

Dominik Tylczynski

rohitsharma34673
Explorer
0 Kudos

Hi @DominikTylczyn

Thank you for your response. The create method of this class does not seem to work when there no TEXTCOLLECTION data for a freight order i.e. there in no data in TEXTCOLLECTION node in BO /SCMTMS/TOR for a freight order. Can you please suggest some solution regarding it.

Thanks 
Mudit Jain

DominikTylczyn
Active Contributor
0 Kudos

@rohitsharma34673 See my updated answer with a test report to create texts for a freight order

Answers (0)