The Fiori UI will look like:
(As prerequisite the maintenance type I1 must exist in the SAP customizing and functional locations must exist to add a notification to.)
METHOD notificationset_create_entity.
DATA: lv_NOTIF_TYPE TYPE bapi2080-notif_type,
lv_NOTIFHEADER TYPE bapi2080_nothdri,
ls_created_ntf_header TYPE bapi2080_nothdre,
lt_longtext TYPE TABLE OF bapi2080_notfulltxti,
ls_notif TYPE zcl_z_notif_mpc=>ts_notification_ih,
lt_bapiret2 TYPE TABLE OF bapiret2,
ls_t100_message TYPE scx_t100key.
lv_NOTIF_TYPE = 'I1'. "simple real estate message
io_data_provider->read_entry_data( IMPORTING es_data = ls_notif ).
lv_notifheader-funct_loc = ls_notif-funct_loc.
lv_notifheader-priority = ls_notif-priokx(1). "first character = key in text
SPLIT ls_notif-short_text AT cl_abap_char_utilities=>newline INTO
TABLE DATA(lt_lines) .
LOOP AT lt_lines ASSIGNING FIELD-SYMBOL(<f_line>).
APPEND INITIAL LINE TO lt_longtext ASSIGNING FIELD-SYMBOL(<f_longtext>).
<f_longtext>-objtype = 'QMEL' .
<f_longtext>-objkey = '00000000' .
<f_longtext>-FOrmat_col = 'AS' .
<f_longtext>-text_line = <f_line>.
ENDLOOP.
lv_notifheader-short_text = lt_lines[ 1 ] .
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
notif_type = lv_notif_type
notifheader = lv_notifheader
IMPORTING
notifheader_export = ls_created_ntf_header
TABLES
longtexts = lt_longtext
return = lt_bapiret2
.
LOOP AT lt_bapiret2 INTO DATA(lv_bapiret2) WHERE type CA 'EA'.
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
ls_t100_message-msgid = lv_bapiret2-id .
ls_t100_message-msgno = lv_bapiret2-number .
ls_t100_message-attr1 = lv_bapiret2-message_v1 .
ls_t100_message-attr2 = lv_bapiret2-message_v2.
ls_t100_message-attr3 = lv_bapiret2-message_v3.
ls_t100_message-attr4 = lv_bapiret2-message_v4.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = ls_t100_message.
ENDIF.
CALL FUNCTION 'BAPI_ALM_NOTIF_SAVE'
EXPORTING
number = ls_created_ntf_header-notif_no
IMPORTING
notifheader = ls_created_ntf_header
TABLES
return = lt_bapiret2.
LOOP AT lt_bapiret2 INTO lv_bapiret2 WHERE type CA 'EA'.
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception .
ENDIF.
er_entity = ls_notif.
er_entity-qmnum = ls_created_ntf_header-notif_no .
ENDMETHOD.
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:Reference Uri="/sap/opu/odata/sap/Z_NOTIF_SRV/$metadata">
<edmx:Include Alias="Metadata" Namespace="Z_NOTIF_SRV"/>
</edmx:Reference>
<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470968/UI.xml?api=v2">
<edmx:Include Alias="UI" Namespace="com.sap.vocabularies.UI.v1"/>
</edmx:Reference>
<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470974/Common.xml?api=v2">
<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Notification.annotation0.Z_NOTIF_SRV">
<Annotations Target="Metadata.notification_ih">
<Annotation Term="UI.QuickCreateFacets">
<Collection>
<Record Type="UI.ReferenceFacet">
<PropertyValue Property="Target" AnnotationPath="@UI.FieldGroup#QuickCreate"/>
</Record>
</Collection>
</Annotation>
<Annotation Term="UI.FieldGroup" Qualifier="QuickCreate">
<Record Type="UI.FieldGroupType">
<PropertyValue Property="Data">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="Priokx"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="FunctLoc"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="ShortText">
<Annotation Term="UI.MultiLineText" Bool="true"/>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
<PropertyValue Property="Label" String="{@i18n>appDescription}"/>
</Record>
</Annotation>
<Annotation Term="Common.SemanticKey">
<Collection>
<PropertyPath>NotifNumber</PropertyPath>
</Collection>
</Annotation>
</Annotations>
<Annotations Target="Metadata.notification_ih/ShortText">
<Annotation Term="UI.MultiLineText" Bool="true"/>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
objectCreated: function(context) {
document.getElementById("__button0").innerHTML = "<h2> Message was created with number" + context.sPath.substring(18, 26) + "</h2>" ;
},
METHOD t356_tset_get_entityset.
SELECT FROM t356_t
FIELDS
priok,
priokx
WHERE spras EQ @sy-langu AND
artpr = '$1'
ORDER BY priok
INTO CORRESPONDING FIELDS OF TABLE @et_entityset
.
ENDMETHOD.
METHOD define.
DATA : lv_namespace TYPE string,
lr_annotation TYPE REF TO cl_fis_shlp_annotation,
lr_annotation2 TYPE REF TO cl_fis_shlp_annotation.
super->define( ) .
model->set_soft_state_enabled( iv_soft_state_enabled = abap_true ).
model->get_schema_namespace( IMPORTING ev_namespace = lv_namespace ).
"Priority Search Help Annotation
lr_annotation = cl_fis_shlp_annotation=>create(
io_odata_model = model
io_vocan_model = vocab_anno_model
iv_namespace = lv_namespace
iv_entitytype = 'notification_ih'
iv_property = 'Priokx'
iv_valuelist_entityset = 'T356_TSet'
iv_valuelist_property = 'Priokx' ) .
" lr_annotation->add_display_parameter( iv_valuelist_property = 'Name' ) .
" lr_annotation->add_display_parameter( iv_valuelist_property = 'Description' ) .
" lr_annotation->add_display_parameter( iv_valuelist_property = 'PostCode' ) .
" lr_annotation->add_display_parameter( iv_valuelist_property = 'City' ) .
DATA(lo_txt_property2) = model->get_entity_type( 'notification_ih' )->get_property( 'Priokx' ).
lo_txt_property2->set_value_list( /iwbep/if_mgw_odata_property=>gcs_value_list_type_property-fixed_values ).
"Functional Location Search Help Annotation
lr_annotation2 = cl_fis_shlp_annotation=>create(
io_odata_model = model
io_vocan_model = vocab_anno_model
iv_namespace = lv_namespace
iv_entitytype = 'notification_ih'
iv_property = 'FunctLoc'
iv_search_help = 'IFLMT'
iv_search_help_field = 'TPLNR'
iv_valuelist_entityset = 'IflmtSet'
iv_valuelist_property = 'Tplnr' ).
lr_annotation2->add_display_parameter( iv_valuelist_property = 'Pltxt' ) .
lr_annotation2->add_display_parameter( iv_valuelist_property = 'Spras' ) .
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 |