Tuesday, October 17, 2023

Workflow: Developments at a glance!

1. Create a new workflow step by step: LINK

2. Assign Agent: LINK

3. Create Workflow Class: LINK

4. Create Workflow BOR: LINK

5. Workflow Decision (Binary):

6. Workflow Fork:

Courtesy/ Reference/ Support: blogs.sap.com

ABAP 7.5 Coding Standards in General

 ABAP 7.4/7.5: SELECT Queries and LOOP

-------------------------------------------------------------------------------------

CASE 1:

SELECT SINGLE VORNA as First_Name,

                               NACHN as Last_Name

FROM PA0002      

INTO TABLE @DATA(LS_EE_NAME).

This will create a structure with columns with field description as FIRST_NAME and LAST_NAME

-------------------------------------------------------------------------------------

CASE 2:

SELECT VORNA as First_Name,

                NACHN as Last_Name

FROM PA0002      

INTO TABLE @DATA(LT_EE_NAME).

This will create an internal table with single column with field description as FIRST_NAME and LAST_NAME

-------------------------------------------------------------------------------------

CASE 3: WHERE

PARAMETERS: P_PERNR TYPE PERSNO.

SELECT SINGLE PERNR as Employee,

                               VORNA as First_Name,

                               NACHN as Last_Name

FROM PA0002      

INTO TABLE @DATA(LS_EE_NAME)

WHERE Employee EQ @P_PERNR.

// One can use Internal table as well without using SINGLE

-------------------------------------------------------------------------------------

CASE 4: JOIN // WHERE  // FOR ALL ENTRIES IN

PARAMETERS: P_PERNR TYPE PERSNO.

CONSTANTS: LC_SUBTY TYPE SUBTY VALUE '0001'.

IF LT_EE_MAIN[] IS NOT INITIAL.

    SELECT A~VORNA, A~NACHAN

                   B~SUBTY, B~REGIO, B~STATE, B~PSTLZ

    FROM PA0002 AS A

    INNER JOIN PA0006 

    ON PA0006-PERNR EQ PA0002-PERNR

    INTO TABLE @DATA(LT_EE_NAME)

    FOR ALL ENTRIES IN @LT_EE_MAIN[]

    WHERE A~PERNR EQ @LT_EE_MAIN[]-PERNR

          AND A~PERNR EQ @P_PERNR         

         AND B~SUBTY EQ @LC_SUBTY.

-------------------------------------------------------------------------------------

CASE 5: General Declarations

DATA: lv_rows  TYPE i. lv_rows  = 0.

lv_rows = NEW i(  0  ).


DATA(lv_vehicle) = 'Mercedes'.

DATA(lv_rows) = LINES( itab ).

lo_human = NEW class_human( name = ‘TONY’ ).


INSERT Values in an Internal Table:

DATA(LT_TAB) = VALUE((10)( 20 )(30).


-------------------------------------------------------------------------------------

CASE 6: LOOP & APPEND

TYPES: BEGIN OF LTY_CITY_1,

                  CITY TYPE CHAR10,

                  STATE TYPE CHAR10,

                  PST_CD TYPE CHAR10,

               END OF LTY_CITY_1,

               BEGIN OF LTY_CITY_2,

                  CITY TYPE CHAR10,

              END OF LTY_CITY_2.

DATA: LIT_CITIES TYPE TABLE OF LTY_CITY_1,

             GT_CITY TYPE  TABLE OF LTY_CITY_2

DATA(GT_CITY) = VALUE LTY_CITY_1( FOR LS_CITY IN LIT_CITIES 

                                  ( LS_CITY-CITY )

                                   WHERE ( LS_CITY-CITY )(STATE = 'NY') ).

Store value from one table to another by filtering conditions in loop (avoiding append a different table in loop)

-------------------------------------------------------------------------------------

CASE 7: FILTER

EXAMPLE 1:

DATA(extract) =  FILTER #( spfli_tab USING KEY carr_city

                                   WHERE carrid  = CONV #( to_upper( carrid ) ) AND

                                                  cityfrom = CONV #( to_upper( cityfrom ) ) 

                                              ).

EXAMPLE 2:

TYPES: BEGIN OF filter,

         cityfrom TYPE spfli-cityfrom,

         cityto   TYPE spfli-cityto,

       END OF filter,

       filter_tab TYPE HASHED TABLE OF filter

                  WITH UNIQUE KEY cityfrom cityto.

DATA(filter_tab) = …        

DATA(extract) = FILTER #( spfli_tab IN filter_tab WHERE cityfrom = cityfrom  AND cityto = cityto ).

EXAMPLE 3:

TYPES: BEGIN OF line,

    id    TYPE i,

    value TYPE string,

  END OF line,

  itab TYPE SORTED TABLE OF line WITH UNIQUE KEY id.

DATA(def) = VALUE line( id = 0 value = `not found` ).

DATA(result) = VALUE #( itab[ id = … ] DEFAULT def ).


Workflow: Transactions at a glance!

 Workflow Troubleshooting

SWU_OBUF --> Manual buffer refresh

SWPC --> continue WF after a system crash

SWI6 --> show all WF instances, work item IDs by BOR/CL name & Object Key (optional)

SWI5 --> work item per work center, job, organizational unit, position, user

SWIA --> work item administration (WI)

SWI2_DIAG --> error diagnosis

SWWL --> delete work item

SWI2_DEAD --> deadline monitor

SWWL_TOPLEVEL --> delete a parent workflow with all of its child work items

SWI2_DURA --> process duration

SWUD --> WF diagnosis

SWI2_ADM1 --> find orphaned work item

SWELS --> event trace

SM12 --> lock, unlock the object

SWEL --> display event trace SARA archiving

Workflow Development (For Daily Usage)

SWDD --> WF builder (Create and view new or existing Workflow)

SBWP --> WF inbox

SWI1 --> selection report for work item

SWNADMIN --> Workflow notification management

SWO1 --> business object builder (BOR)

PFTC --> template, task management (WS, TS)

SM37 --> view scheduled and processed jobs

Others

PFTC_DIS --> assigning possible agent

PFAC --> rule creation, editing, testing

SWU0 --> simulate the event linkage

SWEQADM --> event queue, preventing RFC-problem

SWUS --> test, execute WF

SWB_COND --> all start conditions

SWEINST --> all terminating events linkage

SWU9 --> WF trace for the session

SWUI_VERIFY --> WF verification

Related to basis and Workflow config

SOST --> SAP connect transmission request

SWPA --> customizing WF runtime system

SWNCONFIG --> notification configuration

SWEQBROWSER --> event waiting in the event queue

PPOME organizational management, structure & staff assignment, user mapping

SM52 --> view tRFC

SWI2_FREQ --> opened task statistic


ABAP Supports - Transactions/ Table handling

 Debug a table entry (single entry, one at a time)

Go to SE11 --> provide table name  --> go to content --> get the entry in detail view --> in the address bar type /HA and hit ENTER button twice --> it will take you to debug screen of a SWITCH CASE, provide the value as INST (Inserting a new entry), DELE (for delete the entry), MODY (to modify the existing one). Next it will take you to screen with respective button in edit mode and you are good to modify as per need. SAVE it and come back, else debugger screen will continue.

 Debug multiple table entry (delete a set of entries in table)

Go to SE38 --> Provide the Include program LSE16NF10  --> Go to function Module SE16_INTERFACE at line 619 --> Set debugger.

Then go to SE16N --> open the table content with table name provided --> get the detail view by executing --> this will take to debugger session that will be appearing next, when the debugger stops at Function Module SE16_INTERFACE at line 619 --> Edit the entry of the field/parameter GD_SAPEDIT and GD-EDIT  and set X as value for both  --> then next screen will appear with delete button --> next you choose, the entries (multiple) and keep delete and SAVE.

SM12 -> to unlock the table if it is locked by others

SM59 -> to check if any session debugger is stuck or awaiting 

SE36 -> Logical Database (LDB) 

SE21 - > Package

SE09/SE10 -> Transports

SE01/ SE01D --> SAP user profile

SE24 --> Class

SE11 --> DDIC

SE37 --> function modules

ST22 --> Dumps/ Runtime Errors

STMS --> change requests transferring