SAP & Oracle partner and support companies

Loading

Archives June 2025

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

SAP

Distribution List in SAP

Let’s examine the SAP Distribution List in more detail. We’re going back to nuts and bolts again. We would focus on SAP’s Dispersion Rundown today. In SAP, we can create a breakdown and send a single email to multiple recipients at the same time, much like we can create an email list in Lotus Notes or Standpoint. Although the dispersion list is a well-known tool in SAP, many of our new hires may find it to be an interesting and useful teaching exercise.

As a result, Conveyance Rundown in SAP can be used in the unlikely event that it becomes necessary to email a group about a particular cycle. SAP Distribution List.

Dissemination list are like SMTP and lessens programming work by and large for informing gathering.

Steps for creation of Distribution List (DL):

  • Tcode for Distribution list is SO23.
  • Click on create button and create your own folder in DL and specify the details as showed.
  • One can set below properties like retention properties etc.

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

  • When the envelope is made and individual properties are added according to above preview add the particular email id to whom mail ought to be sent and you are finished making DL.

Different ways to use DL:

Not many of the numerous manners by which the Conveyance Rundown can be utilized is referenced underneath:

  1. One can go to SBWP tcode and select the folder which you have created as part of Distribution List and click on create new document.

Make your message as displayed underneath and tap on send.

Click on send and choose the Appropriation list made by you and tap on send , your mail is sent.

2. Create a custom program which can be used to send email according to your Distribution List.

*&---------------------------------------------------------------------*
*& Report ZYASH_DL
*&---------------------------------------------------------------------*
*& Demo program to send email to Distribution List
*&---------------------------------------------------------------------*
 REPORT zyash_dl.
 "Create a ref of type CL_BCS
 DATA : obj_mail  TYPE REF TO cl_bcs,
        obj_send  TYPE REF TO if_recipient_bcs,
        l_output  TYPE boolean,
        mail_body TYPE bcsy_text.
  TRY.
     obj_mail = cl_bcs=>create_persistent( ).
   CATCH cx_send_req_bcs .
 ENDTRY.
 ** ONE CAN TAKE THE DL AUTOMATICALLY BY PASSING IT THROUGH SELECTION SCREEN AS INPUT PARAMETER
 TRY.
     obj_send ?=  cl_distributionlist_bcs=>getu_persistent( i_dliname = 'ZYASH'
                                                             i_private = ' ' ).
   CATCH cx_address_bcs .
 ENDTRY.
 TRY.
     obj_mail->add_recipient( i_recipient  = obj_send ).
   CATCH cx_send_req_bcs .
 ENDTRY.
 
 "Lets create the message 
 APPEND 'Hi , Please comment if you found this article useful' TO mail_body.
 TRY.
     DATA(l_doc) =   cl_document_bcs=>create_document( i_type        = 'RAW'
                                                    i_subject     = 'Welcome Yash To DL'
                                                    i_sensitivity = 'P'
                                                    i_text        = mail_body ).
   CATCH cx_document_bcs .
 ENDTRY.
 
 TRY.
     obj_mail->set_document( i_document = l_doc ).
   CATCH cx_send_req_bcs .
 ENDTRY.
 TRY.
     CALL METHOD obj_mail->send
       EXPORTING
         i_with_error_screen = space
       RECEIVING
         result              = l_output.
   CATCH cx_send_req_bcs .
 ENDTRY.

You definitely wouldn’t have made one show yourself, but you could have included the Circulation Rundown in your activities. The Premise/Administrator groups create this rundown for us in a lot of assignments. If you arrive at your scene, make sure to check. If so, this is a good opportunity to create your most memorable Circulation Rundown and practice.

We would keep posting more crucial SAP-related items in a few articles. They may appear simple, but they are quite beneficial, and young advisors should know that.

YOU MAY LIKE THIS

Future of ABAP on Cloud

Introduction to ABAP in the Cloud

ABAP Applications for the Cloud: Modernizing for the Future

SAP

How to Email Smartform as PDF Attachment to Multiple Users?

The issue of sending Smartform yield as a PDF in an email has been raised and discussed at a number of different events. But if this need arises, we really want to reach for our old notes or use the web search engine. Recently, I received this solicitation from my company, and it wasn’t unique to me either. How Can I Send a Smartform to Several Users as a PDF Attachment?

After communicating this turn of events, I was looking for a storehouse where I could keep my code so that, should I need it in the future, I would know exactly where to look. Which warehouse for SAP Specialized is currently better than eLearningsolutions?

GPS like tool in SAP using Google Map API

Aside from the rationale of saving my scrap in the web, the other better goal was to uncover to all freshers in SAP ABAP that, you simply need to follow 4 stages for this prerequisite.

  1. Get the Smartform output in OTF (Other Text Format).
  2. Convert the OTF to Hexa decimal string format.
  3. Convert the Hexa decimal string format to Binary format.
  4. Build the email body and attach the Binary table as an attachment using CL_DOCUMENT_BCS-ADD_ATTACHMENT and send the email using CL_BCS class.

Assuming that you comprehend these four stages, you want not look the web crawler in future for such turns of events. .

Allow me to be minimal more unambiguous with the details of the four stages.

1. Smartform Output in OTF

When you call your smartform, you would get the Smart Forms OTF Table in IMPORTING parameter  JOB_OUTPUT_INFO component OTFDATA which is the structure for Smart Forms: Table OTF.

For the below snippet, the OTF data would be in w_return-otfdata.

 * Call Smartform
  CALL FUNCTION v_form_name
    EXPORTING
      control_parameters = w_ctrlop
      output_options     = w_compop
      user_settings      = abap_true
    IMPORTING
      job_output_info    = w_return " This will have all output
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
* Get Output Text Format (OTF)
  i_otf[] = w_return-otfdata[].

2. Convert the OTF to Hexa decimal string format.

The below snippet is to convert the OTF to XSTRING format.

* Import HexaString and filesize
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = v_len_in
      bin_file              = i_xstring   " This is NOT Binary. This is Hexa
    TABLES
      otf                   = i_otf
      lines                 = i_tline
    EXCEPTIONS
      err_max_linewidth     = 1
      err_format            = 2
      err_conv_not_possible = 3
      OTHERS                = 4.

3. Convert the Hexa decimal string format to Binary format.

* Convert Hexa String to Binary format
  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer     = i_xstring
    TABLES
      binary_tab = i_objbin[].

Simply an idea. In the event that you can track down any capability to change over OTF straightforwardly to Twofold Organize then you can skirt the second step of switching OTF over completely to Hexa.

4. Use CL_DOCUMENT_BCS class and method ADD_ATTACHMENT to attach the document and use CL_BCS class to email the document.

If you have any desire to peruse more about CL_BCS class use, then, at that point, kindly check this valuable post ‘Send an email with title more prominent than 50 characters’.

On the off chance that you have a cutoff time, I can comprehend, you don’t need more Gyan (Sanskrit work which generally means Teaching). You are more keen on getting a functioning code which you can squeeze into your framework. Sit back and relax, I won’t dishearten you. If it’s not too much trouble, find a functioning piece which switches the Smartform over completely to PDF and messages it as a PDF connection.

*--------------------------------------------------------------------*
* Program to convert smartform as PDF and email PDF to
* multiple recipients.

*--------------------------------------------------------------------*
TABLES adr6.
*--------------------------------------------------------------------*
*--------------------------------------------------------------------*
* Global Data Declaration for ease
* In actual project, please do not define all these in global
*--------------------------------------------------------------------*
DATA: i_otf       TYPE itcoo    OCCURS 0 WITH HEADER LINE,
      i_tline     LIKE tline    OCCURS 0 WITH HEADER LINE,
      i_record    LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_xstring   TYPE xstring,
* Objects to send mail.
      i_objpack   LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
      i_objtxt    LIKE solisti1   OCCURS 0 WITH HEADER LINE,
      i_objbin    LIKE solix      OCCURS 0 WITH HEADER LINE,
      i_reclist   LIKE somlreci1  OCCURS 0 WITH HEADER LINE,
* Work Area declarations
      wa_objhead  TYPE soli_tab,
      w_ctrlop    TYPE ssfctrlop,
      w_compop    TYPE ssfcompop,
      w_return    TYPE ssfcrescl,
      wa_buffer   TYPE string,
* Variables declarations
      v_form_name TYPE rs38l_fnam,
      v_len_in    LIKE sood-objlen.

*--------------------------------------------------------------------*
* Selection Screen
*--------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS:     p_sform TYPE tdsfname OBLIGATORY.
SELECT-OPTIONS: s_email FOR adr6-smtp_addr NO INTERVALS OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.

*--------------------------------------------------------------------*
END-OF-SELECTION.
*--------------------------------------------------------------------*
* Call your Smart
  PERFORM smartform_driver_call.

* Convert Smartform data to Hexa
  PERFORM convert_otf_to_xstring.

* Convert Hexa to Binary
  PERFORM str_to_binary.

* Send the email using cl_bcs class
  PERFORM send_multiple_user.

*--------------------------------------------------------------------*
* Sub Routines
*--------------------------------------------------------------------*
FORM smartform_driver_call .

* Call you smartform
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = p_sform
    IMPORTING
      fm_name            = v_form_name
    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.

* Set the control parameter
  w_ctrlop-getotf = abap_true.
  w_ctrlop-no_dialog = abap_true.
  w_compop-tdnoprev = abap_true.
  w_ctrlop-preview = space.
  w_compop-tddest = 'LOCL'.

* Call Smartform
  CALL FUNCTION v_form_name
    EXPORTING
      control_parameters = w_ctrlop
      output_options     = w_compop
      user_settings      = abap_true
    IMPORTING
      job_output_info    = w_return " This will have all output
    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.

ENDFORM. " SMARTFORM_DRIVER_CALL

FORM str_to_binary .

* Convert Hexa String to Binary format
  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer     = i_xstring
    TABLES
      binary_tab = i_objbin[].
* Sy-subrc check not required.

ENDFORM. " STR_TO_BINARY

FORM send_mail USING in_mailid.

  DATA: salutation TYPE string.
  DATA: body TYPE string.
  DATA: footer TYPE string.

  DATA: lo_send_request TYPE REF TO cl_bcs,
        lo_document     TYPE REF TO cl_document_bcs,
        lo_sender       TYPE REF TO if_sender_bcs,
        lo_recipient    TYPE REF TO if_recipient_bcs VALUE IS INITIAL,lt_message_body TYPE bcsy_text,
        lx_document_bcs TYPE REF TO cx_document_bcs,
        lv_sent_to_all  TYPE os_boolean.

  "create send request
  lo_send_request = cl_bcs=>create_persistent( ).

  "create message body and subject
  salutation ='Dear Sir/Madam,'.
  APPEND salutation TO lt_message_body.
  APPEND INITIAL LINE TO lt_message_body.

  body = 'Please find the attached the Smartform in PDF format.'.
  APPEND body TO lt_message_body.
  APPEND INITIAL LINE TO lt_message_body.

  footer = 'With Regards,'.
  APPEND footer TO lt_message_body.
  footer = 'www.softat.in.'.
  APPEND footer TO lt_message_body.
  "put your text into the document
  lo_document = cl_document_bcs=>create_document(
  i_type = 'RAW'
  i_text = lt_message_body
  i_subject = 'Smartform in PDF' ).

*DATA: l_size TYPE sood-objlen. " Size of Attachment
*l_size = l_lines * 255.
  TRY.
      lo_document->add_attachment(
      EXPORTING
      i_attachment_type = 'PDF'
      i_attachment_subject = 'Your Smartform'
      i_att_content_hex = i_objbin[] ).
    CATCH cx_document_bcs INTO lx_document_bcs.
  ENDTRY.

* Add attachment
* Pass the document to send request
  lo_send_request->set_document( lo_document ).

  "Create sender
  lo_sender = cl_sapuser_bcs=>create( sy-uname ).

  "Set sender
  lo_send_request->set_sender( lo_sender ).

  "Create recipient
  lo_recipient = cl_cam_address_bcs=>create_internet_address( in_mailid ).

*Set recipient
  lo_send_request->add_recipient(
  EXPORTING
  i_recipient = lo_recipient
  i_express = abap_true
  ).

  lo_send_request->add_recipient( lo_recipient ).

* Send email
  lo_send_request->send(
  EXPORTING
  i_with_error_screen = abap_true
  RECEIVING
  result = lv_sent_to_all ).

CONCATENATE 'Email sent to' in_mailid INTO data(lv_msg) SEPARATED BY space.
  WRITE:/ lv_msg COLOR COL_POSITIVE.
  SKIP.
* Commit Work to send the email
  COMMIT WORK.

ENDFORM.

FORM send_multiple_user.

  DATA: in_mailid TYPE ad_smtpadr.

* Begin of sending email to multiple users
* If business want email to be sent to all users at one time, it can be done

* For now we do not want to send 1 email to multiple users
* Mail has to be sent one email at a time
  LOOP AT s_email.
    CLEAR in_mailid.
    in_mailid = s_email-low.
    PERFORM send_mail USING in_mailid .
  ENDLOOP.

ENDFORM. " SEND_MULTIPLE_USER



FORM convert_otf_to_xstring .

* Get Output Text Format (OTF)
  i_otf[] = w_return-otfdata[].

* Import Binary file and filesize
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = v_len_in
      bin_file              = i_xstring   " This is NOT Binary. This is Hexa
    TABLES
      otf                   = i_otf
      lines                 = i_tline
    EXCEPTIONS
      err_max_linewidth     = 1
      err_format            = 2
      err_conv_not_possible = 3
      OTHERS                = 4.
* Sy-subrc check not checked

ENDFORM.

For our test, we made a straightforward smartform with simply a logo and one text line.

Stir things up around town symbol to test the smartform remain solitary.

You would see the capability module connected to this smartform. Stir things up around town symbol once more. Presently you see the boundaries of the capability, hit test symbol once more.

This is our smartform yield.

Presently, our program ought to connect this smartform yield as PDF and email it to different clients.

We should execute our program. Give the smartform name and the email ids. For the test, we are sending just to two clients. You could enter as numerous clients you need.

Execute and you would receive this message (assuming that you are trying our program).

Go to t-code SOST to check whether email truly went out. Indeed!! Indeed it did.

Allow us to browse what this email has for us.

Cool, we have the email body and an association.

Permit us to check accepting that the association is the comparable smartform we truly see above in stay lone mode.

Bingo!! It is in deed the smartform in the PDF design.

YOU MAY LIKE THIS

Introduction to SAP ABAP for HANA

Bridging the Gap: Integrating ABAP with Other Cloud Services

ABAP ON CLOUD

SAP

Send e-mail with subject line greater than 50 characters

Limit on the length of the email subject line Let’s move forward. Make sure the subject line of your email is longer than fifty characters. In certain situations, the email’s title may be longer than 50 characters, depending on the business requirement. Email subjects are limited to 50 characters by the capability module SO_NEW_DOCUMENT_ATT_SEND_API1, which is commonly used when sending mails from SAP.

Therefore, we really want to look for a way to deliver communications in these situations. To complete this, we can use the Business Correspondence Administration (CL_BCS) class. Make sure the subject line of your email is longer than fifty characters.

CL_BCS is a class that fills in as the connection point from BCS to the applications. The strategies for the class cater for the sending capabilities.

You can also read for:- NEW Operator – Structures and Internal Tables

Code Snippet:

TYPES: BEGIN OF t_mail_body.
INCLUDE TYPE solisti1.
TYPES: END OF t_mail_body.

CONSTANTS:
c_check TYPE char1 VALUE ‘X’,
c_mode TYPE char3 VALUE ‘INT’,
c_doc_type TYPE char3 VALUE ‘RAW’.

DATA : i_mail_body TYPE STANDARD TABLE OF t_mail_body,
k_doc_data TYPE sodocchgi1,
v_subject TYPE char255.
DATA:
lv_cnt TYPE i,
lv_sub TYPE string,
lv_receiver TYPE ad_smtpadr,
l_ref_send_request TYPE REF TO cl_bcs,
l_ref_document TYPE REF TO cl_document_bcs,
l_ref_sender TYPE REF TO cl_sapuser_bcs,
l_ref_recipient TYPE REF TO if_recipient_bcs,
l_ref_bcs_exception TYPE REF TO cx_bcs,
lv_sent_to_all TYPE os_boolean.

CLEAR: k_doc_data.

* Populate the email body in internal table i_mail_body[].

* Fill the document data.
DESCRIBE TABLE i_mail_body LINES lv_cnt.

k_doc_data-doc_size = ( lv_cnt – 1 ) * 255.

TRY.
* ——– create persistent send request ————————
l_ref_send_request = cl_bcs=>create_persistent( ).

* ——– create and set document ——————————-
* create document from internal table with text

l_ref_document= cl_document_bcs=>create_document(
i_type = c_doc_type
i_text = i_mail_body
i_length = k_doc_data-doc_size
i_subject = ‘ ‘ ).

* Subject of the email
lv_sub = ‘The following interface failed, Please check’. ” This can * be greater than 50 characters

CALL METHOD l_ref_send_request->set_message_subject
EXPORTING
ip_subject = lv_sub.

* add document to send request
CALL METHOD l_ref_send_request->set_document( l_ref_document ).

* ——— set sender ——————————————-
* note: this is necessary only if you want to set the sender
* different from actual user (SY-UNAME). Otherwise sender is
* set automatically with actual user.

l_ref_sender = cl_sapuser_bcs=>create( sy-uname ).

CALL METHOD l_ref_send_request->set_sender
EXPORTING
i_sender = l_ref_sender.

CLEAR lv_receiver.
* Get receiver from the config table

lv_receiver = ‘xxxxx@gmail.com’.

* ——— add recipient (e-mail address) ———————–
* create recipient – please replace e-mail address
l_ref_recipient = cl_cam_address_bcs=>create_internet_address(
lv_receiver ).

* add recipient with its respective attributes to send request
CALL METHOD l_ref_send_request->add_recipient
EXPORTING
i_recipient = l_ref_recipient
i_express = c_check.

* ———- send document —————————————
CALL METHOD l_ref_send_request->send(
EXPORTING
i_with_error_screen = c_check
RECEIVING
result = lv_sent_to_all ).

COMMIT WORK.

ENDTRY.

*Executing the standard mail sending program for immediate dispatch of mail
SUBMIT rsconn01 WITH mode = c_mode AND RETURN.  ” Mode is INT’

If it’s not too much trouble, note: You can not see the email subject in SAP Exchange code SOST. In any case, in the real email inbox you will actually want to see the headline.

Benefits:

1) This has practically every one of the elements present in the normal FM SO_NEW_DOCUMENT_ATT_SEND_API1.

2) what’s more we can send email with the message lines more noteworthy than 50 characters.

YOU MAY LIKE THIS

A Comprehensive Guide to SAP ABAP Training Online

Core Data Services in ABAP for HANA

Setting Up an ABAP Environment in the Cloud

SAP

How to SPLIT Data in FOR LOOP Using Modern ABAP Syntax?

Before showing How to SPLIT Data in FOR LOOP Using Modern ABAP Syntax? SAP ABAP Designers are know all about Circle — ENDLOOP sentence structure. FOR Circle is moderately new to ABAPers; however, other programming language use it generally. Each engineer has seen this linguistic structure in some or other programming language: for (i=1; i<=3; i++). How could ABAP remain behind?

Whatever the case, previous habits are still present. It is difficult for the slow engineers who were accustomed to standard ABAP programming to use the new punctuation. Today’s article will look at one need that we can definitely meet with the old ABAP, but the new punctuation calls for some help.

The question we asked in our SAP Specialized Wire Gathering and How to SPLIT Data in FOR LOOP Using Modern ABAP Syntax is the result of this post once more. Wesley Massini, one of our real, vibrant, and helpful people, had a program in which he was reading data from a document of a set length. It went perfectly and without any problems. In any case, the document information is no longer fixed once the company decided to separate the content using the highlight “_” later on. At the delimiter highlight, they must separate the data into portions. This delimiter can be anything, such as a pipe (|), tilds (~), or comma (,).

You can also read for:- Transport ABAP Report Variants into a Work Bench Request

Sounds a simple necessity right? Be that as it may, could you at any point do utilizing the new ABAP Sentence structure?

Existing Code for Fixed Length Data

The data in the file would look like this:

It is a document with heterogeneous information. The information in the primary column and second line are unique. For instance, the initial two fields (yellow and blue) in both the columns are Plant and Material. Yet, the third field in red is Seller is first column and keeping in mind that it is a marker in second line. Comparatively fourth field in green is a custom sort in first column and some classification in second line. The thought is, every one of the information columns in the document for type initially ought to go to one inner table and all lines like that of second sort ought to go into another interior table.

We involved SWITCH articulation in new language structure and isolated the columns in view of the length of the information in the document (which is fixed). Column type one has 26 characters while line type two has 18 characters. Likewise, we don’t have to show the augmentation .txt.

As creator and ABAPer Paul Solid says, Compact discs is ABAP in Steriods. We say, not just Compact discs, the new ABAP itself seems to be really dynamic ABAP.

Check the above screen capture. We have In-line information statement, utilization of Significant worth, FOR Circle in inside table, SWITCH and #. Do a F4 on every one of these catchphrases and attempt to figure out the idea.

For our case, we have know the Sort, consequently they come after the Worth administrator. Additionally after SWITCH there is #. The table sorts are announced like underneath.

In order to display the output, we can write the below syntax.

Output

How to Handle Blank Rows?

We are don’t know, how to keep away from the clear lines in both the tables utilizing the cutting edge punctuation. We utilized an Erase proclamation expressly after the information was populated in the inward tables.

Assuming you know how to eliminate the clear lines in the FOR Circle with SWITCH, kindly give the arrangement in the remarks segment. We will refresh this article with your answer.

* Delete Blank Lines
DELETE it_vm_data_tab WHERE werks IS INITIAL.
DELETE it_pm_data_tab WHERE werks IS INITIAL.

New Requirement

Prior our document was fixed length. With the business change, we began getting document with a delimiter highlight ““. In this way, we didn’t have to stress over the length of each fields. Once more, be that as it may, we battled to sort out the most ideal way to Part at “” utilizing new ABAP.

Solution 1

After some examination and with our new information, we accomplished the usefulness utilizing STRLEN, SUBSTRING_BEFORE, SUBSTRING_AFTER , sub, occ string capabilities alongside the Worth and FOR Circle and COND watchwords.

Note: The catchphrase occ is for Event. You could see a negative number for occ = – 1. In the event that occ is positive worth, the events are counted from the left while in the event that occ is a negative number, it is counted from the right side.

Correspondingly check the watchword sub. It is for Substring. Sub searches for the characters in the string.

DATA  result TYPE string.
result = substring( val = 'ABCDEFGH' off = 2 len = 2 ). 
result = substring_from( val = 'ABCDEFGH' sub = 'CD' ).
result = substring_after( val = 'ABCDEFGH' sub = 'CD' ).
result = substring_before( val = 'ABCDEFGH' sub = 'CD' ).
result = substring_to( val = 'ABCDEFGH' sub = 'CD' ).

The above bit is from SAP Help to show the utilization of SUB and different SUBSTRING capabilities. The result for each outcome is “Disc”, “CDEFGH”, “EFGH”, “Stomach muscle”, and “ABCD” in a similar request.

The above code likewise gave a clear line and we had to unequivocally utilize the Erase explanation. Likewise, we had COND in the grammar which could be stayed away from. We accomplished the business necessity, yet we were all the while contemplating whether there is a superior method for accomplishing it. Without the Erase articulation and COND. Also, prepare to be blown away. Stephan gave a faultless arrangement once more!!

Solution 2 from Stephan

Stephan prescribed to place an identifier in the start of the information line for the document. For our case, it is VM and PM. Additionally, with his new arrangement rationale there is compelling reason need to utilize COND.

Actually take a look at the arrangement above. He has utilized WHERE condition in the FOR Circle. There is no requirement for WHEN and afterward. Additionally, the STRLEN check of each column is forestalled alongside COND #.

Code Snippet

* Types Declaration
TYPES:
  BEGIN OF ty_vm_file,
    werks TYPE werks_d,
    matnr TYPE matnr,
    lifnr TYPE lifnr,
    ztype TYPE char1,
  END OF ty_vm_file,

  BEGIN OF ty_pm_file,
    werks TYPE werks_d,
    matnr TYPE matnr,
    htype TYPE char1,
    zcagn TYPE char2,
  END OF ty_pm_file,

  BEGIN OF ty_filename,
    filename TYPE text1024,
  END OF ty_filename,

* Table Type declaration
  tt_vm_tab       TYPE TABLE OF ty_vm_file WITH EMPTY KEY,
  tt_pm_tab       TYPE TABLE OF ty_pm_file WITH EMPTY KEY,
  tt_filename_tab TYPE TABLE OF ty_filename WITH EMPTY KEY.

* My recommendation is to put an identifier at the beginning of the filename like in this sample.
* With this logic there is no need for usage of COND like in the first sample.
DATA(it_fillename_data_tab) = VALUE tt_filename_tab( ( filename = 'VM_CA02_0074203_0000102207_H.txt' )
                                 ( filename = 'PM_CA02_0074203_C_HA.txt' ) ).

DATA(it_vm_data_tab) = VALUE tt_vm_tab( FOR ls_filename IN it_fillename_data_tab
                            WHERE ( filename(3) EQ 'VM_' )
                            ( werks = substring_after( val = substring_before( val = ls_filename-filename sub = '_' occ = 2 ) sub = '_' occ = 1 )
                              matnr = substring_after( val = substring_before( val = ls_filename-filename sub = '_' occ = 3 ) sub = '_' occ = 2 )
                              lifnr = substring_after( val = substring_before( val = ls_filename-filename sub = '_' occ = 4 ) sub = '_' occ = 3 )
                              ztype = substring_after( val = substring_before( val = ls_filename-filename sub = '.' occ = -1 ) sub = '_' occ = -1 )
                                               ) ).

DATA(it_pm_data_tab) = VALUE tt_pm_tab( FOR ls_filename IN it_fillename_data_tab
                       WHERE ( filename(3) EQ 'PM_' )
                               ( werks = substring_after( val = substring_before( val = ls_filename-filename sub = '_' occ = 2 ) sub = '_' occ = 1 )
                                 matnr = substring_after( val = substring_before( val = ls_filename-filename sub = '_' occ = 3 ) sub = '_' occ = 2 )
                                 htype = substring_after( val = substring_before( val = ls_filename-filename sub = '_' occ = 4 ) sub = '_' occ = 3 )
                                 zcagn = substring_after( val = substring_before( val = ls_filename-filename sub = '.' occ = -1 ) sub = '_' occ = -1 )
                                                                          ) ).
* Add both table data for display
cl_demo_output=>write_data( it_vm_data_tab ).
cl_demo_output=>write_data( it_pm_data_tab ).
** Show the output
cl_demo_output=>display( ).

YOU MAY BE INTERESTED IN

Tutorials on SAP ABAP

The World of ABAP Consultants: Unlocking the Power of SAP

Cracking the Code: Your Earning Potential as a SAP ABAP Developer with 5 Years of Experience

SAP

Calculator in SAP using New ABAP Syntax

SAP Google Maps integration We are going to Calculator in SAP using New ABAP Syntax. SAP HANA is Hot. Fiori/UI5 is Cool. OData is Captivating. Yet, in every one of these tomfoolery, fundamental ABAP is as yet flourishing. This article is an illustration of the fundamental ABCs of ABAP which we really want till ABAP doesn’t get wiped out (which won’t ever occur) later on SAP World. Darwin’s law of Advancement holds great to ABAPers also. ABAPers need to advance and get new deceives of the game in their kitty, to remain ahead in the opposition. In this article, I have attempted to show case a portion of the New Language structures of ABAP, which makes programming more straightforward and diminishes the code impressions. Calculator in SAP using New ABAP Syntax.

Calculator in SAP using New ABAP Syntax.

The setting behind this article: Calculator in SAP using New ABAP Syntax!

You can also read for:- Do all ABAPers know Fixed Point Arithmetic?

Question: The outcome ought to be imprinted in Outcome box rather than the Info text. For instance, for Information ‘2+3’ I want the Outcome ‘5’ to be imprinted in outcome box. What I have done is, doled out the Info field ‘IN’ to Result field ‘RES’.

Reply from @Anask (in few seconds or less. That the excellence of this gathering):
It regards the variable as string and simply duplicates content of one field to another. You want to part at SIGN and get information into 2 separate fields and afterward do the administrator activity. Simply utilize Split and afterward figure it out activity. Use CASE articulation and split in light of the sign it contains.

Sample Code:

IF input CS "+".
lv_operator = "+".
ELSEIF input CS "-".
lv_operator = "+".
ELSEIF input CS "*".
lv_operator = "*".
ELSEIF input CS "/".
lv_operator = "/".
ENDIF.
SPLIT lv_input AT lv_operator
INTO lv_operand1
lv_operand2.

I’m individuals from numerous WhatsApp and Wire and different gatherings. However, this SAP Specialized Gathering is the most dynamic one where we have lots of conversations consistently. Most Inquiries get Addressed or if nothing else get a few thoughts for the arrangement. In the event that you have not joined at this point, check it out. It is completely safe. Furthermore, nobody can realize your portable number, not even the Administrators. You really want to have Wire Application introduced in your gadget before you join the gathering utilizing the beneath connect.

All things considered,I’m a SAP ABAP Designer. I’m the pioneer behind Köster Counseling. If it’s not too much trouble, actually look at my site for more data.

Enough of me. Presently, lets return to the top story. On the off chance that you are a beginner of ABAP7.4, a portion of the focuses which you really want to note in the underneath SAP Mini-computer Program are:

1. Inline Data Declaration

DATA(lv_off) = sy-index - 1.
DATA(lv_add) = abap_true.
READ TABLE gt_string_tab ASSIGNING FIELD-SYMBOL(<lv_op>) WITH TABLE KEY table_line = '/'.

2. RAISE exceptions

RAISE missing_number_at_beginning.
RAISE two_operator_not_allowed.
RAISE division_by_zero.
RAISE missing_number_at_end.
RAISE unknown_error.

(Nothing new. Showing for beginners in ABAP)

3. Conversion Function

DATA(lv_result) = CONV labst( <lv_first> / <lv_second> ).
rv_result = CONV #( gt_string_tab[ 1 ] ).
DATA(gv_fieldname) = |RB_CALC{ CONV numc1( sy-index ) }|.
cv_editable = |PA_CALC{ CONV numc1( sy-index ) }|.

4. New Syntax

INSERT |{ lv_result }| INTO gt_string_tab INDEX lv_tabix - 1.

5. Inline Data Declaration in Class Methods

* Call the Class Method to do the calculation

zcl_stkoes_calc=>do_calculation(
EXPORTING
iv_formula = <gv_calc>
RECEIVING
rv_result = DATA(gv_result)
EXCEPTIONS
division_by_zero = 1 " Division By Zero
missing_number_at_beginning = 2 " Missing Number at the beginning
missing_number_at_end = 3 " Missing Number at the end
two_operator_not_allowed = 4 " Two Operator are not allowed
unknown_error = 5 " Unknown Error
OTHERS = 6 ).

Did you check gv_result is announced during the call of the technique do_calculation.

Note: We Can’t do comparable Inline Information Statement while calling a Capability Module. Just accessible in Class Technique.

6. MESSAGE with SWITCH

MESSAGE |{ SWITCH #( sy-subrc
WHEN 1 THEN |Division by zero|
WHEN 2 THEN |Missing number at the beginning|
WHEN 3 THEN |Missing number at the end|
WHEN 4 THEN |Two operator is not allowed|
WHEN 5 THEN |Unknown Error|
ELSE |Other Error| ) }| TYPE 'S' DISPLAY LIKE 'E'.

Allow me to show you, what the Adding machine can do. It does the essential +, – , X,/mathematic activities. Be that as it may, the rationale and idea which I have placed in the class can be extrapolated to many genuine use case real venture prerequisites.

I have purposely utilized the Macros to cause you to comprehend how Macros can in any case be utilized. Assuming you feel, macros are not required, you can do the immediate Radio Buttons in the Choice Screen without the Macros.

Sample Input String for the Calculator and their corresponding Results
SAP Calculator in ABAP

Sample Error Handling

Here is the finished Code which you can attempt. You can likewise download the program text document at the lower part of this article.

*&---------------------------------------------------------------------*
*& Report ZSTKOES_CALC
*&---------------------------------------------------------------------*
*& This is a Utilty Program which acts like a Simple Calculator.
*& OOPs Concept along with New ABAP7.4+ Syntaxes are used
*& Feel Free to refer and use it as required
*&---------------------------------------------------------------------*
REPORT zstkoes_calc.

CLASS zcl_stkoes_calc DEFINITION.

PUBLIC SECTION.
CONSTANTS:
BEGIN OF gcs_operators,
div TYPE char1 VALUE '/' ##NO_TEXT,
mod TYPE char3 VALUE 'MOD' ##NO_TEXT,
mul TYPE char1 VALUE '*' ##NO_TEXT,
sub TYPE char1 VALUE '-' ##NO_TEXT,
add TYPE char1 VALUE '+' ##NO_TEXT,
END OF gcs_operators.

CLASS-METHODS:
do_calculation
IMPORTING
VALUE(iv_formula) TYPE string
RETURNING
VALUE(rv_result) TYPE labst
EXCEPTIONS
division_by_zero
missing_number_at_beginning
missing_number_at_end
two_operator_not_allowed
unknown_error.

PRIVATE SECTION.
TYPES:
gtty_string TYPE TABLE OF string.
CLASS-METHODS:
convert_formula_to_string_tab
IMPORTING
VALUE(iv_formula) TYPE string
EXPORTING
VALUE(et_string_tab) TYPE gtty_string
EXCEPTIONS
missing_number_at_beginning
missing_number_at_end
two_operator_not_allowed,

calculate
IMPORTING
VALUE(it_string_tab) TYPE gtty_string
RETURNING
VALUE(rv_result) TYPE labst
EXCEPTIONS
division_by_zero
unknown_error.
ENDCLASS.

CLASS zcl_stkoes_calc IMPLEMENTATION.
METHOD do_calculation.

convert_formula_to_string_tab(
EXPORTING
iv_formula = iv_formula
IMPORTING
et_string_tab = DATA(lt_string_tab)
EXCEPTIONS
missing_number_at_beginning = 1
missing_number_at_end = 2
two_operator_not_allowed = 3 ).

IF sy-subrc EQ 0.
calculate(
EXPORTING
it_string_tab = lt_string_tab
RECEIVING
rv_result = rv_result
EXCEPTIONS
division_by_zero = 4
unknown_error = 5 ).
ENDIF.

IF sy-subrc NE 0.
CASE sy-subrc.
WHEN 1.
RAISE missing_number_at_beginning.
WHEN 2.
RAISE missing_number_at_end.
WHEN 3.
RAISE two_operator_not_allowed.
WHEN 4.
RAISE division_by_zero.
WHEN 5.
RAISE unknown_error.
ENDCASE.
ENDIF.

ENDMETHOD.

METHOD convert_formula_to_string_tab.
FIELD-SYMBOLS:
<lv_value> TYPE string.

CONDENSE iv_formula NO-GAPS.
DATA(lv_off) = 0.
DO.
IF iv_formula+lv_off(1) CN '1234567890'.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE gcs_operators TO FIELD-SYMBOL(<lv_operator>).
IF sy-subrc NE 0.
EXIT.
ENDIF.
DATA(lv_length) = strlen( <lv_operator> ).
IF iv_formula+lv_off(lv_length) EQ <lv_operator>.
IF lv_off EQ 0.
RAISE missing_number_at_beginning.
ELSEIF <lv_value> IS NOT ASSIGNED.
RAISE two_operator_not_allowed.
ENDIF.
UNASSIGN <lv_value>.
APPEND iv_formula+lv_off(lv_length) TO et_string_tab.
ADD lv_length TO lv_off.
EXIT.
ENDIF.
ENDDO.
ELSE.
IF <lv_value> IS NOT ASSIGNED.
APPEND INITIAL LINE TO et_string_tab ASSIGNING <lv_value>.
<lv_value> = iv_formula+lv_off(1).
ELSE.
<lv_value> = |{ <lv_value> }{ iv_formula+lv_off(1) }|.
ENDIF.
ADD 1 TO lv_off.
ENDIF.
IF lv_off EQ strlen( iv_formula ).
EXIT.
ENDIF.
ENDDO.

IF <lv_value> IS NOT ASSIGNED.
RAISE missing_number_at_end.
ENDIF.
ENDMETHOD.

METHOD calculate.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE gcs_operators TO FIELD-SYMBOL(<lv_operator>).
IF sy-subrc NE 0.
EXIT.
ENDIF.

DO.
ASSIGN it_string_tab[ table_line = <lv_operator> ] TO FIELD-SYMBOL(<lv_op>).
IF sy-subrc NE 0.
EXIT.
ENDIF.
DATA(lv_from) = sy-tabix - 1.
DATA(lv_to) = sy-tabix + 1.
READ TABLE it_string_tab ASSIGNING FIELD-SYMBOL(<lv_first>) INDEX lv_from.
READ TABLE it_string_tab ASSIGNING FIELD-SYMBOL(<lv_second>) INDEX lv_to.
IF <lv_first> IS ASSIGNED AND <lv_second> IS ASSIGNED.
TRY.
CASE <lv_operator>.
WHEN '/'.
DATA(lv_result) = CONV labst( <lv_first> / <lv_second> ).
WHEN 'MOD'.
lv_result = <lv_first> MOD <lv_second>.
WHEN '*'.
lv_result = <lv_first> * <lv_second>.
WHEN '-'.
lv_result = <lv_first> - <lv_second>.
WHEN '+'.
lv_result = <lv_first> + <lv_second>.
ENDCASE.
CATCH cx_sy_zerodivide INTO DATA(lo_error).
RAISE division_by_zero.
ENDTRY.
DELETE it_string_tab FROM lv_from TO lv_to.
INSERT |{ lv_result }| INTO it_string_tab INDEX lv_from.
ENDIF.
ENDDO.
ENDDO.

IF lines( it_string_tab ) EQ 1.
rv_result = it_string_tab[ 1 ].
ELSE.
RAISE unknown_error.
ENDIF.
ENDMETHOD.
ENDCLASS.

**--------------------------------------------------------------------*
** Start of Program
**--------------------------------------------------------------------*
* Macro to set one radiobutton as default (can be used only once)
DEFINE calc_default.
SELECTION-SCREEN:
BEGIN OF LINE.
PARAMETERS:
rb_calc&1 RADIOBUTTON GROUP cal DEFAULT 'X' USER-COMMAND calc&1.
SELECTION-SCREEN:
COMMENT 3(14) co_calc&1.
PARAMETERS:
pa_calc&1 TYPE string DEFAULT &2.
SELECTION-SCREEN:
END OF LINE.
END-OF-DEFINITION.

* Macro to create radiobutton without deafult
DEFINE calc.
SELECTION-SCREEN:
BEGIN OF LINE.
PARAMETERS:
rb_calc&1 RADIOBUTTON GROUP cal.
SELECTION-SCREEN:
COMMENT 3(14) co_calc&1.
PARAMETERS:
pa_calc&1 TYPE string DEFAULT &2.
SELECTION-SCREEN:
END OF LINE.
END-OF-DEFINITION.

SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE gt_b01.

* Creating all paramater on SELECTION SCREEN using macro
calc_default 1 '10 + 300 / 100 * 10 - 50'.
calc 2 '+10 + 300 / 100 * 10 - 50'.
calc 3 '10 + 300 / 100 * 10 - 50+'.
calc 4 '10 + 300 / 100 * * 10 - 50'.
calc 5 '10 + 300 / 0 * 10 - 50'.
SELECTION-SCREEN END OF BLOCK b01.

INITIALIZATION.
* Filling all comments and title
co_calc1 = '1. Calculation'.
co_calc2 = '2. Calculation'.
co_calc3 = '3. Calculation'.
co_calc4 = '4. Calculation'.
co_calc5 = '5. Calculation'.
gt_b01 = 'Calculations'.

AT SELECTION-SCREEN OUTPUT.
DATA:
gv_editable TYPE rsscr_name.

* Check which radiobutton is selected
PERFORM get_field_selected_radiobutton CHANGING gv_editable.

* Leave only selected line editable
LOOP AT SCREEN.
IF screen-name(7) EQ 'PA_CALC' AND screen-name NE gv_editable.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

START-OF-SELECTION.
DATA:
gv_editable TYPE rsscr_name.

* Check which radiobutton is selected
PERFORM get_field_selected_radiobutton CHANGING gv_editable.

* Get the Formular of selected radiobutton
ASSIGN (gv_editable) TO FIELD-SYMBOL(<gv_calc>).
IF <gv_calc> IS ASSIGNED.

* Do the calculation
zcl_stkoes_calc=>do_calculation(
EXPORTING
iv_formula = <gv_calc>
RECEIVING
rv_result = DATA(gv_result)
EXCEPTIONS
division_by_zero = 1 " Division By Zero
missing_number_at_beginning = 2 " Missing Number at the beginning
missing_number_at_end = 3 " Missing Number at the end
two_operator_not_allowed = 4 " Two Operator are not allowed
unknown_error = 5 " Unknown Error
OTHERS = 6 ).

* Handle Errors
IF sy-subrc NE 0.
MESSAGE |{ SWITCH #( sy-subrc
WHEN 1 THEN |Division by zero|
WHEN 2 THEN |Missing number at the beginning|
WHEN 3 THEN |Missing number at the end|
WHEN 4 THEN |Two operator is not allowed|
WHEN 5 THEN |Unknown Error|
ELSE |Other Error| ) }| TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDIF.
ENDIF.

END-OF-SELECTION.

WRITE: gv_result.
*&---------------------------------------------------------------------*
*& Form GET_FIELD_SELECTED_RADIOBUTTON
*&---------------------------------------------------------------------*
* <--CV_EDITABLE PARAMETER of selected radiobutton
*----------------------------------------------------------------------*
FORM get_field_selected_radiobutton CHANGING cv_editable TYPE rsscr_name.
DO.
DATA(lv_fieldname) = |RB_CALC{ CONV numc1( sy-index ) }|.
ASSIGN (lv_fieldname) TO FIELD-SYMBOL(<lv_fieldvalue>).
IF sy-subrc NE 0.
EXIT.
ELSEIF <lv_fieldvalue> EQ abap_true.
cv_editable = |PA_CALC{ CONV numc1( sy-index ) }|.
EXIT.
ENDIF.
ENDDO.

ENDFORM.

Download above program in text record.  

To involve Macros for the Radio Buttons, you can download one more adaptation of a similar program with less difficult Choice screen. 

Output of Version 2 of the SAP ABAP Calculator looks like below.

ABAP Calculator

I trust, this article would rouse you to involve the New ABAP Linguistic structure in the entirety of your current and future turns of events. We really want to embrace the change and acknowledge it in our everyday undertakings. Change is Progress.

YOU MAY BE INTERESTED IN

OData in SAP ABAP: Streamlining Data Exchange and Integration

Tutorials on SAP ABAP

Tutorials on SAP ABAP

SAP

ABAP on SAP HANA. Part VI. New Age Open SQL ABAP 740

New Age Open SQL ABAP 740

A brief break from HANA would be included in this essay. We would take a break and see what Open SQL has to offer. Why does it have the name Open? You’re right! “Open” means “Open to any information base,” such as an independent information base. To take advantage of the Open SQL articulations that can further enhance the way we design our apps, you do not need to have a HANA database. Open SQL ABAP 740 in the New Age.

Assuming you have been following the past posts on SAP ABAP on HANA, you would realize that Compact discs View is one more procedure to accomplish Code to Information worldview. In the event that a similar usefulness can be accomplished by the two Discs Strategy and Open SQL, which one would it be a good idea for us to take on? Now start our tutorial on New Age Open SQL ABAP 740.

Reply: SAP believes that us should remain Open. Open SQL is the best option. Then comes Discs View and afterward the put away methods (ADBC, ADMP which we will cover in our ensuing articles).

The goal of the state-of-the-art ABAP/SQL/SAP HANA is to push logic down to the database. To apply and implement the reasoning in the data set, we appropriate these significant advancements. However, keep in mind that SAP must also be approximately as open as possible. Therefore, when choosing between an information base free arrangement and a data set explicit arrangement, the last option (data set autonomous) is always chosen.

Let’s go on to the most important story. ABAP’s New Age SQL.

Preceding delivery 740, assuming we had the necessity to add an extra section in the result which didn’t exist in that frame of mind with some custom rationale, then we typically composed something like beneath.

We characterized the Sorts. We circled through the table and added the custom rationale (High Buy or Low Buy) as displayed beneath.

TYPES: BEGIN OF ty_ekpo,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
werks TYPE ewerk,
netpr TYPE bprei,
pur_type TYPE char14,
END OF ty_ekpo.

DATA: it_ekpo TYPE STANDARD TABLE OF ty_ekpo.

FIELD-SYMBOLS <fs_ekpo> TYPE ty_ekpo.

SELECT ebeln ebelp werks netpr
FROM ekpo
INTO TABLE it_ekpo.

LOOP AT it_ekpo ASSIGNING <fs_ekpo>.

IF <fs_ekpo>-netpr GT 299.
<fs_ekpo>-pur_type = 'High Purchase'.
ELSE.
<fs_ekpo>-pur_type = 'Low Purchase'.
ENDIF.

ENDLOOP.

IF it_ekpo IS NOT INITIAL.
cl_demo_output=>display_data(
EXPORTING
value = it_ekpo
name = 'Old AGE SQL : 1' ).
ENDIF.
Open SQL in ABAP 740

Allow us to perceive how we can accomplish exactly the same thing in another manner. With ABAP 740 or more, we dispose of TYPES, Information Announcement and Circle. Isn’t it cool?

Sample 1 ( Using comma separated fields with inline data declaration and usage of CASE for reference fields)

SELECT ebeln, ebelp, werks, netpr,
CASE
WHEN netpr > 299
THEN 'High Purchase'
ELSE 'Low Purchase'
END AS pur_type
FROM ekpo
INTO TABLE @DATA(lt_sales_order_header).

IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_sales_order_header
name = 'New AGE SQL : 1' ).
ENDIF.
HANA SQL ABAP

Yields from both the above methods are same. However, the way does matters. Isn’t it?

Assuming you have some disarray in regards to HANA.

Then, let us really look at the strong inbuilt capabilities in SELECT.

Sample 2 ( Using JOIN and COUNT / DISTINCT functions in SELECT )

PARAMETERS: p_matnr TYPE matnr,
p_lgort TYPE lgort_d.

SELECT mara~matnr,
mard~lgort,
COUNT( DISTINCT ( mard~matnr ) ) AS distinct_mat, " Unique Number of Material
COUNT( DISTINCT ( mard~werks ) ) AS distinct_plant, " Unique Number of Plant
SUM( mard~labst ) AS sum_unrest,
AVG( mard~insme ) AS avg_qlt_insp,
SUM( mard~vmspe ) AS sum_blocked
FROM mara AS mara INNER JOIN mard AS mard
ON mara~matnr EQ mard~matnr
INTO TABLE @DATA(lt_storage_loc_mat)
UP TO 1000 ROWS
WHERE mard~matnr = @p_matnr
AND mard~lgort = @p_lgort
GROUP BY mara~matnr,
mard~lgort.

IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_storage_loc_mat
name = 'New AGE SQL : 2' ).
ENDIF.

Particular Material is 1 and Unmistakable Plant is 2. Total for the Unlimited stock is 2, AVG is 2/2 = 1 and Amount of Impeded stock is 2. This is only an example to exhibit how flexible and strong the SELECT proclamation has become.

SELECT in ABAP 740

Then, in our menu, today is the Numerical Administrators in SELECT. Check the underneath scrap where we can straightforwardly appoint ’10’ (as refund percent) which would be in the interior table. CEIL capability, increase, deduction and so forth can be taken care of during the SELECT assertion. In the event that we were not in 740, we would have required a different circle and pack of code to accomplish this capability. Isn’t ABAP genuine current at this point?

Sample 3 ( Using vivid mathematical operators in SELECT )

DATA: lv_rebate TYPE p DECIMALS 2 VALUE '0.10'.

SELECT ebeln,
10 AS rebate_per,
CEIL( netpr ) AS whole_ord_net,
( @lv_rebate * netpr ) AS rebate,
( netpr - ( @lv_rebate * netpr ) ) AS act_net
FROM ekpo
USING CLIENT '130'
UP TO 10 ROWS
INTO TABLE @DATA(lt_po_data).

IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_po_data
name = 'New AGE SQL : 3' ).
ENDIF.
Modern ABAP in HANA

Math is fun with ABAP 740, yet additionally legitimate programming. Go on underneath to taste the new flavor.

Sample 4 ( Using Complex Case statement on non-referenced fields i.e. multiple in one Select )

PARAMETERS: p_werks TYPE werks_d.
DATA:
lv_rebate TYPE p DECIMALS 2 VALUE '0.10',
lv_high_rebate TYPE p DECIMALS 2 VALUE '0.30'.

SELECT ebeln,
werks,
CEIL( netpr ) AS whole_ord_net,
( @lv_rebate * netpr ) AS rebate,
( netpr - ( @lv_rebate * netpr ) ) AS act_net,

CASE WHEN werks = @p_werks " For specific plant
THEN @lv_rebate
ELSE @lv_high_rebate
END AS rebate_type,

CASE WHEN werks = @p_werks " For specific plant
THEN 'low rebate'
ELSE 'high rebate'
END AS low_high

FROM ekpo
USING CLIENT '130'
UP TO 25 ROWS
INTO TABLE @DATA(lt_po_data).

IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_po_data
name = 'New AGE SQL : 4' ).
ENDIF.

ABAP 7.4 SELECT

Blend’s exacting importance from the word reference is ‘met up and shape one mass or entire’ or ‘join (components) in a mass or entirety’.

As per SAP documentation, the Mix capability in Open SQL returns the worth of the contention arg1 (in the event that this isn’t the invalid worth); in any case, it returns the worth of the contention arg2. A clear should be set after the initial enclosure and before the end bracket. A comma should be put between the contentions

Really take a look at the use underneath. In the event that information for ekko~lifnr is available (implies PO is made for the lessor) then the LIFNR (Merchant Number) from EKKO is printed else, ‘No PO’ strict is refreshed. This capability is very helpful in numerous genuine functional situations.

Sample 5 ( Using COALESCE and Logical operators like GE / GT/ LE / LT etc in JOIN which was originally not available

SELECT lfa1~lifnr,
lfa1~name1,
ekko~ebeln,
ekko~bukrs,
COALESCE( ekko~lifnr, 'No PO' ) AS vendor
FROM lfa1 AS lfa1 LEFT OUTER JOIN ekko AS ekko
ON lfa1~lifnr EQ ekko~lifnr
AND ekko~bukrs LT '0208'
INTO TABLE @DATA(lt_vend_po)
UP TO 100 ROWS.

IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_vend_po
name = 'New AGE SQL : 5' ).
ENDIF.
COALESCE in HANA

How frequently and in what number of activities did you have the prerequisite to print Endlessly establish depiction together like 0101 (Houston Site) or in structures you had the necessity to compose Payee (Payee Name)? We accomplished it by circling and connecting. We didn’t have better choice prior, yet presently we can do it while choosing the information. On account of the SAP Improvement Group.

Sample 6 (Concatenation while selecting data )

SELECT lifnr
&& '(' && name1 && ')' AS Vendor,
ORT01 as city
FROM lfa1
INTO TABLE @DATA(lt_bp_data)
UP TO 100 ROWS.
IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_bp_data
name = 'New AGE SQL : 6' ).
ENDIF.
CONCATENATE in SELECT statement

Each report/transformation/interface requests that we approve the information and we do it by checking its presence in the actually look at table. That has become simpler and better presently like displayed underneath.

Sample 7 ( Check existence of a record )

SELECT SINGLE @abap_true
FROM mara
INTO @DATA(lv_exists)
WHERE MTART = 'IBAU'.
IF lv_exists = abap_true.
WRITE:/ 'Data Exists!! New AGE SQL : 7'.
ENDIF.

ABAP was dependably a fifth era programming language and it has become all the more so. It has become more comprehensible and genuine grammatically as well. . HAVING capability is one more quill to the crown.

Sample 8 ( Use of HAVING functions in SELECT )

SELECT lfa1~lifnr,
lfa1~name1,
ekko~ebeln,
ekko~bukrs
FROM lfa1 AS lfa1 INNER JOIN ekko AS ekko
ON lfa1~lifnr EQ ekko~lifnr
AND ekko~bukrs LT '0208'
INTO TABLE @DATA(lt_vend_po)
GROUP BY lfa1~lifnr, lfa1~name1, ekko~ebeln, ekko~bukrs
HAVING lfa1~lifnr > '0000220000'.

IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_vend_po
name = 'New AGE SQL : 8' ).
ENDIF.
ABAP on HANA

Keep in mind, some of the time we really want to choose all fields of more than one table and give custom names in the result. Wasn’t it tedious to make TYPEs and accomplish our prerequisite?

Test 9 ( Utilization of choice of all segments with renaming of fields. This is helpful in the event that you need to do all field select )

I thought with ABAP 740, I could do the underneath.

SELECT jcds~*,
tj02t~*
FROM jcds INNER JOIN tj02t
ON jcds~stat = tj02t~istat
WHERE tj02t~spras = @sy-langu
INTO TABLE @DATA(lt_status)
UP TO 1000 ROWS.
IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_status
name = 'New AGE SQL : 9' ).
ENDIF.

The above code is linguistically right. Amazing!! I was so eager to test it as it would show all sections from both the tables.

SAP ABAP

Uh oh!! We receive the above message. Too soon to be so cheerful.

Allow us to change a similar code a tad. We want to characterize the Sorts and pronounce the interior table (Inline didn’t work above).

TYPES BEGIN OF ty_data.
INCLUDE TYPE jcds AS status_change RENAMING WITH SUFFIX _change.
INCLUDE TYPE tj02t AS status_text RENAMING WITH SUFFIX _text.
TYPES END OF ty_data.

DATA: lt_status TYPE STANDARD TABLE OF ty_data.
SELECT jcds~*,
tj02t~*
FROM jcds INNER JOIN tj02t
ON jcds~stat = tj02t~istat
WHERE tj02t~spras = @sy-langu
INTO TABLE @lt_status
UP TO 100 ROWS.

IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_status
name = 'New AGE SQL : 9' ).
ENDIF.

Check _CHANGE is added to the field name. _TEXT is additionally included the section name from second table (not caught in the screen print beneath)

SAP ABAP for beginners

These were only the tip of the chunks of ice. We would coincidentally find more elements and shocks as we work on projects in genuine framework. Just to tell you, all the above code pieces are from a customary data set (not HANA) which has EhP 7.4. So don’t confound that we really want HANA data set to exploit present day SQL strategies. We simply need close or more EhP 7.4.

We inquired as to whether Compact discs Perspectives and SQL can accomplish a similar usefulness. Which one would it be a good idea for us to pick?

Master Simon Bain (Chief SearchYourCloud Inc.) said:
I guess the response would be one more inquiry or set of inquiries. In your application do you right now utilize Compact discs? Are your engineers proficient on Discs? On the off chance that yes to both, most likely Discs Perspectives.
In the event that there is an expectation to learn and adapt, go for the more well known SQL and train the improvement group for the following update, as opposed to placing in code that they are either discontent with or have little information on.

Toward the day’s end, I would agree that utilization whichever one turns out best for your undertaking, group and application. The client shouldn’t see any distinction in convenience. Everything no doubt revolves around support and information by the day’s end.

To get such valuable articles straightforwardly to your inbox, if it’s not too much trouble, Buy in. We regard your security and view safeguarding it in a serious way.

Thank you kindly for your time!!

YOU MAY LIKE THIS

ABAP for SAP HANA. ALV Report On SAP HANA – Opportunities And Challenges

ABAP on SAP HANA: ATC – ABAP Test Cockpit Setup & Exemption Process

Power of Parallel Cursor in SAP ABAP

SAP

Secondary Index in Traditional SAP Database and SAP HANA Database

Let’s begin by discussing secondary indexes in SAP HANA and traditional SAP databases. Since a list is an organized copy of the selected data set table fields, we all know that a file in a data set table helps to retrieve the selected column more quickly. In real-world scenarios and practical endeavors, we often lack the necessary keys in our decision boundaries; as a result, the complete table needs to be examined without the necessary list. We are persuaded to create Optional Records in exemplary non-HANA SAP Data Set tables in these situations. SAP HANA and traditional SAP databases both have secondary indexes.

By and large, making Auxiliary Record makes information recovery quicker. Be that as it may, we need to pay something for this Optional Record. What is the cost of having Auxiliary List? Secondary Index in Traditional SAP Database and SAP HANA Database.

Reply:

1) Each time a passage is saved in the data set table, there is an extra above of refreshing the Auxiliary Files. Each extra record dials back the addition of columns in the table.

2) On the off chance that we have an excessive number of Auxiliary Lists for the information base table, odds are there that the capacity memory consumed for these files is nearly essentially as immense as need might have arisen for the entire data set table itself.

3) Premise Group needs to invest a lot of energy routinely to redesign the records that get divided over the long haul.

4) An excessive number of files can likewise cause the information base framework enhancer to choose some unacceptable record. To forestall this, the files in a table should share as couple of fields as could be expected.

What number of Optional Lists would it be a good idea for us to have in an exemplary data set table?
Reply: SAP suggests something like five auxiliary files.

When would it be a good idea for us to make Optional File?

Reply:

1) The fields in an Optional List ought to be fields through which we frequently select. The field or fields of an optional list ought to be particular to the point that each file section compares to exceptionally least percent of the complete passages in the table. SAP suggests Optional List ought to hold a limit of 5% of the all out number of table passages.

2) Auxiliary files are to be made exclusively for information base tables where the read gets to are additional time-basic than the compose gets to since each made list must be kept up with for compose gets to.

3) The fields that are probably going to be questioned with the = administrator ought to be toward the start of the list.

WHERE Proviso for Auxiliary Record:

1) ‘=’ (Equivalent to Administrator), IN conditions ‘AND’ joins are productively upheld by Auxiliary File, i.e they love Positive administrators. Auxiliary Record additionally works for LIKE proviso on the off chance that you can’t give EQ, IN statement.
IN implies various EQ for a section. Consequently, IN is viable in WHERE Condition.

2) Negative situations such as <>, NE, and NOT should be avoided. We should change the WHERE clause to make it sure if at all possible. In any case, we should identify the circumstances in the WHERE condition and not completely ignore them if this is absurd. This is the primary method used to choose the relevant information records. Any other technique would violate the exhibition rule as you would be looking through useless records that you would then have to remove in the ABAP program.

3) In the event that you don’t determine all fields in the list, ensure that you encase the underlying part of the file in the WHERE condition. In any case, the utilization of a record is beyond the realm of possibilities as a rule.

The enhancer for the most part stops on the off chance that the determination condition contains an ‘OR’. As such, it doesn’t assess the fields checked by ‘OR’ while choosing and applying the record. An exemption for this is ‘OR’ connections remaining all alone. Thusly, conditions containing an OR join for one of the filed fields ought to be reformulated if vital.

The optimizer stops working when it encounters OR in the following SELECT statement.

Not Recommended

SELECT * FROM spfli 
WHERE carrid = 'LH' AND 
( CITYFROM = 'FRANKFURT' OR cityfrom = 'NEW YORK' ).

When replaced by the equivalent statement (below), the entire condition can be optimized with respect to the existing indexes.

Better use of ‘OR’ clause.

SELECT * 
FROM spfli 
WHERE ( carrid = 'LH' AND cityfrom = 'FRANKFURT' ) OR 
( carrid = 'LH' AND cityfrom = 'NEW YORK' ).

What is the SAP Table which stores the file names and data for any data set table?
Reply: DD12L – R/3 S_SECINDEX: auxiliary lists, header

Above we discovered that SAP suggests greatest 5 Optional Files be made. Actually, what number of Optional Files could we at any point make in conventional (non-HANA) SAP data set?
There are many responses in famous SAP Discussion. Some say 9 others say 16 and some say limitless.

Reply: I checked our SAP framework and found that we have Auxiliary Lists to the count of 25. Check, even the MARA table has 16 records.

Secondary Index in SAP

Some place in the Discussion, that’s what I read, SAP tosses a message when we attempt to make in excess of 16 Optional Files. Check we have 16 files in the framework.

3

I’m attempting to make the seventeenth Optional File and framework doesn’t caution me or toss any message.

2

We seem to be able to create an infinite number of auxiliary files. SAP recommends fewer records, but it doesn’t stop you if you don’t follow its rules. That’s what makes SAP so amazing.

What is the maximum amount of fields that an optional file can contain?
In response, a creator mentioned in a well-known SAP blog that he might create the file using the largest 16 fields.

I made an effort to replicate the hard stop where SAP prohibits using more than 16 fields. As you can see in the image below, SAP didn’t weep when I added more than 25 fields to a list.

Secondary Index in SAP

Additionally, check the length of these fields are in excess of 255 characters despite everything SAP didn’t stop. Seems to be, actually Auxiliary Record can have limitless fields. Could any master at any point affirm this?

Note: With respect to Drain Help Report, a record ought to just comprise of a couple of fields and, generally speaking, something like four fields.

There are such countless contemplations to be considered while making and utilizing Auxiliary Lists. Isn’t it minimal befuddling as well? Uplifting news. With the HANA advancement, we may in all likelihood never need Auxiliary Records in HANA Data set.

By and large, SAP HANA doesn’t need optional records for good inquiry execution. HANA data set store information in segment store naturally. Thus, every segment is a list in itself. SAP suggests utilizing Line store just in remarkable cases.

To diminish primary memory utilization, and to further develop embed execution all current non-special optional data set files on columnar tables are taken out during movement or don’t get made during establishment. Special files stay as they address an imperative on the table.

Exclusion of Secondary Index in HANA migration

This is substantial for all AS ABAP frameworks from SAP NetWeaver 7.4 onwards!

This is our customary framework for all the above screen captures.

Components of 740 Ehp

How about we rehash the inquiry once again. How might HANA Information base bear to dispose of Optional Lists?

Reply: HANA framework can examine the data set table at easing up speed as it is not quite the same as old style information bases. HANA data set tables are Segment based rather than Line situated in conventional data sets. This implies we don’t require files any longer. As currently referenced above, HANA data set section fields act as though we have physically made a list on each field of the table yet with practically no expense/cost/disadvantages of optional records as referenced above for conventional information base.

By removing files, we can reduce the amount of space that the data set takes up. For instance, auxiliary lists save 5% of the RAM that they would have used. It looks like the file pages at the back of the real books are removed, and the overall number of pages in a book is reduced. Additionally, you possess the extraordinary ability to read one million words every second and locate any word in a very little portion of the text. Therefore, you can locate the page number where that term appears in the book without referring to the lists at the back.

Does it mean, we can’t make Records in HANA Data set?
Reply: Indeed, we can make Files in HANA Data set. HANA permits the Make Record order.

SAP master John Appleby says: Never make File in HANA. At the point when we make a table in HANA, it is, truth be told, making a bunch of arranged, compacted and connected lists. Therefore, optional records never further develop execution.

He says: “There is one situation when an optional file can further develop execution: when you have an inquiry which chooses a tiny measure of information from an extremely enormous table (or gathering of joined tables). In this example, making an optional file on the entirety of your sort sections can permit HANA to find the information quicker. Yet, this is what is going on – the straightforward exhortation is, never make files”.

As such, in specific dark situations where we find a presentation issue, an optional list can help. This is just in OLTP situations, where you have complex joins and just return a little subset of information from the table. The vast majority of situations won’t ever profit from a record. They occupy room and will slow embed activities, so ought to be stayed away from in HANA Data set.

Since we discovered that we can in fact make Files in HANA. What are the kinds of Lists in HANA?
Reply: There are two kinds of Files in HANA.

1) Inverted Index and 

2) Composite Index.

Inverted Index: Rearranged records allude to just a single section. Here, the list information is put away in inside memory structures that have a place with the separate segment.

Composite Index: Composite files allude to more than one segment. In the first place, the items these segments are assembled in an inward section, and a rearranged file is then made for this inside section.

We will examine insights regarding Rearranged/Composite Files in a different post.

To get such helpful and reasonable articles directly to your inbox, kindly Buy in. We regard your security and view safeguarding it in a serious way.

Much thanks for your time!!

YOU MAY LIKE THIS

ABAP Test Cockpit(ATC) – Introduction and Steps

Create and Consume Business Add-in(BAdI) in ABAP

How to Convert JSON Data Structure to ABAP Structure without ABAP Code or SE11?

SAP

Taking one step back after EhP7.4, does it make sense for Web Dynpro UI?

Does your Internet Dynpro UI Screen appear to be unique after EhP7.4 Overhaul? Taking one step back after EhP7.4..

We recently upgraded to EhP740, which brought with it a fresh appearance and feel. The BOXes, NEW Administrators, Worth Administrators, brilliant Google-like thoughts when writing the text, and so on are just incredible. In fact, even the user interface displays have cutting-edge highlights and mitigating appearances (SAP is really getting ready for cell phones, mists). In any case, the new UI highlights did not pique the interest of our business clientele, who are accustomed to the outdated UI panels. According to someone, anything that feels familiar always seems simpler.

Now taking one step back after EhP7.4, They requested the standard, worn out look and all buttons. I wonder, did we truly redesign or would we say we are making a stride back after overhaul?

Anyway, what all are absent in the UI screen after redesign?

The most unmistakable non-attendant according to our clients are:
I) The section separator vertical line appears to have vanished.
ii) The custom button appeared to be unique and accentuation and variety was a No.
iii) The channel button is as of now not apparent.

Perhaps you’re wondering if SAP really removed the channel button. “No” is the response. A positive move has been taken by SAP. I acknowledge that its channel and sort usefulness at the segment level (as in Succeed) is really valuable. Who can convince our clients, anyway?

You can also read for: A to Z of OLE Excel in ABAP 7.4

A picture speaks louder and more effectively than a thousand words.

Look how one of our UI screen looked before Upgrade.

Before

Presently look at a similar screen after Redesign.

After

Have you noticed that the channel button and the upward line separators between parts are missing? Channels and sorts are at the section level, as I mentioned previously. Any section can be tapped to complete the channel and sort usefulness. Look at the personalized buttons as well.

Personally, I enjoy the fresh vibe. Is it fair to go back to a stage’s previous appearance? This could be a topic for discussion at a later time.

After little exploration one of our colleague sorted out that with Ehp7, we can add a boundaries in the Internet Dynpro application to get what our clients needed.

Let’s add the following parameter.
WDTHEMEROOT sap_standard STRING Stylesheet URI

1 PARA

Look how the screen looks now. The screen is near the before overhaul look. Still the upward separator and channels are absent.

After 1 Para

Add one more parameter.
WDUIGUIDELINE GL11 WDR_APP_PROP_UIGUIDELINE UI Guideline

2 para

Presently we are totally one stage back. All that we had before overhaul is availble here.. Blissful Business Clients..

After 2 Para

What does GL11 mean?
F4 on the boundary esteem field uncovers there are two adaptations of UI Rule. GL11 is 1.1 adaptation and as a matter of course in EhP7 the UI form is 2.0 (GL20).

Guide Line

Setting GL11 resembles going one stage back. Do you concur?

Assuming you enjoyed it, if it’s not too much trouble, share it! Much obliged

YOU MAY BE INTERESTED IN

SAP FICO Demand In India

ABAP Evolution: From Monolithic Masterpieces to Agile Architects

SAP ABAP future in next coming years

× How can I help you?