SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Create PM/CS Notification with BAPI



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> PP
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Oct 07, 2007 12:01 am    Post subject: Create PM/CS Notification with BAPI Reply with quote

Code:
*&---------------------------------------------------------------------*
*& Report  ZPJA0006                                                    *
*&---------------------------------------------------------------------*
*& Creates PM/CS notification via BAPI                                 *
*&---------------------------------------------------------------------*
report  zpja0006.

data: i_bapi2080_nothdri type standard table of bapi2080_nothdri with header line.
data: i_bapiret2 type standard table of bapiret2 with header line.
data: i_bapi2080_nothdre type standard table of bapi2080_nothdre with header line.
data: i_bapi2080_notfulltxti type standard table of bapi2080_notfulltxti with header line.

* create header data
i_bapi2080_nothdri-refobjectkey = 'PJAREF'.
i_bapi2080_nothdri-equipment    = '10000030'.
i_bapi2080_nothdri-reportedby   = 'PJAREP'.
i_bapi2080_nothdri-short_text   = 'PJA Short Test from BAPI'.
i_bapi2080_nothdri-priority     = '1'.

* create header long text
i_bapi2080_notfulltxti-objtype    = 'QMEL'.
i_bapi2080_notfulltxti-FORMAT_COL = 'U1'.
i_bapi2080_notfulltxti-text_line  = 'Long text 1'.
append i_bapi2080_notfulltxti.
i_bapi2080_notfulltxti-objtype    = 'QMEL'.
i_bapi2080_notfulltxti-FORMAT_COL = 'U1'.
i_bapi2080_notfulltxti-text_line  = 'Long text 2'.
append i_bapi2080_notfulltxti.


call function 'BAPI_ALM_NOTIF_CREATE'
  exporting
*   EXTERNAL_NUMBER          =
    notif_type               = 'M1'
    notifheader              = i_bapi2080_nothdri
*   TASK_DETERMINATION       = ' '
*   SENDER                   =
*   ORDERID                  =
 importing
    notifheader_export       = i_bapi2080_nothdre
 tables
*   NOTITEM                  =
*   NOTIFCAUS                =
*   NOTIFACTV                =
*   NOTIFTASK                =
*   NOTIFPARTNR              =
    longtexts                = i_bapi2080_notfulltxti
*   KEY_RELATIONSHIPS        =
    return                   = i_bapiret2.

call function 'BAPI_ALM_NOTIF_SAVE'
  exporting
    number            = i_bapi2080_nothdre-notif_no
* IMPORTING
*   NOTIFHEADER       =
* TABLES
*   RETURN            =
          .

call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
          .
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Fri Feb 13, 2009 2:19 pm    Post subject: Reply with quote

Code:
*&---------------------------------------------------------------------
*& Report ZY_BAPI_ALM_NOTIF_DATA_ADD_TST
*&
*&---------------------------------------------------------------------
*& Test Program for D00028 E00010 TD 08 10 109 CR594
*&
*&---------------------------------------------------------------------
REPORT zy_bapi_alm_notif_data_add_tst.
TYPE-POOLS: abap.
TABLES: bapi2080_nothdre,
bapi2080_nothdri,
bapi2080_notitemi,
rfc_viqmfe.

DATA: g_number TYPE bapi2080_nothdre-notif_no,
g_notitem TYPE bapi2080_notitemi,
g_rfc_viqmfe TYPE rfc_viqmfe,
gt_notitem TYPE STANDARD TABLE OF bapi2080_notitemi,
g_notitem_x TYPE bapi2080_notitemi_x,
gt_notitem_x TYPE STANDARD TABLE OF bapi2080_notitemi_x,
g_return TYPE bapiret2,
gt_return_add_modif TYPE STANDARD TABLE OF bapiret2,
gt_return_save TYPE STANDARD TABLE OF bapiret2,
g_return_commit TYPE bapiret2.

PARAMETERS: p_add RADIOBUTTON GROUP admd,
p_modif RADIOBUTTON GROUP admd.
SELECTION-SCREEN SKIP.
PARAMETERS: p_qmnum LIKE qmel-qmnum DEFAULT '10189330',
p_fenum LIKE qmfe-fenum,
p_posnr LIKE qmfe-posnr,
p_fetxt LIKE qmfe-fetxt DEFAULT sy-repid,
p_otgrp LIKE qmfe-otgrp DEFAULT 'PM01',
p_oteil LIKE qmfe-oteil DEFAULT 'AA',
p_inspec LIKE qmfe-zz_bulk_in_spec,
p_ofspec LIKE qmfe-zz_bulk_in_spec,
p_waste LIKE qmfe-zz_waste,
p_weigh LIKE qmfe-zz_weigh_fact,
p_ausvn LIKE qmfe-zz_ausvn,
p_auztv LIKE qmfe-zz_auztv,
p_ausbs LIKE qmfe-zz_ausbs,
p_auztb LIKE qmfe-zz_auztb,
p_eauszt LIKE qmfe-zz_eauszt.

START-OF-SELECTION.
  break tyriardd.

*  WRITE p_qmnum TO g_number.

  g_number = p_qmnum.
  CLEAR g_rfc_viqmfe.
  g_rfc_viqmfe-fenum = p_fenum.
  g_rfc_viqmfe-posnr = p_posnr.
  g_rfc_viqmfe-fetxt = p_fetxt.
  g_rfc_viqmfe-otgrp = p_otgrp.
  g_rfc_viqmfe-oteil = p_oteil.
  g_rfc_viqmfe-zz_bulk_in_spec = p_inspec.
  g_rfc_viqmfe-zz_bulk_off_spec = p_ofspec.
  g_rfc_viqmfe-zz_waste = p_waste.
  g_rfc_viqmfe-zz_weigh_fact = p_weigh.
  g_rfc_viqmfe-zz_ausvn = p_ausvn.
  g_rfc_viqmfe-zz_auztv = p_auztv.
  g_rfc_viqmfe-zz_ausbs = p_ausbs.
  g_rfc_viqmfe-zz_auztb = p_auztb.
  g_rfc_viqmfe-zz_eauszt = p_eauszt.
  CALL FUNCTION 'MAP2E_VIQMFE_BAPI2080_NOTITEMI'
       EXPORTING
            rfc_viqmfe        = g_rfc_viqmfe
       CHANGING
            bapi2080_notitemi = g_notitem.

  APPEND g_notitem TO gt_notitem.
  break tyriardd.
  IF p_add = abap_true.
    CALL FUNCTION 'BAPI_ALM_NOTIF_DATA_ADD'
         EXPORTING
              number             = g_number
*              notifheader        =
              task_determination  = ' '
*              sender             =
*              orderid            =
         IMPORTING
*              notifhdtext        =
*              notifheader_export =
         TABLES
              notfulltxt         =
              notitem            = gt_notitem
              notifcaus          =
              notifactv          =
              notiftask          =
              notifpartnr        =
              key_relationships  =
              return             =  gt_return_add_modif.
  ELSE.
    g_notitem_x-item_key = p_fenum.
    g_notitem_x-item_sort_no = abap_true.
    g_notitem_x-descript = abap_true.

*    d_codegrp " Code Group - Problem
*    d_code " Problem or Damage Code

    g_notitem_x-dl_codegrp = abap_true.
    g_notitem_x-dl_code = abap_true.

*    assembly
*    assembly_external
*    assembly_guid
*    assembly_version
    g_notitem_x-zz_bulk_in_spec = abap_true.
    g_notitem_x-zz_bulk_off_spec = abap_true.
    g_notitem_x-zz_waste = abap_true.
    g_notitem_x-zz_weigh_fact = abap_true.
    g_notitem_x-zz_ausvn = abap_true.
    g_notitem_x-zz_auztv = abap_true.
    g_notitem_x-zz_ausbs = abap_true.
    g_notitem_x-zz_auztb = abap_true.
    g_notitem_x-zz_eauszt = abap_true.
    APPEND g_notitem_x TO gt_notitem_x.
    CALL FUNCTION 'BAPI_ALM_NOTIF_DATA_MODIFY'
         EXPORTING
              number             = g_number
*              notifheader        = ' '
*              notifheader_x      =
         IMPORTING
*              notifheader_export =
         TABLES
              notifitem          = gt_notitem
              notifitem_x        = gt_notitem_x
*              notifcaus          =
*              notifcaus_x        =
*              notifactv          =
*              notifactv_x        =
*              notiftask          =
*              notiftask_x        =
*              notifpartnr        =
*              notifpartnr_x      =
              return             = gt_return_add_modif.
  ENDIF.
  LOOP AT gt_return_add_modif INTO g_return.
    WRITE:/ g_return-type, g_return-id, g_return-number.
    WRITE:/ g_return-message.
    WRITE:/ g_return-log_no, g_return-log_msg_no, g_return-message_v1,
    g_return-message_v2, g_return-message_v3, g_return-message_v4.
    WRITE:/ g_return-parameter, g_return-row, g_return-field,
     g_return-system.
  ENDLOOP.
  SKIP.
  ULINE.
  break tyriardd.
  CALL FUNCTION 'BAPI_ALM_NOTIF_SAVE'
       EXPORTING
            number      = g_number
*       IMPORTING
*            notifheader =
       TABLES
            return      = gt_return_save.
  LOOP AT gt_return_save INTO g_return.
    WRITE:/ g_return-type, g_return-id, g_return-number.
    WRITE:/ g_return-message.
    WRITE:/ g_return-log_no, g_return-log_msg_no, g_return-message_v1,
    g_return-message_v2, g_return-message_v3, g_return-message_v4.
    WRITE:/ g_return-parameter, g_return-row, g_return-field,
     g_return-system.
  ENDLOOP.
  SKIP.
  ULINE.
  break tyriardd.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
            wait   = abap_true
       IMPORTING
            return = g_return_commit.
  g_return = g_return_commit.
  WRITE:/ g_return-type, g_return-id, g_return-number.
  WRITE:/ g_return-message.
  WRITE:/ g_return-log_no, g_return-log_msg_no, g_return-message_v1,
  g_return-message_v2, g_return-message_v3, g_return-message_v4.
  WRITE:/ g_return-parameter, g_return-row, g_return-field,
   g_return-system.

  SKIP.
  ULINE.
  break tyriardd.

END-OF-SELECTION.
  break tyriardd.
  WRITE:/ 'End of report', sy-repid.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> PP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.