Thursday, December 28, 2017
Touching Feet - Update
Table Comprehension Example Like Nested Loop
DO 10 TIMES.
APPEND sy-index TO lt.
ENDDO.
"loop at itab into wa. fill wa2 using wa and append lt2, all this using
DATA lt2 TYPE TABLE OF i.
lt2 = VALUE #( FOR lv IN lt ( lv * lv ) ).
"nested loop of lt and lt2 to create lines of lt3
DATA lt3 TYPE TABLE OF i.
lt3 = VALUE #( FOR lv IN lt FOR lv2 IN lt2 ( lv + lv2 ) ).
cl_demo_output=>display( lt3 ).
Table Comprehension Example
DATA lt TYPE TABLE OF i.
DO 10 TIMES.
APPEND sy-index TO lt.
ENDDO.
"loop at itab into wa. fill wa2 using wa and append lt2, all this using table expression
DATA lt2 TYPE TABLE OF i.
lt2 = VALUE #( FOR lv IN lt ( lv * lv ) ).
cl_demo_output=>display( lt2 ).
Explore More Loop Group
https://blogs.sap.com/2016/06/23/group-by-for-internal-tables-step-by-stepc/
https://blogs.sap.com/2014/10/02/abap-news-for-740-sp08-grouping-internal-tables/
Rewriting DEMO_LOOP_AT_GROUP_SYNTAX For Practice
Idea was to:
- Define an itab of different structure, content and see how behavior changes when itab rows sort order is changed and when grouping is done with/without ASCENDING.
- Learn instantiation, sections and method chaining of class cl_demo_output
- Get familiar with the syntax variations.
- Truly understand the difference between representative binding and group key binding of group loop with member loop. I could see that group key had different runtime structure than itab row.
NOTE: The group loop output was one of these: ls, <ls>, ls->*. Respective name used in member LOOP AT GROUP was: ls, <ls>, ls. This is not what I expected when INTO REFERENCE was used. I first wrote LOOP AT GROUP ls->* and this gave syntax error.
Friday, December 22, 2017
Touching Feet
Grouping Internal Tables Rows In Loop
Demo program DEMO_LOOP_AT_GROUP_SYNTAX and respective documentation show 6 syntaxes in which grouping is done.
https://help.sap.com/doc/abapdocu_740_index_htm/7.40/en-US/abenloop_at_group_abexa.htm
First three group loops have representative binding and next three group loops have group key binding which is more explicit in nature.
While looping, result can be put into data, field-symbol or data reference. All are covered in example.
Tuesday, December 19, 2017
Incorrect Hyperlink in SAP Keyword Documentation
While sifting through keyword documentation, I came across this mistake.
https://help.sap.com/doc/abapdocu_740_index_htm/7.40/en-US/abennews-740_sp08.htm
Two hyperlinks are present with text "Internal Tables in Release 7.40, SP08". First one directs are "AMDP in Release 7.40, SP08" whereas second one directs to correct link.
Table Expression Default Value
Monday, December 18, 2017
Short Form for Structured Row Types
Friday, December 15, 2017
VALUE Internal Table "LINES OF" Line_spec
Thursday, December 14, 2017
Using BASE In VALUE, NEW & CORRESPONDING
Wednesday, December 13, 2017
REDUCE Operator Example
Tuesday, December 12, 2017
Incorrect Sample Code In BOOLX Documentation
Boolean Data Type in XML JSON ABAP
XSDBOOL BOOLC SPACE & INITIAL
Monday, December 11, 2017
Removed Malware From Intex Aqua
Chained Methods and Method Chaining
Friday, December 8, 2017
Sales Order Item Billing Plan Change
A while ago I wrote a code that used BAPI_CUSTOMERCONTRACT_CHANGE to fill acceptance date in contract data tab of sales order item.
The challenge was that once BAPI_SALESORDER_CHANGE is found to not support contract data changes, one would be tempted to use any suggestion given by web search. For e.g calling update FM which is almost like updating the db table itself.
Question is how one to come to use BAPI_CUSTOMERCONTRACT_CHANGE by old fashion investigation instead of web search. Since VEDA table has acceptance date with data element VADAT_VEDA, a where used search for BAPI* structure gave a hit. Next where used showed FMs, more importantly the ones starting with BAPI* that may do what I needed. Since system was configured to create billing plan with start date same as contract acceptance date, I was indirectly able to create billing plan of sales order item.
Today I had to fill end date of existing billing plans. No rule was configured that would transfer the date from contract data tab to billing plan tab. Since BAPI_CUSTOMERCONTRACT_CHANGE was ruled out and where-used searched did not return a BAPI* FM, web search led me to copy code of standard report SDFPLA02. I feel this approach is better than using FM BILLING_SCHEDULE_SAVE.
Reference: https://archive.sap.com/discussions/thread/188338
Thursday, November 30, 2017
The Loop Is Pulling Me Back
Thursday, November 23, 2017
Grouping Internal Tables
FOR Table Iteration
Friday, November 17, 2017
Predicates In ABAP
Thursday, November 16, 2017
Simple Transformation to Serialize ABAP Deep Internal Table
Wednesday, November 15, 2017
Optional Interface Methods
ABAP release 740 SP08 onwards.
Interface method definition has an addition DEFAULT FAIL/IGNORE that allows you to skip explicit method implementation in a class that implements the interface.
When this addition is not used, syntax check forces you to implement the method.
When addition is used, syntax check would pass.
At runtime, DEFAULT FAIL will raise exception during method call.
At runtime, DEFAULT IGNORE will call implicit blank method implementation.
More info here:
https://help.sap.com/doc/abapdocu_740_index_htm/7.40/en-US/abapmethods_default.htm
Stuck in a loop
Blog Archive
-
▼
2017
(26)
-
▼
Dec
(19)
- Touching Feet - Update
- Table Comprehension Example Like Nested Loop
- Table Comprehension Example
- Explore More Loop Group
- Rewriting DEMO_LOOP_AT_GROUP_SYNTAX For Practice
- Touching Feet
- Grouping Internal Tables Rows In Loop
- Incorrect Hyperlink in SAP Keyword Documentation
- Table Expression Default Value
- Short Form for Structured Row Types
- VALUE Internal Table "LINES OF" Line_spec
- Using BASE In VALUE, NEW & CORRESPONDING
- REDUCE Operator Example
- Incorrect Sample Code In BOOLX Documentation
- Boolean Data Type in XML JSON ABAP
- XSDBOOL BOOLC SPACE & INITIAL
- Removed Malware From Intex Aqua
- Chained Methods and Method Chaining
- Sales Order Item Billing Plan Change
-
▼
Dec
(19)