SAP & Oracle partner and support companies

Loading

Archives 2025

SAP

A to Z of Custom Change Pointer

In this document, I have made an effort to provide the consistently expected details needed to implement custom change pointers for the custom fields in the custom tables for the custom change object and custom message type.

Configurations and Steps to implement custom change pointer:

Step 1. Make the data type of custom fields ready to record changes. (A to Z of Custom Change Pointer)

For demo, I have utilized the beneath custom table with custom fields.

The information components of the multitude of three custom fields have the Change report checked.

Step 2. Create custom message type (T-code WE81). A to Z of Custom Change Pointer
For instance I have made message type Z1P_MATMAS.

Step 3. Activate this message type to catch change pointers (T-code BD50).

Step 4. Create custom Change Document Object to link changes (T-code SCDO).

Put the custom table name (ZTEST_RS for this demo). You can add more than one tables

Step 5. Generate the custom Function Module to update changed documents (T-code SCDO).
Click Produce update pgm button.

Save it.
A new data dictionary structure called YZTEST_RS is also generated, along with an FM Z_MATMAS_WRITE_DOCUMENT to update change pointer. To trace the change pointers, the custom code would call FM Z_MATMAS_WRITE_DOCUMENT.

Step 6. Check the generated FM Z_MATMAS_WRITE_DOCUMENT.

Check the Tables area. Two tables are characterized. One is for information before change and the other is for information after change.

Kindly note: naturally the Tables in the FM are required. Assuming that you added more than one table in the exchange SCDO while creating the FM, you can make these tables as discretionary physically in SE37, so you can involve similar FM for change pointers for various tables.

Step 7. Link the change document Object, Table and Fields for the given Message Type (BD52).

Please take note that although though the field name “KEY” isn’t a field of any table, it should be provided for every table.
Except for the KEY field, the message type is directly referenced to the material expert’s fields and tables. Although it is not necessary for the specific table, this field anticipates a crucial, additional control task. A change pointer is created while creating the corresponding object in Exchange BD52 if the KEY field is identified.

Step 8. Evaluating Change Pointers (T-code BD60).
The change pointers are then assessed. It simply relies upon the article concerned what capability module is utilized here.
The capability module, MASTERIDOC_CREATE_SMD_MATMAS, which utilizations change pointers to produce IDocs is called.

Step 9. Write the custom code in the TMG event to capture changed/created data. (This is not the only way. You can write your code in other suitable areas)

Details to add event is also there in other post: http://help-sap.blogspot.com/search?q=event

In the Generate Table Maintenance screen go to Menu Environment->Modification->Events.

You will see the following screen.

Click the New Entries button and select the event you want to use and the Routine name.

Click the Manager and make your daily practice in the Incorporate program and compose the code in the daily practice to meet your prerequisite.

Sample Code to catch change pointers

FORM z_before_save.

CONSTANTS:
c_insert TYPE cdchngind VALUE ‘I’,
c_update TYPE cdchngind VALUE ‘U’,
c_check TYPE boolean VALUE ‘X’.

DATA: li_ztest_rs_old TYPE STANDARD TABLE OF ztest_rs INITIAL SIZE 0,
li_xztest_rs TYPE STANDARD TABLE OF yztest_rs INITIAL SIZE 0,
li_yztest_rs TYPE STANDARD TABLE OF yztest_rs INITIAL SIZE 0,
li_cdtext TYPE STANDARD TABLE OF cdtxt INITIAL SIZE 0,
lk_ztest_rs_x TYPE ztest_rs,
lk_ztest_rs_old TYPE ztest_rs,
lk_xztest_rs TYPE yztest_rs,
lk_yztest_rs TYPE yztest_rs,
lv_object TYPE cdobjectv.

* Sort
SORT i_ztest_rs_x[] BY zmatnr zplant.
* This will have the most recent data
DELETE ADJACENT DUPLICATES FROM i_ztest_rs_x[] COMPARING zmatnr zplant.

* Initial check
IF i_ztest_rs_x[] IS NOT INITIAL.

* Get old data
SELECT * FROM ztest_rs
INTO TABLE li_ztest_rs_old ” Old Data
FOR ALL ENTRIES IN i_ztest_rs_x
WHERE zmatnr = i_ztest_rs_x-zmatnr
AND zplant = i_ztest_rs_x-zplant.
* Looping through the current data set
LOOP AT i_ztest_rs_x INTO lk_ztest_rs_x.

* Read the old data if available
READ TABLE li_ztest_rs_old INTO lk_ztest_rs_old
WITH KEY zmatnr = lk_ztest_rs_x-zmatnr
zplant = lk_ztest_rs_x-zplant.

IF sy-subrc EQ 0.
* If found then check whether anything is changed or not
IF lk_ztest_rs_x-zmatnr NE lk_ztest_rs_old-zmatnr
OR lk_ztest_rs_x-zplant NE lk_ztest_rs_old-zplant
OR lk_ztest_rs_x-zmaktx NE lk_ztest_rs_old-zmaktx .

MOVE-CORRESPONDING lk_ztest_rs_x TO lk_xztest_rs.
* This is important
lk_xztest_rs-kz = c_update.
* Keep the new data
APPEND lk_xztest_rs TO li_xztest_rs[].

MOVE-CORRESPONDING lk_ztest_rs_old TO lk_yztest_rs.
* This is important
lk_yztest_rs-kz = c_update.
* Keep the old data
APPEND lk_yztest_rs TO li_yztest_rs[].

lv_object = lk_ztest_rs_x-zmatnr.

* Write the change pointer for changed record
CALL FUNCTION ‘Z_MATMAS_WRITE_DOCUMENT’
EXPORTING
objectid = lv_object
tcode = sy-tcode
utime = sy-uzeit
udate = sy-datum
username = sy-uname
upd_ztest_rs = c_update
TABLES
icdtxt_z_matmas = li_cdtext[]
xztest_rs = li_xztest_rs[]
yztest_rs = li_yztest_rs[].

REFRESH: li_cdtext[], li_xztest_rs[], li_yztest_rs[].
CLEAR: lv_object.
ENDIF.
* If not found, that means it is a new entry
ELSE.
MOVE-CORRESPONDING lk_ztest_rs_x TO lk_xztest_rs.
* This is important
lk_xztest_rs-kz = c_insert.
* Keep the new data
APPEND lk_xztest_rs TO li_xztest_rs[].

lv_object = lk_ztest_rs_x-zmatnr.

* Write the change pointer for new record/insert record
CALL FUNCTION ‘Z_MATMAS_WRITE_DOCUMENT’
EXPORTING
objectid = lv_object
tcode = sy-tcode
utime = sy-uzeit
udate = sy-datum
username = sy-uname
upd_ztest_rs = c_insert
TABLES
icdtxt_z_matmas = li_cdtext[]
xztest_rs = li_xztest_rs[]
yztest_rs = li_yztest_rs[].

REFRESH: li_cdtext[], li_xztest_rs[], li_yztest_rs[].
CLEAR: lv_object.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. “z_before_save

In order to feed data in the event above, we nee to populate data (I_ZTEST_RS_X[ ]) in the custom database table screen. Write code to keep the run-time table data needed for the above logic.

The changes are logged in the standard table BDCP2. Let us check for any entry in the table for my userid and today’s date
MODULE get_new_or_changed_values INPUT.
* Keep the screen number
CONSTANTS: c_screen_0001 TYPE sydynnr VALUE ‘0001’.

* Get the data and keep in internal table to be used later
IF sy-dynnr = c_screen_0001.
APPEND ztest_rs TO i_ztest_rs_x.
ENDIF.

ENDMODULE.

You might have to pronounce a few worldwide information.
This finishes the design and custom code to get the change recognition.

Sample Output to register change pointers for Create and Change:

The progressions are signed in the standard table BDCP2. Allow us to check for any section in the table for my userid and the present date

No section is found.
Presently I will Make/Add a section in the custom table by t-code SM30 and save it.

Go to table BDCP2 and search for records. Check one passage is effectively logged.

Change a section and really look at the table for the change pointer.

Check another passage has been added.


Transactions to remember
1. SE11 to check the data type is active to record changes and to create events.
2. SE81 to create message type.
3. BD50 to activate the message type to catch change pointers.
4. SCDO to create Change Objects and generate program/function module to write change pointers.
5. BD52 to link Message Type, Change Objects, Tables and Fields.
6. BD60 to link Message Type to Standard Function Module.

Highlight recollect

In exchange BD52, field name ‘KEY’ ought to be given for each table despite the fact that it’s anything but a field of any table.

YOU MAY LIKE THIS

SAP edi idoc

What is an SAP query?

CDS in Action: Building Practical Applications

SAP

IDoc Tips—Change Pointers and Reprocessing IDocs

IDoc reprocessing in SAP IDoc: Reprocessing IDocs and Change Pointers—Valuable Exchanges

Reviewing the Fruitful IDocs again
We are unable to reprocess successful IDocs using BD87, but occasionally, particular problems may require us to resend a usually handled, successful IDoc.

BD21 – Making IDoc Types from Change Pointers (Change Pointers and Reprocessing IDocs )
At times a great deal of Progress Pointer gets made, yet neglects to get handled because of framework issues.
This t-code is very useful to create IDocs from natural change pointers. The situation with change pointer can undoubtedly be checked from BDCPV table/view.

BD22 – Erase Change Pointers (Change Pointers and Reprocessing IDocs )
In the creation climate, this one is also quite helpful. We occasionally encounter circumstances where a significant number of progress indicators are generated due to incorrect configuration or settings. This t-code is really helpful to remove them from the framework and clean up the associated data.

Additionally, you can retransmit documents from the relevant application, such as Shipment, Conveyance, and Buy Request, by going back over the Result Type if the number of documents that need to be retransmitted is limited.

Be that as it may, when we really want to send different IDocs, utilizing the standard program RC1_IDOC_SET_STATUS is very useful.

You can go to WE02 or WE09, duplicate all the handled IDoc numbers and glue them in the wake of executing this program in SE38. You would likewise have to indicate the new IDoc status.

On the off chance that you really want to handle this IDoc again utilizing BD87, you can’t straightforwardly set something very similar to 30 (IDoc prepared for dispatch), as BD87 recalls the last status (which was ’53’- Application archive posted) and consequently wouldn’t again deal with this IDoc.

Consequently we can change the status to say some transitional one like 32 – (IDoc was altered) and afterward again run this program and change the status t0 30 from 32.

How to find BADIs?

From that point forward, we can again deal with this IDocs utilizing BD87 and yet again send them to the outer framework like EDI.

YOU MAY BE INTERESTED IN

What is IDoc used for?

Just a key and two clicks for ALV consistency check

Message Processing and Transformation in SAP PO

SAP

Tool for GOS attachment from one SAP system to another SAP system

1

Another organization (let’s say XYZ, which is also in SAP) was acquired by your association (let’s say Shy, which is in SAP). The design calls for a field-tested approach that cycles from XYZ to Hesitant and stacks all the information. They must thus establish the links between XYZ business objects and related business objects in the Bashful framework. Tool for GOS attachment from one SAP system to another SAP system.

This basic instrument would transfer any connections (pdf, txt, xls, xml and so on) from source sap framework to target sap framework for all business object types.

Tool for GOS attachment from one SAP system to another SAP system

Stage 1
Plan document with Target Items (PO/PR/Merchant/Materials/Agreements and so on) and comparing Source Articles. Make a point to have comparing driving zeroes for every one of the items. Model PR would have absolute 10 characters; materials would have all out 18 characters, the seller would have complete 10 characters with driving zeroes and so on.

The following is a model record (xls) of Procurement Req from Shy and XYZ framework.

5

Step 2
Execute program Z_GOS_PREPARE_FILE in target system.

2

Step 3
Execute program Z_GOS_ATTACHMENT in target system.

3
4

Common Business Objects

Pur Req  = BUS2105      Material = BUS1001 or BUS1001006
Pur Ord  = BUS2012      Vendor  = LFA1   Contract = BUS2014  etc

Step 4
Validation for our example:

Go to ME53N for Buy Order in source Framework

6

Go to ME53N for Buy Demand in target Framework

7

ABAPer would be more inspired by the code to accomplish the above functionalities.
Kindly find the functioning code joined in four documents. If it’s not too much trouble, click the connection on the right.

Real Time Exchange Rate with Real Time Data Using Yahoo Finance API

Programs:
1) Program to prepare the input file.     z_gos_prepare_file
2) Main program for attachments.          z_gos_attachment

Function Modules:

1) RFC FM in source (XYZ) system.    z_get_xyz_gos_attachment_rfc
2) RFC FM in target (COY) system.    z_gos_attach_to_coy_rfc

Kindly note: in the Fundamental program (in PERFORM get_rfc_name), you really want to put the RFC name of your framework Being developed, Quality and Creation framework separately.

YOU MAY LIKE THIS

Unleashing the Power of Search Help Exit in SAP ABAP

Best Practices for SAP Cloud Platform Development: A Comprehensive Guide

SAP ABAP Online Training: Advanced Business Application

SAP

Sample program to attach any file from application server to any Business Object

ABAP GOS attachment from application server Let’s get started on Sample program to attach any file from the application server to any Business Object.

* Sample program to attach documents to any business object
REPORT z_gos_attachment NO STANDARD PAGE HEADING
LINE-COUNT 132.
*———————————————————————*
* SELECTION SCREEN                                                    *
*———————————————————————*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file   TYPE localfile,      ” Application File Path
p_objid  TYPE swo_typeid,               ” Any object like material no./vendor
“/customer/po/pr etc
p_bo     TYPE swo_objtyp.                ” Business object like LFA1 for vendor
SELECTION-SCREEN END OF BLOCK b1.
DATA:
li_content   TYPE  STANDARD TABLE OF soli,
li_objhead   TYPE STANDARD TABLE OF soli,
lwa_folmem_k TYPE sofmk,
lwa_note     TYPE borident,
lwa_object   TYPE borident,
lwa_obj_id   TYPE soodk,
lwa_content  TYPE soli,
lwa_fol_id   TYPE soodk,
lwa_obj_data TYPE sood1,
lv_ep_note   TYPE borident-objkey,
lv_lifnr     TYPE lifnr,
lv_file      TYPE string,
lv_filename  TYPE c LENGTH 100, ” file name and ext
lv_extension TYPE c LENGTH 4. ” extension only
*   Refresh data
REFRESH: li_content[], li_objhead[].

*   Open corresponding DMS files
OPEN DATASET p_file FOR INPUT IN BINARY MODE.
IF sy-subrc EQ 0.
WHILE sy-subrc = 0.
READ DATASET p_file INTO lwa_content.
* Do not put Sy-subrc eq 0 here. Please add the last line of the file,
* though sy-subrc may fail
APPEND  lwa_content TO li_content.
ENDWHILE.
* Close file
CLOSE DATASET p_file.
* In this example we are attaching in Vendor.
* Converting according to your requirement.. For example for Material,
* it should be 18 chars
* Convert Vendor
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input  = p_objid
IMPORTING
output = lv_lifnr.

Advance SAPUI5 – Integration of Google Maps JavaScript API with SAPUI5 App

* Convert to BIN
CALL FUNCTION ‘SO_CONVERT_CONTENTS_BIN’
EXPORTING
it_contents_bin = li_content[]
IMPORTING
et_contents_bin = li_content[].

* Get folder id
CALL FUNCTION ‘SO_FOLDER_ROOT_ID_GET’
EXPORTING
region                = ‘B’
IMPORTING
folder_id             = lwa_fol_id
EXCEPTIONS
communication_failure = 1
owner_not_exist       = 2
system_failure        = 3
x_error               = 4
OTHERS                = 5.
* Sy-subrc check not required
* Keeping file in string data type
lv_file = p_file.
* You may not need this step. But  no harm in adding this
* Get file name and extension
CALL FUNCTION ‘CH_SPLIT_FILENAME’
EXPORTING
complete_filename = lv_file
IMPORTING
extension         = lv_extension
name_with_ext     = lv_filename
EXCEPTIONS
invalid_drive     = 1
invalid_path      = 2
OTHERS            = 3.
IF sy-subrc EQ 0.
* Object header
CLEAR lwa_content.
CONCATENATE ‘&SO_FILENAME=’ lv_filename INTO lwa_content.
APPEND lwa_content TO li_objhead.
CLEAR lwa_content.
ENDIF.

lwa_object-objkey  = lv_lifnr.
* For example, business object name for PO is BUS2012,
* business object for PR is BUS2105,
* business object for Vendor is LFA1 etc
lwa_object-objtype = p_bo.
*        lwa_object-logsys  = lv_logical_system.

lwa_obj_data-objsns = ‘O’.
lwa_obj_data-objla = sy-langu.
lwa_obj_data-objdes = ‘Attachment by Raju Shrestha’.  .
lwa_obj_data-file_ext = lv_extension.

TRANSLATE lwa_obj_data-file_ext TO UPPER CASE.
* This is very important step. If your object size does not match with the input
* file size, then your object might get attached, but it will show error while you
* try to open it.
* If you have a way, where you can read the input file size directly, then assign
* it directly else, use the below formula
lwa_obj_data-objlen =  lines( li_content ) * 255.

* Insert data
CALL FUNCTION ‘SO_OBJECT_INSERT’
EXPORTING
folder_id                  = lwa_fol_id
object_type                = ‘EXT’
object_hd_change           = lwa_obj_data
IMPORTING
object_id                  = lwa_obj_id
TABLES
objhead                    = li_objhead
objcont                    = li_content
EXCEPTIONS
active_user_not_exist      = 1
communication_failure      = 2
component_not_available    = 3
dl_name_exist              = 4
folder_not_exist           = 5
folder_no_authorization    = 6
object_type_not_exist      = 7
operation_no_authorization = 8
owner_not_exist            = 9
parameter_error            = 10
substitute_not_active      = 11
substitute_not_defined     = 12
system_failure             = 13
x_error                    = 14
OTHERS                     = 15.
IF sy-subrc = 0 AND lwa_object-objkey IS NOT INITIAL.
lwa_folmem_k-foltp = lwa_fol_id-objtp.
lwa_folmem_k-folyr = lwa_fol_id-objyr.
lwa_folmem_k-folno = lwa_fol_id-objno.

* Please note: lwa_fol_id and lwa_obj_id are different work areas

lwa_folmem_k-doctp = lwa_obj_id-objtp.
lwa_folmem_k-docyr = lwa_obj_id-objyr.
lwa_folmem_k-docno = lwa_obj_id-objno.

lv_ep_note = lwa_folmem_k.
lwa_note-objtype = ‘MESSAGE’.
*          lwa_note-logsys    = lv_logical_system.
lwa_note-objkey = lv_ep_note.

* Link it
CALL FUNCTION ‘BINARY_RELATION_CREATE_COMMIT’
EXPORTING
obj_rolea      = lwa_object
obj_roleb      = lwa_note
relationtype   = ‘ATTA’
EXCEPTIONS
no_model       = 1
internal_error = 2
unknown        = 3
OTHERS         = 4.
IF sy-subrc EQ 0.
* Commit it
COMMIT WORK.
WRITE:/ ‘Attached successfully’.
ENDIF.
ELSE.
MESSAGE ‘Error while opening file’ TYPE ‘I’.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.

YOU MAY LIKE THIS

Steampunk Chronicles: Navigating the Cloud with SAP BTP ABAP Environment

Tips for Building Custom SAP Applications: A Comprehensive Guide

SAP ABAP on HANA Interview Questions: Mastering the Essentials

SAP

Table to check whether a business object has any GOS attachment or not

How can I determine if a business object has a GOS attachment? We would really like to know how many GOS connections are there in Buy Requests, Buy Demands, Merchants, and so on. Using the GOS relationship table “SRGBTBREL” is the simplest way to locate this.

Proceed to SE16(N) and provide the name of the business object in the TYPEID_A (Kind of Articles) box. For example, if the business object name is BUS2012 for the PO, BUS2105, LFA1 for the Seller, 1001006 for the Material, and so on, you can click Execute to view the rundown or click Number of Passages to view the number of connections in that business object. How can I determine if a business object has a GOS attachment?

Selective Handling of the Buttons in ALV Grid Toolbar

You can get the rundown of business object in exchange SWO1.

On the off chance that for reasons unknown, you can’t sort out the business object in exchange SWO1, then the most straightforward method for finding the business object is by going to the exchange (say MM02, ME22N or XK02 and so on) for the article you are intrigued and connect one archive and save it. Presently take that article number and go to table SRGBTBREL and enter the material/po/merchant and so on in field INSTID_A with all driving zeroes. You will get the business object name in field TYPEID_A.

YOU MAY LIKE THIS

SAP ABAP on HANA

How to find badi in sap abap ?

Fiori App – An Introduction from an ABAPer

SAP

SAP Cloud Platform Integration (CPI) Part 23 – Step-by-Step Guide to Mail Adapter Configuration with Attachments

1. Overview on Mail Adapter

Prior to proceeding with SAP Cloud Platform Integration (CPI) Part 23: Detailed Instructions for Configuring Mail Adapters with Attachments. Let’s quickly go over the Mail Adapter. An extensive set of tools and capabilities for coordinating various frameworks and applications inside an organization is provided by SAP CPI (SAP Cloud Stage Mix). The Mail Connector, which enables regular integration with email features and facilitates the sharing of data and relationships, is one of SAP CPI’s key features.

The SAP CPI Mail Connector serves as a bridge between the joining stage and email frameworks like as Gmail, Microsoft Trade, or another SMTP/POP3-compatible mail server. As part of scenarios involving reconciliation, it provides the ability to send and receive messages along with their connections.

Here are a few critical viewpoints and capacities of the SAP CPI Mail Connector: SAP Cloud Platform Integration (CPI) Part 23 – Step-by-Step Guide to Mail Adapter Configuration with Attachments

Configuration:

The Mail Connector can be effortlessly arranged inside SAP CPI utilizing the online incorporation stream proofreader. Directors can characterize settings, for example, mail server subtleties, confirmation certifications, email designs (e.g., plain text or HTML), and connection taking care of choices.

Email Sending:

With the Mail Connector, SAP CPI can send messages from combination streams to outer beneficiaries or interior post boxes. It upholds different email credits like source, recipient(s), subject, body, and need. Connections can likewise be incorporated by indicating the record area or giving the document content straightforwardly inside the combination stream.

Email Receiving:

The Mail Connector permits SAP CPI to get approaching messages and cycle their items. It upholds the recovery of email credits like source, recipient(s), subject, body, and connections. Joining streams can be set off in view of the appearance of new messages, empowering robotization and reconciliation with different frameworks.

Attachment Handling:

The Mail Connector works with the treatment of email connections inside SAP CPI. Connections can be removed from approaching messages and handled by the incorporation stream’s prerequisites. They can be saved to nearby registries, changed, or sent to different frameworks on a case by case basis.

Error Handling and Monitoring:

SAP CPI gives vigorous mistake taking care of and checking abilities for the Mail Connector. It permits executives to follow the situation with email handling, screen approaching and active messages, and handle special cases or disappointments during incorporation streams including the Mail Connector.

2. IFlow Setup

The SAP CPI Mail Connector doesn’t uphold demand answer usefulness essentially in light of the nonconcurrent idea of email correspondence.

While utilizing the Mail Connector, the correspondence between the joining stream in SAP CPI and the email server follows a nonconcurrent design. The combination stream can set off the sending of an email or tune in for approaching messages, however it doesn’t keep an immediate, simultaneous association with the email server.

Subsequently, use SEND range capability for email situations.

As to mail connector properties:

Address – SMTP mail address

Intermediary type – In the event that its through cloud connector, notice on-premise or, in all likelihood Web.

Area ID – of cloud connector

Assurance – Off/STARTTLS Required/STARTTLS Discretionary

Validation – None/Plain Username Secret word/Encoded Username Secret key

Under the handling tab,

From – Email From

To – Email To

Cc/Bcc

Subject – Mail subject. Here we can specify dynamic properties/header which can stream at runtime as displayed beneath.

Mail Body – We can pass the approaching payload as mail body like underneath or design a mail body according to prerequisite.

Body-Emulate type – The substance sort of the body segment. In the event that its Text/HTML, assuming there are any html components, it would be changed over. To send all things considered, pick Message/Plain. There are numerous different choices moreover. Go ahead and investigate.

Body Encoding – UTF-8

For Mail connections,

SAP has given 2 choices. We can make a connection by passing the header content or the body content.

We can find in the underneath picture, where we are passing the stacktrace header (which we set in past satisfied modifier step, ${exception.stacktrace}). Notice the name of the connection too.

Add Message connections – Assuming there are any connections sent by the shipper and the equivalent must be communicated to the recipient, then, at that point, this choice ought to be empowered.

Content exchange Encoding – Programmed

Overall Setup:

Mail:

By along these lines, we can design the mail connector and use it in IFlow. Gratitude for perusing this blog. Blissful learning!

YOU MAY BE INTERESTED IN

10 Real-World SAP ABAP Programming Examples (with Code!)

SAP ABAP vs SAP Basis

Top SAP ABAP Interview Questions (2024)

SAP

How to Send Custom Purchase Order Form Directly to the Vendor?

Let’s look at some concrete methods on how to send a custom purchase order form straight to the vendor. This is the cycle stream to achieve the equivalent.

1. Make a Result Type for the Buy Request with ‘Outer Send’ medium in ME22N

2. Select the Result Type and go to Additional Information.
Select either ‘Send with application own exchange’ to have the choice to audit the report prior to sending or select ‘Send Quickly’ to send email straightforwardly on Save.

3. To save the result type and start the email, click Save.
Assuming you choose “Send with application own exchange,” to initiate the email, navigate to ME9F – > Open the record – > Select the PO and snap Result Message.


Assuming you picked ‘Send Right away’, email would set off upon save. Go to SOST to see email set off.

Detailed Steps :

1. Go to NACE transaction to create a custom output type and assign your PO form and its program in ‘Processing Routine’

2. Add outer send as ‘Medium’, your zprogram’s name in ‘Program’, a subroutine in your zprogram in ‘Program’s Structure Schedule’, your PO structure’s name in ‘PDF/Smartform Structure’ and pdf in ‘Type’

or then again you can utilize Standard PO structure in light of your necessity or need.

3. Make a custom program to set off PO structure and join it to an email to the seller.
The rationale is to set off PO structure’s FM and get the PO structure information from the FM’s Bringing in boundaries, convert it to a paired table and add it as connection to the email. See the code underneath

You can also read for:- Easy Trick to Disable Hold Button in PO (ME21N) using BADI

REPORT zprogram.

INCLUDE rvadtabl. "standardinclude, needed for getting objky from me22n
DATA: gv_fm_name TYPE rs38l_fnam, " FM Name
       gs_fp_docparams TYPE sfpdocparams,
       gs_fp_outputparams TYPE sfpoutputparams.
Data: gv_purdoc_no type ekko-ebeln,
      gv_ldest     type char4.
CONSTANTS : gv_form_name TYPE fpname VALUE 'YOUR CUSTOM FORM NAME',
            gc_printprev type string VALUE 'PREVOUTPUT'.

FORM zsubroutine USING uv_retco LIKE sy-subrc "return code
                           uv_screen TYPE c.
  PERFORM display CHANGING uv_retco. "if output successfull, need to change return code from 999.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form display
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      <-- ENT_RETCO
*&---------------------------------------------------------------------*
FORM display  CHANGING cv_retco TYPE sy-subrc.

  IF sy-ucomm = gc_printprev."'PREVOUTPUT'
    gs_fp_outputparams-nodialog = ''.
    gs_fp_outputparams-preview  = abap_true.
  ELSE.
    gs_fp_outputparams-nodialog = abap_true.
    gs_fp_outputparams-preview  = ''.
    gs_fp_outputparams-reqnew   = abap_true.
    gs_fp_outputparams-getpdf   = abap_true.
    IF nast-dimme = abap_true. 
      gs_fp_outputparams-reqimm   = abap_true.
    ENDIF.
  ENDIF.

  DATA: lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
  DATA: lt_message_body TYPE bcsy_text VALUE IS INITIAL,
        lo_document     TYPE REF TO cl_document_bcs VALUE IS INITIAL.
  DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
  DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL.
  DATA: lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
  DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL,
        lw_return         TYPE bapiret2.

  DATA: lw_formoutput TYPE fpformoutput,
        lt_binarytab  TYPE solix_tab,
        lv_sub        TYPE so_obj_des,
        lv_in_update TYPE i.

  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = gs_fp_outputparams
    EXCEPTIONS
      cancel          = 
      usage_error     = 2
      system_error    = 3
      internal_error  = 4
      OTHERS          = 5.
  IF sy-subrc <> 0.

    CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
      EXPORTING
        msg_arbgb = sy-msgid
        msg_nr    = sy-msgno
        msg_ty    = sy-msgty
        msg_v1    = sy-msgv1
        msg_v2    = sy-msgv2
        msg_v3    = sy-msgv3
        msg_v4    = sy-msgv4
      EXCEPTIONS
        OTHERS    = 0.

  ENDIF.
**
  TRY.
      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
        EXPORTING
          i_name     = gv_form_name 
        IMPORTING
          e_funcname = gv_fm_name.
      "Exception handling
    CATCH cx_fp_api_internal.
    CATCH cx_fp_api_repository.
    CATCH cx_fp_api_usage.
  ENDTRY.

  cv_retco = 0.

  gv_purdoc_no = nast-objky. "objky contains purchase doc number

  CALL FUNCTION gv_fm_name 
    EXPORTING
      iv_purdoc_no       = gv_purdoc_no
    IMPORTING
      /1bcdwb/formoutput = lw_formoutput
    EXCEPTIONS
      usage_error        = 1
      system_error       = 2
      internal_error     = 3
      OTHERS             = 4.

  IF sy-subrc = 0.

    CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
      EXPORTING
        msg_arbgb = 'ZSCM'
        msg_nr    = '022'
        msg_ty    = 'S'
*       MSG_V1    = TEXT-001
      EXCEPTIONS
        OTHERS    = 0.
  ELSE.

    CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
      EXPORTING
        msg_arbgb = sy-msgid
        msg_nr    = sy-msgno
        msg_ty    = sy-msgty
        msg_v1    = sy-msgv1
        msg_v2    = sy-msgv2
        msg_v3    = sy-msgv3
        msg_v4    = sy-msgv4
      EXCEPTIONS
        OTHERS    = 0.

  ENDIF.

  CALL FUNCTION 'FP_JOB_CLOSE'
    EXCEPTIONS
      usage_error    = 1
      system_error   = 2
      internal_error = 3
      OTHERS         = 4.
  IF sy-subrc <> 0.
*   Implement suitable error handling here
  ENDIF.

"Convert Form Output to Binary table to be added as email attachment
  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer     = lw_formoutput-pdf
*     APPEND_TO_TABLE       = ' '
*   IMPORTING
*     OUTPUT_LENGTH         =
    TABLES
      binary_tab = lt_binarytab.

  SELECT SINGLE ekko~ebeln, ekpo~ebelp, ekko~lifnr, ekpo~werks, ekko~bedat FROM ekko
    INNER JOIN ekpo
    ON ekko~ebeln = ekpo~ebeln
    INTO @DATA(lw_povendor)
    WHERE ekko~ebeln = @gv_purdoc_no
      AND ekpo~loekz = ''.

  IF sy-subrc = 0.

    "Here you can create a Custom Table to maintain email data for each Vendor. I am fetching Email To, Email Cc, Email From and Subject Line that is maintained for that PO's vendor

    SELECT SINGLE * FROM zvendoremaildatatable INTO @DATA(lw_vendordetails)
      WHERE lifnr = @lw_povendor-lifnr.
    IF sy-subrc = 0.

      lv_sub = lw_vendordetails-zsubject.
      "You can edit the subject line with PO data dynamically       data(lv_bedat_formatted) = |{ lw_povendor-bedat+4(2) }| && |/| && |{ lw_povendor-bedat+6(2) }|.
      REPLACE FIRST OCCURRENCE OF 'mmdd' IN lv_sub WITH lv_bedat_formatted. "lw_povendor-bedat
      REPLACE FIRST OCCURRENCE OF '&&' IN lv_sub WITH gv_purdoc_no.

      lo_send_request = cl_bcs=>create_persistent( ).

      "Add email body  APPEND 'Thanks,' TO lt_message_body.
       APPEND 'Bhavya Kariwala' TO lt_message_body.

      lo_document = cl_document_bcs=>create_document(
                                      i_type = 'RAW'
                                      i_text = lt_message_body
                                      i_subject = lv_sub ).
      DATA(lv_attachment_name) = |PO#| && |{ gv_purdoc_no }| && | Form|.
      TRY.

          lo_document->add_attachment(
                        EXPORTING
                          i_attachment_type = 'pdf'
                          i_attachment_subject = CONV sood-objdes( lv_attachment_name )
*                   I_ATTACHMENT_SIZE =
*                   I_ATTACHMENT_LANGUAGE = SPACE
*                   I_ATT_CONTENT_TEXT =
*                   I_ATTACHMENT_HEADER =
                          i_att_content_hex = lt_binarytab ).

        CATCH cx_document_bcs INTO lx_document_bcs.

      ENDTRY.

      lo_send_request->set_document( lo_document ).

      "Set sender
      lo_sender = cl_sapuser_bcs=>create( sy-uname ).
      lo_sender = cl_cam_address_bcs=>create_internet_address( CONV adr6-smtp_addr(  lw_vendordetails-zemail_from ) ).

      lo_send_request->set_sender(
                        EXPORTING
                          i_sender = lo_sender ).

      "Set recipient
"I have maintained multiple email addresses for a vendor separated by ';', so it's now been put into an internal table to be looped through.
      SPLIT lw_vendordetails-zemail_to AT ';' INTO TABLE DATA(lt_emailto).
      SPLIT lw_vendordetails-zemail_cc AT ';' INTO TABLE DATA(lt_emailcc).

      LOOP AT lt_emailto INTO DATA(lw_emailto).
*        TRY.
          lo_recipient = cl_cam_address_bcs=>create_internet_address( CONV adr6-smtp_addr( lw_emailto ) ).
          lo_send_request->add_recipient(
                            EXPORTING
                              i_recipient  = lo_recipient                 " Recipient of Message
                            i_express    = abap_true                 " Send As Express Message
*                        i_copy       =                  " Send Copy
*                        i_blind_copy =                  " Send As Blind Copy
*                        i_no_forward =                  " No Forwarding
                          ).
*        CATCH cx_send_req_bcs. " BCS: Send Request Exceptions
*        ENDTRY.
      ENDLOOP.

      LOOP AT lt_emailcc INTO DATA(lw_emailcc).
*        TRY.
            lo_recipient = cl_cam_address_bcs=>create_internet_address( CONV adr6-smtp_addr( lw_emailcc ) ).
            lo_send_request->add_recipient(
                              EXPORTING
                                i_recipient  = lo_recipient                 " Recipient of Message
                              i_express    =  abap_true                " Send As Express Message
                                i_copy       = abap_true                  " Send Copy
*                    i_blind_copy =                  " Send As Blind Copy
*                    i_no_forward =                  " No Forwarding
                            ).
*        CATCH cx_send_req_bcs. " BCS: Send Request Exceptions
*        ENDTRY.
      ENDLOOP.

      "Send email
      lo_send_request->send(
                        EXPORTING
                          i_with_error_screen = 'X'
                        RECEIVING
                          result = lv_sent_to_all ).
"Check to see if email was triggered in UPDATE TASK
      CALL FUNCTION 'TH_IN_UPDATE_TASK'
       IMPORTING
         IN_UPDATE_TASK       = lv_in_update
                .
      IF lv_in_update <> 1.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait   = abap_true
          IMPORTING
            return = lw_return.
      endif.

    ENDIF.
  ENDIF.
ENDFORM.

4. Furthermore, as consumed in the code above, you can make a table to keep up with Email Information for every Merchant. You can make a Table Upkeep Generator to keep up with sections against every Seller so this interaction can turn out to be more robotized.

Hope you got the How to Send Custom Purchase Order Form Directly to the Vendor?

thanks! have a good day.

YOU MAY LIKE THIS

Is SAP ABAP a High Paying Job?

SAP ABAP Consultant Trainer

Your Definitive Guide to Becoming a SAP ABAP Developer

SAP

Object Oriented Way of Sending an email with PDF as an Attachment

Introduction

Send an email in Apex that includes a PDF attachment (Object Oriented Method of Sending an Email with a PDF Attachment)

The blog post I wrote on the topic of “Item Arranged approach to sending an email from ABAP side” is expanded upon in this one. An object-oriented method for attaching a PDF to an email.

You will also learn how to send an email using an object-oriented method with a PDF attached in this blog post, Object Oriented Way of Sending an Email with PDF as an Attachment. In this case, a SMARTFORM will generate the PDF.

Prerequisite (Object Oriented Way of Sending an email with PDF as an Attachment)

  1. A Smartform – It tends to be an essential smartform with a short message, we simply need it for show reason.
  2. Essential information on involving class CL_BCS for email sending.
  3. A trigger program.

Steps

Create a Smartform with any Z/Y name.

I made with the name “ZTEST_SMARTFORM_ATTACHMENT”. It simply have a short text as beneath:

Create an executable program in SE38.

I made it with the name “ZTEST_EMAIL_WITH_ATTACHMENT”.

DATA DECLARATIONS

(Please excuse for the naming convention used)

CONSTANTS:
lc_sfname TYPE tdsfname VALUE 'ZTEST_SMARTFORM_ATTACHMENT'. "Name of Smartform

"Local Object References
DATA: lo_bcs         TYPE REF TO cl_bcs,
      lo_doc_bcs     TYPE REF TO cl_document_bcs,
      lo_recep       TYPE REF TO if_recipient_bcs,
      lo_sapuser_bcs TYPE REF TO cl_sapuser_bcs,
      lo_cx_bcx      TYPE REF TO cx_bcs.

"Local Internal Tables.
DATA: lt_otfdata        TYPE ssfcrescl,
      lt_binary_content TYPE solix_tab,
      lt_text           TYPE bcsy_text,
      lt_pdf_tab TYPE STANDARD TABLE OF tline,
      lt_otf     TYPE STANDARD TABLE OF itcoo.

"Local Structures
DATA: ls_ctrlop TYPE ssfctrlop,
      ls_outopt TYPE ssfcompop.

"Local Variables
DATA: lv_bin_filesize TYPE so_obj_len,
      lv_sent_to_all  TYPE os_boolean,
      lv_bin_xstr     TYPE xstring,
      lv_fname        TYPE rs38l_fnam,
      lv_string_text  TYPE string.

Get the name of the function module of the SMARTFORM .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = lc_sfname
  IMPORTING
    fm_name            = lv_fname
  EXCEPTIONS
    no_form            = 1
    no_function_module = 2
    OTHERS             = 3.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

Fill the Control Parameters, output options and call the FM of your SMARTFORM.

We will get the OTF data generated by the smartform in internal table “lt_otf”.

"Control Parameters
ls_ctrlop-getotf    = 'X'.
ls_ctrlop-no_dialog = 'X'.
ls_ctrlop-preview   = space.

"Output Options
ls_outopt-tdnoprev  = 'X'.
ls_outopt-tddest    = 'LOCL'.
ls_outopt-tdnoprint = 'X'.    "No printing from print preview

CALL FUNCTION lv_fname
  EXPORTING
    control_parameters = ls_ctrlop
    output_options     = ls_outopt
  IMPORTING
    job_output_info    = lt_otfdata
  EXCEPTIONS
    formatting_error   = 1
    internal_error     = 2
    send_error         = 3
    user_canceled      = 4
    OTHERS             = 5.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


lt_otf[] = lt_otfdata-otfdata[].

Convert OTF Data to XSTRING “lv_bin_xstr”.

CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format                = 'PDF'   "PDF to get pdf output
  IMPORTING
    bin_filesize          = lv_bin_filesize
    bin_file              = lv_bin_xstr
  TABLES
    otf                   = lt_otf[]
    lines                 = lt_pdf_tab[]
  EXCEPTIONS
    err_max_linewidth     = 1
    err_format            = 2
    err_conv_not_possible = 3
    OTHERS                = 4.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

Convert the XSTRING to Binary table “lt_binary_content”.

***Xstring to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    buffer     = lv_bin_xstr
  TABLES
    binary_tab = lt_binary_content.

Prepare to Send Email

 Create persistent send request

TRY.
*     -------- create persistent send request ------------------------
    lo_bcs = cl_bcs=>create_persistent( ).

Create Email Body

    "Line-1
    CONCATENATE 'Dear Colleague' cl_abap_char_utilities=>newline INTO lv_string_text.
    APPEND lv_string_text TO lt_text.
    CLEAR lv_string_text.
    "Line-2
    CONCATENATE 'Please find attached a test smartform.'
     cl_abap_char_utilities=>newline INTO lv_string_text.
    APPEND lv_string_text TO lt_text.
    CLEAR lv_string_text.
    "Line-3
    APPEND 'Best Regards,' TO lt_text.
    "Line-4
    APPEND 'Systems Administrator.' TO lt_text.

Create Email

*---------------------------------------------------------------------
*-----------------&      Create Document     *------------------------
*---------------------------------------------------------------------
    lo_doc_bcs = cl_document_bcs=>create_document(
                    i_type    = 'RAW'
                    i_text    = lt_text[]
                    i_length  = '12'
                    i_subject = 'Test Email' ).   "Subject of the Email

Add attachment to document and Add document to send request

The interior table “lt_binary_content” contains the substance of our connection.

*---------------------------------------------------------------------
*-----------------&   Add attachment to document     *----------------
*---------------------------------------------------------------------
*     BCS expects document content here e.g. from document upload
*     binary_content = ...
    CALL METHOD lo_doc_bcs->add_attachment
      EXPORTING
        i_attachment_type    = 'PDF'
        i_attachment_size    = lv_bin_filesize
        i_attachment_subject = 'Test Email'
        i_att_content_hex    = lt_binary_content.

*     add document to send request
    CALL METHOD lo_bcs->set_document( lo_doc_bcs ).

you can also read for:- AI Tools for Email marketing

Set Sender

Note: this is fundamental provided that you need to set the source unique in relation to genuine client (SY-UNAME). In any case source is set consequently with genuine client.
FYI. I have remarked the code in my program.

*---------------------------------------------------------------------
*------------------------&   Set Sender     *-------------------------
*---------------------------------------------------------------------
*    lo_sapuser_bcs = cl_sapuser_bcs=>create( sy-uname ).
*    CALL METHOD lo_bcs->set_sender
*      EXPORTING
*        i_sender = lo_sapuser_bcs.

Add recipient (e–mail address)

You can involve various beneficiaries too.

    lo_recep = cl_cam_address_bcs=>create_internet_address(
                                                'test@test123.com' ).

"Add recipient with its respective attributes to send request
    CALL METHOD lo_bcs->add_recipient
      EXPORTING
        i_recipient = lo_recep
        i_express   = 'X'.

Set Send Immediately

You can set this to promptly send your email.

CALL METHOD lo_bcs->set_send_immediately
      EXPORTING
        i_send_immediately = 'X'.

Send the Email

*---------------------------------------------------------------------
*-----------------&   Send the email    *-----------------------------
*---------------------------------------------------------------------
    CALL METHOD lo_bcs->send(
      EXPORTING
        i_with_error_screen = 'X'
      RECEIVING
        result              = lv_sent_to_all ).

    IF lv_sent_to_all IS NOT INITIAL.
      COMMIT WORK.
    ENDIF.


*---------------------------------------------------------------------
*-----------------&   Exception Handling     *------------------------
*---------------------------------------------------------------------
  CATCH cx_bcs INTO lo_cx_bcx.
    "Appropriate Exception Handling
    WRITE: 'Exception:', lo_cx_bcx->error_type.
ENDTRY.

Conclusion

This is one of the approach to sending an email with a PDF connection.

For any issues, enhancements, augmentations or some other worries, kindly go ahead and get in touch with us.

I look forward for your criticism and ideas.

Continue to learn!! Continue to get to the next level!!

YOU MAY LIKE THIS

Epic Evolution of ABAP Programming

Mastering the Basics of SAP ABAP: A Comprehensive Guide

How to check your custom ABAP code for SAP BTP ABAP Environment

SAP

SOLMAN—Understanding Attribute Context & Action Profile in Mail Forms

I explained in my last instructive exercise how to improve the conventional SOLMAN Mail Structures with additional attributes (fields and items) before moving on to the SOLMAN – Understanding Attribute Context & Action Profile in Mail Forms. Many readers wanted to know how to find the correct Credit Setting and Trait Classification.

Let me begin by discussing the specifics.

Quality assists with making customized content via the Post office Structures. Let’s get start on SOLMAN – Understanding Attribute Context & Action Profile in Mail Forms.

What are Attribute Contexts in Mail Forms?

Characteristic Settings determine which ascribes are available in Mail Structures (you can anticipate them to be fields or slot holders). Standard characteristic setting will be available in Mail Structures, of course. We can also describe other custom property settings. As a result, we can include our own traits. In the end, during custom enhancements, we can select a customized/custom property setting instead of the default one using the Post office Structures.

Real Time Exchange Rate with Real Time Data Using Yahoo Finance API

How can we check the list of the attribute context available?

Execute SM_CRM Transaction. It opens a webpage link home screen, where we can see Service Operations.

Click on Mail Forms.

It will take you to the Search: Mail Forms screen.

Try not to be frightened to see the rundown of Mail Structures. Standard Mail Structures are given by SAP and the custom Mail Structures were made by SOLMAN Advisors. ABAP engineers don’t have to stress the way things were made (despite the fact that, figuring out how to make doesn’t hurt).

For our example we will select “Z_MESSAGE_PROCESSOR”.

Check the Attribute Context. It is a standard Context.

We can click the drop down to check the different Attribute Contexts available.

For our prerequisites in the past instructional exercise, they have chosen Administration Solicitation Ascribes. This will give us standard construction and fields naturally.

Click on Attribute Tab to check the Attribute Category.

Click the Attribute Category and check the different types of Attributes available.

For our prerequisite we picked SRQ Standard Ascribes which is utilized for the Assistance Sends. This class gives us the construction and rundown of accessible fields under it as displayed beneath.

Quality Classification is an assortment of classifications, which contains a rundown of classes accessible.

These classifications hold construction and fields which can be utilized for the mail structures.

  • Business partner
  • Marketing attributes
  • Campaigns
  • System attributes
  • Additional fields

Additional Brownie Points. ?

How to Create or Add Custom Attribute Context?

As educated over, the SOLMAN Specialists do this errand. ABAPers need not stress. Yet, ABAPer attempt to be Handyman. Thus, here we go. Regardless of whether we can’t dominate, no damage in knowing it. ?

Go to SPRO – > Client Relationship The board – > Advertising – > Showcasing Arranging and Mission The executives – > Customized Mail – > Keep up with Quality Settings for Mail Structures.

Time to maintain the Action Profile and Actions.

T-Code – SPPFCADM

We have maintained it for CRM_ORDER.

Select CRM_ORDER and click on Define Action Profile and Actions.

Search for your Activity Profile. We have replicated SMIN_STD standard Activity Profile to ZMIN_STD and tweaked.

ABAPers.. you are stepping an in the perilous area. Sssshhhhhh .. try not to tell your SOLMAN Advisor.

Select ZMIN_STD and click on Activity Definition.

List of Action Definitions are available.

Select the specific activity definition and snap on Handling Type.

Here you find the Allowed Handling Sorts of Activity. For us it is Technique Call and we likewise have the Strategy name for example SEND_MAIL_WITH_MAIL_FORMS.

Click on the showcase Execution button (featured in red circle above). This is the execution class which calls the Activity Technique.

How to find the Structure to be Enhanced in Mail Forms?

In the last article we uncovered that SRQ Standard Credits utilizes the standard design “CRMS_SRQM_GEN_FIELDS” and we expected to add another field in this construction to meet our prerequisite. In any case, one peruser inquired, “How could we realize this construction name?”

To respond to that inquiry, we want to thoroughly search in to the BADI we executed. BADI name CRM_IM_ADD_DATA_BADI. How we found the BADI is one more subject to talk about another day.

In the BADI Execution, go to Strategy CRM_IM_BPSELE.

At first, when there is no code in the technique, you may just put order “BREAK-POINT”. Or on the other hand you may just place a Circle AT CT_ATT_VALUES INTO WA_VALUES. ENDLOOP. Furthermore, put a break point.

If it’s not too much trouble, note: Put an Outside Break Point on the off chance that your SM_CRM utilizes the WebUI.

Really take a look at the segments in CT_ATT_VALUES. CRMS_SRQM_GEN_FIELDS is the design which will house the new fields. Presently mess with the design and pass anything that ascribes the business requests. You have turned into a Genie for them.

We are finished. I attempted to show every one of the abilities required for upgrading the SOLMAN Mail Structures. You additionally know not many stunts which the SOLMAN Experts don’t uncover. In this way, next time you want to send an additional quality, you can behave like a Genius and get it conveyed.

YOU MAY LIKE THIS

Building Cloud-Native ABAP Applications: A Guide to Modern SAP Development

Parallel cursor in SAP ABAP

How to Create RAP business events in SAP BTP ABAP Environment ?

SAP

SOLMAN—Mail Forms Custom Enhancement Guide

SOLMAN is a very powerful framework. It is used by many groups for venture planning and documentation. Many clients alter the executives’ framework and utilize it for transportation. We explained how to create a custom Fiori application for changing the board in Solman in one of our previous posts. SOLMAN: Custom Enhancement Guide for Mail Forms.

Today, we will investigate the Mail Structures which is utilized in the episode the executives region. In this instructional exercise, SOLMAN—Mail Forms Custom Enhancement Guide, we will figure out how to add another uniquely documented in MailForm Trait classification for Quality setting.

What are Mail Forms? SOLMAN—Mail Forms Custom Enhancement Guide..

Let me try to make sense of it in as simple a sentence as possible. We create episodes or tickets in the Solman framework based on customer requests. There is a programmed mail that will be triggered whenever something happens or is altered in the framework. With the aid of mail structures, this notice is completed.

Get Latitude and Longitude of any place using Google Map API in SAP

Who gets the mail from SOLMAN? (SOLMAN – Mail Forms Custom Enhancement Guide)

All the stakeholders of the particular incident/ticket are supposed to receive the mail. In short the below users receive the mail:

  1. Message processor
  2. Contact person
  3. Reported by

What is the t-code to create Incident in SOLMAN?

SM_CRM is the exchange utilized for making Occurrences.

Contingent upon the SOLMAN settings, SM_CRM Arrangement Supervisor IT Administration The board will open in SAP GUI meeting or it will open in discrete page connect in web pioneer (chrome or other default internet browsers).

Once the incident is created, it would look like below.

Mail will be delivered to concern person or team.

Example of a real mail for the generated incident.

Mail will be set off in above design.

In any case, clients are an alternate variety of human. They would as a rule be not happy with what the standard SAP give. For our situation, the business necessity was to have arrangement to send Long Message Log with the verifiable refreshed toward the finish of the mail.

Specialists all through the world flourish due to improvement and customization demands like this. We want to thank our clients for such learning and working open doors. . I’m not kidding around.

An example log of the episode.

However, arrangement isn’t straight forward.

For ABAP designers, the sky is the limit. You put a necessity, you would get an answer. In some cases the plan is enhanced and smooth while on occasion the engineers take a filthy course to meet the business need.

For our situation, we can accomplished this by utilizing Mail Structures with some ABAP improvements.

Accepting, we have finished our improvement. The occurrence alarms after complete of the change would like beneath with expansion of Text log (Long portrayal).

Have patience.  I will show you step by step, how to enhance the Mail Forms in SOLMAN.

Step 1

For our model, the custom field is added for Characteristic Setting “Administration Solicitation Ascribes”.

This Assistance Solicitation Ascribes utilizes administrations Quality Classification “SRQ Standard Credits”.

SRQ Standard Credits thusly utilizes the standard construction “CRMS_SRQM_GEN_FIELDS”.

In the design CRMS_SRQM_GEN_FIELDS, add the expected fields utilizing add structure.

We made the attach structure ZZCRM_SRQM_TEXT_LOG with area ZSTRING and information type String to acknowledge long text values.

Step 2

Once the required field is added to the structure CRMS_SRQM_GEN_FIELDS, go to the t-code SM_CRM.

In the left panel, click on Service Operations (highlighted above).

Now click on Mail Forms and Search for Mail Form ID.

For our case, we are accomplishing for Z_MESSAGE_PROCESSOR. Select the Mail Structure ID you need to improve.

Presently we want to add the custom field at the necessary spot. To add the new spot holder, click on Property as displayed beneath.

In the following screen look for our field, yet here we can’t track down specialized name. We really want to look through in view of the portrayal we provided for the information component. For us the field mark is “Text Log”.

Select the field with Text Log and snap on Supplement button.

Place the new field at the ideal situation as shown beneath.

Step 3

The construction and position of new field is finished. Presently we really want to execute the BADI: “CRM_IM_ADD_DATA_BADI”. This BADI works for Keep up with Extra Credits for Mail Structures Characteristic Settings. It is channel subordinate, so we really want to choose required Property Setting and Type.

In the Property Setting select Assistance Solicitation and Type SQM.

Execute the BADI.

In the strategy CRM_IM_BPSELE, We want to compose our rationale to change the qualities to populate long text values for Text Log.

Fundamentally, we want to change the inward table CT_ATT_VALUES. This interior table have two fields:

  • Name (which holds the names of the additional field via the Post office Structures id).
  • Esteem (which holds the upsides of the fields).

We really want to adjust this table just for the CTT_ATT_VALUES-NAME = “CRMS_SRQM_GEN_FIELDS-ZZTEXT_LOG”.

Then alter the CTT_ATT_VALUES-VALUES = “with regarded required data”.

As may be obvious, field Worth Information Type is STRING, this is the explanation while making custom field for Text Log we have involved String as Information Type. You may be enticed to utilize roast 255 and it could work. However, you actually risk shortening the characters assuming they surpass.

Since Text Logs are free texts, it is the most secure wagered to utilize STRING.

How to modify internal table CT_ATT_VALUES?

We want to Circle at CT_ATT_VALUES. As referenced before, we really want to change just for the TEXT LOG field “CRMS_SRQM_GEN_FIELDS-ZZTEXT_LOG”.

Underneath code bit can be utilized for reference.

Throughout the entire the Text (Text Log subtleties) we have perused utilizing FM “CRM_DNO_READ_ORDER_TEXT”.

We really want to pass GUID of the Item id (only Occurrence number).

We can get GUID from table TABLE: CRMD_ORDERADM_H

Then loop at LT_ALLTEXTS (which holds the long text).

Here we have added Text Log just for SU01 (Answer), SU99 (Depiction), SUSO (Arrangement). You might investigate and check what different codes you might get for the Text Log.

To peruse the text we really want to utilize the amazingly popular FM”READ_TEXT” and pass Text ID, Language, Name, Item.

These values are readily available in LT_ALLTEXTS.
LT_ALLTEXTS-STXH-TDID
LT_ALLTEXTS-STXH-TDNAME,
Object will be CRM_ORDERH.
Language you know. 

Recover the Text Id depiction from table TTXIT

For Text ID portrayal kindly check underneath screen shot.

Circle the LT_LINE recovered from READ_TEXT FM and alter the CT_ATT_VALUES-Worth.

At the point when we use string all values will be imprinted in single line like underneath.

In any case, you don’t need a grouped passage. You need space and great organization.

How to format the string values?

To stay away from this, we utilize the order Connect and Isolated BY CL_ABAP_CHAR_UTILITIES=>CR_LF. Don’t bother referencing, this order makes new line (it is like return, enter key).

After using CL_ABAP_CHAR_UTILITIES=>CR_LF, the paragraph looks better.

Complete Code:

METHOD if_ex_crm_im_add_data_badi~crm_im_bpsele.
   DATA : lt_alltexts TYPE comt_text_textdata_t.
    DATA : lv_id     TYPE thead-tdid,
          lv_lang   TYPE  thead-tdspras VALUE 'EN',
          lv_name   TYPE thead-tdname,
          lv_object TYPE  thead-tdobject VALUE 'CRM_ORDERH',
          lt_line   TYPE TABLE OF tline, 
          lv_string TYPE string,
          lv_string2 TYPE string,
          lv_string3 TYPE string.
 
 *--> loop the ct_att_values will have all the fields whhich described in mailforms
     LOOP AT ct_att_values ASSIGNING FIELD-SYMBOL(<line>).
 **** change the value for the long text(CRMS_SRQM_GEN_FIELDS-ZZTEXT_LOG) field and modify the values with required data ****
       CASE <line>-name.
         WHEN 'CRMS_SRQM_GEN_FIELDS-ZZTEXT_LOG'.
 
 *--> Get the HEADER GUID from table CRMD_ORDERADM_H based on CRMS_SRQM_GEN_FIELDS-CRM_SRQM_NUMBER(OBJECT ID)
      READ TABLE ct_att_values INTO DATA(ls_att_value) WITH KEY name = 'CRMS_SRQM_GEN_FIELDS-CRM_SRQM_NUMBER'.
      IF sy-subrc = 0.
      SELECT SINGLE guid FROM crmd_orderadm_h INTO @DATA(lv_guid)
       WHERE object_id = @ls_att_value-value.
 
 *--> get the order text id from FM
      CALL FUNCTION 'CRM_DNO_READ_ORDER_TEXT'
        EXPORTING
         iv_header_guid          = lv_guid
       IMPORTING
         et_alltexts             = lt_alltexts.
 *--> LT_ALLTEXT will contain all the text ids which maintained in incident
      LOOP AT lt_alltexts ASSIGNING FIELD-SYMBOL(<fs_alltexts>).
 *--> Add text ids values only for the SU01(REPLY) SU99(DESCRIPTION) SUSO(SOLUTION)
       IF <fs_alltexts>-stxh-tdid = 'SU01' OR <fs_alltexts>-stxh-tdid = 'SU99' OR <fs_alltexts>-stxh-tdid = 'SUSO'.
 
        lv_id   = <fs_alltexts>-stxh-tdid.
        lv_name = <fs_alltexts>-stxh-tdname.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            client                        = sy-mandt
            id                            = lv_id
            language                      = lv_lang
            name                          = lv_name
            object                        = lv_object
          TABLES
            lines                         = lt_line
         EXCEPTIONS
           id                            = 1
           language                      = 2
           name                          = 3
           not_found                     = 4
           object                        = 5
           reference_check               = 6
           wrong_access_to_archive       = 7
           OTHERS                        = 8.
        IF sy-subrc <> 0.
 * Implement suitable error handling here
        ENDIF.
 *--> Get the Text ID description from TTXIT tables
        SELECT SINGLE tdtext FROM ttxit INTO @DATA(lv_desc)
         WHERE tdspras  = @lv_lang
           AND tdobject = @lv_object
           AND tdid     = @<fs_alltexts>-stxh-tdid.
 
 *--> Date
        CONCATENATE <fs_alltexts>-stxh-tdfdate+6(2) <fs_alltexts>-stxh-tdfdate+4(2) <fs_alltexts>-stxh-tdfdate+0(4)
                    INTO DATA(lv_date) SEPARATED BY '.'.
 *--> Time
        CONCATENATE <fs_alltexts>-stxh-tdftime+0(2) <fs_alltexts>-stxh-tdftime+2(2) <fs_alltexts>-stxh-tdftime+4(2)
                    INTO DATA(lv_time) SEPARATED BY ':'.
 *--> Date Time User
        CONCATENATE lv_date lv_time <fs_alltexts>-stxh-tdfuser
                    INTO DATA(lv_date_user) SEPARATED BY space.
 
        CONCATENATE lv_desc lv_date_user INTO lv_string SEPARATED BY cl_abap_char_utilities=>cr_lf.
        LOOP AT lt_line INTO DATA(ls_line).
          CONCATENATE lv_string2 ls_line-tdline INTO lv_string2 SEPARATED BY cl_abap_char_utilities=>cr_lf.
        ENDLOOP.
        CONCATENATE <line>-value lv_string lv_string2 INTO <line>-value SEPARATED BY cl_abap_char_utilities=>cr_lf.
        lv_string3 = '------------------------------------------------------------------------------------------------------'.
        CONCATENATE <line>-value lv_string3 INTO <line>-value SEPARATED BY cl_abap_char_utilities=>cr_lf.
 
        REFRESH lt_line.
        CLEAR : lv_string, lv_string2, lv_string3, ls_line, lv_desc, lv_id,
                lv_name, lv_date_user, lv_string2, lv_date, lv_time.
        ENDIF.
       ENDLOOP. 
      ENDIF.
        ENDCASE. 
     ENDLOOP. 
   ENDMETHOD.

That is all there is to it. You are finished. Presently request that you entrepreneur make the occurrence and get the Message Sign in the email. Advise them to send an appreciation mail for you to your detailing administrator. Remember to exhibit this improvement in your quarterly execution audit meeting with your supervisor. This improvement isn’t no problem. Truly.

On a serious note, I needed to work a few late evenings to make it happen. It could look basic currently in the wake of going through this article. In any case, accept me, it wasn’t so much that that simple when it was relegated to me.

I have attempted to place every one of the subtleties in this instructional exercise. However, assuming you actually feel somewhat unsure, go ahead and put your inquiries in the remarks area. I will try to answer to every single question.

YOU MAY LIKE THIS

ABAP Development Environment in the Cloud

Mastering the Future of SAP Development

Introduction to ABAP on Cloud

× How can I help you?