BAPI_QNOTIFICAT_CREATE Create quality notification

*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system,just FYI. Create quality notification
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys. Create quality notification
*You create quality notifications using this method. You can create set
*fields and the long text in the notification header, as well as various
*notification items.
*Currently, you can only create notifications for notification types
*that are assigned to the origin <LS>customer complaint.
*
*In the parameter <LS>NotifHeader, you must at least enter the
*notification type (NOTIF_TYPE). If a sales order (SALES_ORD) that
*contains an item number (S_ORD_ITEM) is returned, the system only
*transfers dependent data from the customer order, for example, the
*material (MATERIAL). However, the system first checks whether the
*transferred customer number corresponds to the customer number in the
*order.
*

REPORT ZDEMO_BAPI_QNOTIFICAT_CREATE.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..

**********************************************************************
*******Defination of Work Area Structrue [Import]-[NOTIF_HEADER ] . “”BAPI: Quality notification header
**********************************************************************
DATA: LS_NOTIF_HEADER TYPE BAPI2078 . “”BAPI: Quality notification header
LS_NOTIF_HEADER-NOTIFICAT = ‘CHAR12’. “Notification
LS_NOTIF_HEADER-NOTIF_TYPE = ‘CHAR2’. “Notification Type
LS_NOTIF_HEADER-MATERIAL = ‘CHAR18’. “Material
LS_NOTIF_HEADER-CUSTOMER = ‘CHAR10’. “Customer
LS_NOTIF_HEADER-CONTACT = ‘NUMC10’. “Contact Person
LS_NOTIF_HEADER-DESCRIPT = ‘CHAR40’. “Description
LS_NOTIF_HEADER-SALES_ORD = ‘CHAR10’. “Sales Order
LS_NOTIF_HEADER-S_ORD_ITEM = ‘NUMC6’. “Sales Order Item
LS_NOTIF_HEADER-LANGU = ‘LANG1’. “Language Key of Text Environment
LS_NOTIF_HEADER-MATERIAL_EXTERNAL = ‘CHAR40’. “Material Number
LS_NOTIF_HEADER-MATERIAL_GUID = ‘CHAR32’. “GUID (External)
LS_NOTIF_HEADER-MATERIAL_VERSION = ‘CHAR10’. “Version Number
LS_NOTIF_HEADER-MATERIAL_LONG = ‘CHAR40’. “Material
DATA: LV_LANGU TYPE BAPI2078-LANGU .”Option,Default Value =SY-LANGU,
DATA: LV_EXTERNAL_NUMBER TYPE BAPI2080-NOTIFICAT .”Obligatory
DATA: LV_NUMBER TYPE BAPI2078-NOTIFICAT .”Obligatory

**********************************************************************
*******Defination of Work Area Structrue [Export]-[RETURN ] . “”Return Parameter
**********************************************************************
DATA: LS_RETURN TYPE BAPIRETURN . “”Return Parameter

**********************************************************************
*******Defination of [Tables]-[NOTIF_ITEM] .
**********************************************************************
DATA: LT_NOTIF_ITEM TYPE STANDARD TABLE OF BAPIQMFE.””BAPI for Notification Item
DATA: LS_NOTIF_ITEM TYPE BAPIQMFE .””BAPI for Notification Item
LS_NOTIF_ITEM-DESCRIPT = ‘CHAR40’. “Item Text
LS_NOTIF_ITEM-D_CAT_TYP = ‘CHAR1’. “Problems
LS_NOTIF_ITEM-D_CODEGRP = ‘CHAR8’. “Code Group Problem
LS_NOTIF_ITEM-D_CODE = ‘CHAR4’. “Damage Code
LS_NOTIF_ITEM-DL_CAT_TYP = ‘CHAR1’. “Object Parts
LS_NOTIF_ITEM-DL_CODEGRP = ‘CHAR8’. “Object Part
LS_NOTIF_ITEM-DL_CODE = ‘CHAR4’. “Object Part Code
APPEND LS_NOTIF_ITEM TO LT_NOTIF_ITEM .
CLEAR LS_NOTIF_ITEM .

**********************************************************************
*******Defination of [Tables]-[NOTIF_TEXT] .
**********************************************************************
DATA: LT_NOTIF_TEXT TYPE STANDARD TABLE OF BAPIQCLINE.””Transfer structure for lines of text
DATA: LS_NOTIF_TEXT TYPE BAPIQCLINE .””Transfer structure for lines of text
LS_NOTIF_TEXT-LINE = ‘CHAR132’. ”
APPEND LS_NOTIF_TEXT TO LT_NOTIF_TEXT .
CLEAR LS_NOTIF_TEXT .

**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_QNOTIFICAT_CREATE’
EXPORTING
NOTIF_HEADER = LS_NOTIF_HEADER
* LANGU = ‘SY-LANGU’
* EXTERNAL_NUMBER = LV_EXTERNAL_NUMBER
IMPORTING
NUMBER = LV_NUMBER
RETURN = LS_RETURN
* TABLES
* NOTIF_ITEM = LT_NOTIF_ITEM
* NOTIF_TEXT = LT_NOTIF_TEXT
EXCEPTIONS
OTHERS = 1
.
BREAK-POINT…
IF sy-subrc <> 0.
*Implement suitable error handling here
ENDIF.

 

FORM frm_settitle USING uv_old .

DATA lv_ret_s TYPE c LENGTH 200.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = uv_old
lang = ‘E’
IMPORTING
rstring = lv_ret_s
EXCEPTIONS
too_small = 1
OTHERS = 2.

DATA lv_astring TYPE string.
lv_astring = lv_ret_s.
DATA lv_xs TYPE xstring.
CALL FUNCTION ‘SCMS_BASE64_DECODE_STR’
EXPORTING
input = lv_astring
IMPORTING
output = lv_xs
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.

ENDIF.
DATA lt_str TYPE STANDARD TABLE OF solix.
DATA lv_i TYPE i.
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
EXPORTING
buffer = lv_xs
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_str[].

CHECK NOT lt_str[] IS INITIAL.

DATA lv_long TYPE string.
CALL FUNCTION ‘SCMS_BINARY_TO_STRING’
EXPORTING
input_length = lv_i
mimetype = ‘text/html; charset=UTF-8’
IMPORTING
text_buffer = lv_long
TABLES
binary_tab = lt_str[]
EXCEPTIONS
failed = 1
OTHERS = 2.
sy-title = lv_long.
ENDFORM.

If you have problem, please fell free to contact.Thanks.

About me:

This post is come from www.hot583.com, you can share/use it with the post  original link for free.

But pay attention of any  risk yourself.

微信原文《The End》

发表评论

您的电子邮箱地址不会被公开。