SAP & Oracle partner and support companies

Loading

01
Quality Service
Sed perspe unde omnis natus sit voluptatem acc doloremue.
02
Expert Team
Sed perspe unde omnis natus sit voluptatem acc doloremue.
03
Excellent Support
Sed perspe unde omnis natus sit voluptatem acc doloremue.
04
Management
Sed perspe unde omnis natus sit voluptatem acc doloremue.
Advance ProtectAdvance ProtectAdvance Protect

Protecting your privacy Is
Our Priority

Amet consectur adipiscing elit sed eiusmod ex tempor incididunt labore dolore magna aliquaenim ad minim veniam.

What We’re OfferingWhat We’re OfferingWhat We’re Offering

Dealing in all Professional IT
Services

There are many variations of passages of available but majority have suffered alteration in some form, by humou or randomised words which don't look even slightly believable.

What’s HappeningWhat’s HappeningWhat’s Happening

Latest News & Articles from the
Posts

Amet consectur adipiscing elit sed eiusmod ex tempor incididunt labore dolore magna aliquaenim ad minim veniam.

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?

× How can I help you?