Skip to Content
author's profile photo Former Member
Former Member

ABAP-ISU-CS

Hi experts

We are Using this Z program In ISU-CS to calculate Total complaints and the pending complaints in each Deptt i.e. Marketing ,O& M and Finance.

Few changes has been made in ISU i.e few of activities which were done in one deptt are transferred to another Deptt i.e Marketing to Finance and few activities are not at all required so deleted from each deptt.

ISU (Functional ) have configured according to new requirement i.e from marketing (cclass-001) activity 3(queries for registration.) ,5(CNG kit pricing) , 6(Promotions) are permanently deleted. And

From Finance cclass(004) activity 5 (Final account) Permamnently removed

And activity 1, 3, 8(VDS), 9(ECS) moved to Marketing cclass(001).

Functinally its done.

Now what ever the Total No. of complaints ,Closed , and Pending were previously with each Deptt ( Marketing and Finance) they are not effective in by new program. Present onwards its doing good but how to Retrieve previous data where in program should I make changes.

Till now I got

Table BCONT : PARTNER CCLASS ACTIVITY

Number of complaints stored in this table is calculated based on Total No of partner..for each partner mentioned in table there is one complaintÂ…so Tot-Complaint I calculated = Total Partner against each deptt (cclass)

THE ZPROGRAM IS :

"

REPORT ZCS_COMP LINE-COUNT 65

LINE-SIZE 300

NO STANDARD PAGE HEADING.

************************************************************************

INCLUDE <SYMBOL>.

************************************************************************

  • Types declaration *

************************************************************************

TYPES: BEGIN OF TY_ITEMS,

ID(10),

PARENT_ID(10),

TEXT(50),

SYMBOL,

TOTAL_NO(10),

CLOSED_NO(10),

PENDING_NO(10),

END OF TY_ITEMS.

TYPES: BEGIN OF TY_ITEMS2,

CCLASS LIKE BCONTCT-CCLASS,

ACTIVITY LIKE BCONTAT-ACTIVITY,

CCLASSTXT LIKE BCONTCT-CCLASSTXT,

ACTTXT LIKE BCONTAT-ACTTXT,

END OF TY_ITEMS2.

TYPES: BEGIN OF TY_ITEMS1,

CCLASS LIKE BCONTCT-CCLASS,

ACTIVITY LIKE BCONTA-ACTIVITY,

CCLASSTXT LIKE BCONTCT-CCLASSTXT,

ACTTXT LIKE BCONTAT-ACTTXT,

END OF TY_ITEMS1.

TYPES: BEGIN OF TY_DATA,

TEXT(25),

VALUE1 TYPE P,

VALUE2 TYPE P,

VALUE3 TYPE P,

END OF TY_DATA.

************************************************************************

  • Internal table declaration *

************************************************************************

*DATA: IT_TABIX_STACK LIKE SY-TABIX OCCURS 10 WITH HEADER LINE,

  • ITEMS_SHOW TYPE STANDARD TABLE OF TY_ITEMS WITH HEADER LINE.

DATA: IT_BCONT TYPE STANDARD TABLE OF BCONT WITH HEADER LINE,

IT_ITEMS1 TYPE STANDARD TABLE OF TY_ITEMS1 WITH HEADER LINE,

IT_ITEMS2 TYPE STANDARD TABLE OF TY_ITEMS2 WITH HEADER LINE,

IT_ITEMS TYPE STANDARD TABLE OF TY_ITEMS WITH HEADER LINE,

IT_TABIX_STACK LIKE SY-TABIX OCCURS 10 WITH HEADER LINE,

ITEMS_SHOW TYPE STANDARD TABLE OF TY_ITEMS WITH HEADER LINE,

IT_DATA TYPE STANDARD TABLE OF TY_DATA WITH HEADER LINE.

************************************************************************

  • Global data declaration *

************************************************************************

DATA: G_LINES TYPE I,

G_COUNTER TYPE I.

************************************************************************

  • Selection screen *

************************************************************************

SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-T03.

SELECTION-SCREEN : SKIP.

SELECTION-SCREEN : BEGIN OF LINE.

SELECTION-SCREEN : COMMENT 2(15) TEXT-001.

SELECT-OPTIONS : P_DATE FOR SY-DATUM." OBLIGATORY ."ZPSN0001-DPR_DATE.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : END OF BLOCK B2.

************************************************************************

  • PF Status *

************************************************************************

SET PF-STATUS 'GRAF'.

************************************************************************

  • START-OF-SELECTION *

************************************************************************

START-OF-SELECTION.

SELECT * FROM BCONT INTO TABLE IT_BCONT WHERE

CCLASS IN ('0001' ,'0002' , '0003' , '0004' ) AND CTDATE IN P_DATE.

SELECT CCLASS CCLASSTXT FROM BCONTCT INTO CORRESPONDING FIELDS OF TABLE

IT_ITEMS1 WHERE SPRAS = 'EN' AND CCLASS IN ('0001' ,'0002' , '0003' ,

'0004' ).

IT_ITEMS2[] = IT_ITEMS1[].

REFRESH IT_ITEMS1.

CLEAR IT_ITEMS1.

SELECT CCLASS ACTIVITY ACTTXT FROM BCONTAT INTO CORRESPONDING FIELDS OF

TABLE IT_ITEMS1 WHERE SPRAS = 'EN' AND CCLASS IN ('0001' ,'0002' ,

'0003' , '0004' ).

DESCRIBE TABLE IT_ITEMS1 LINES G_LINES.

IF NOT G_LINES IS INITIAL.

APPEND LINES OF IT_ITEMS1 FROM 1 TO G_LINES TO IT_ITEMS2.

ENDIF.

&----


*& All parent and Child component should be in one internal table

*& with their respective Parent ID

&----


LOOP AT IT_ITEMS2.

IF IT_ITEMS2-ACTIVITY IS INITIAL.

MOVE IT_ITEMS2-CCLASS TO IT_ITEMS-ID.

MOVE IT_ITEMS2-CCLASSTXT TO IT_ITEMS-TEXT.

LOOP AT IT_BCONT WHERE CCLASS = IT_ITEMS2-CCLASS.

G_COUNTER = G_COUNTER + 1.

IF IT_BCONT-ADDINFO = 50.

IT_ITEMS-CLOSED_NO = IT_ITEMS-CLOSED_NO + 1.

ELSE.

IT_ITEMS-PENDING_NO = IT_ITEMS-PENDING_NO + 1.

ENDIF.

ENDLOOP.

MOVE G_COUNTER TO IT_ITEMS-TOTAL_NO.

CLEAR G_COUNTER.

APPEND IT_ITEMS.

CLEAR IT_ITEMS.

ELSEIF NOT IT_ITEMS2-ACTIVITY IS INITIAL.

MOVE IT_ITEMS2-CCLASS TO IT_ITEMS-PARENT_ID.

MOVE SY-TABIX TO IT_ITEMS-ID.

MOVE IT_ITEMS2-ACTTXT TO IT_ITEMS-TEXT.

LOOP AT IT_BCONT WHERE CCLASS = IT_ITEMS2-CCLASS AND ACTIVITY =

IT_ITEMS2-ACTIVITY.

G_COUNTER = G_COUNTER + 1.

IF IT_BCONT-ADDINFO = 50.

IT_ITEMS-CLOSED_NO = IT_ITEMS-CLOSED_NO + 1.

ELSE.

IT_ITEMS-PENDING_NO = IT_ITEMS-PENDING_NO + 1.

ENDIF.

ENDLOOP.

MOVE G_COUNTER TO IT_ITEMS-TOTAL_NO.

CLEAR G_COUNTER.

APPEND IT_ITEMS.

CLEAR IT_ITEMS.

ENDIF.

ENDLOOP.

&----


*& Used to put symbol for Parent and Child

&----


LOOP AT IT_ITEMS WHERE PARENT_ID = ''.

MOVE-CORRESPONDING IT_ITEMS TO ITEMS_SHOW.

ITEMS_SHOW-SYMBOL = '+'.

APPEND ITEMS_SHOW.

ENDLOOP.

PERFORM PRINT_TREE TABLES ITEMS_SHOW.

&----


*& Data for graphical representation

&----


LOOP AT IT_ITEMS WHERE PARENT_ID = '' .

MOVE IT_ITEMS-TEXT TO IT_DATA-TEXT.

MOVE IT_ITEMS-TOTAL_NO TO IT_DATA-VALUE1.

MOVE IT_ITEMS-CLOSED_NO TO IT_DATA-VALUE2.

MOVE IT_ITEMS-PENDING_NO TO IT_DATA-VALUE3.

APPEND IT_DATA.

ENDLOOP.

  • at line-selection - when the node is opened/closed or item double-clk

&----


*& AT LINE-SELECTION event

&----


AT LINE-SELECTION.

READ TABLE IT_ITEMS WITH KEY PARENT_ID = ITEMS_SHOW-ID. "see 'hide'

IF SY-SUBRC = 0. "item has children - expand or collapse

SY-LSIND = 0.

PERFORM EXPAND_COLLAPSE USING ITEMS_SHOW-ID.

PERFORM PRINT_TREE TABLES ITEMS_SHOW.

  • ELSE. "item has NO children - perform some action

  • READ TABLE IT_ITEMS WITH KEY ID = ITEMS_SHOW-ID.

  • WRITE: 'Action performed on item "' NO-GAP, IT_ITEMS-TEXT NO-GAP,

  • '", id.', IT_ITEMS-ID.

ENDIF.

&----


*& Form PRINT_TREE

&----


  • Form with write statements

----


  • --> tables IT_ITEMS

----


FORM PRINT_TREE TABLES ITEMS STRUCTURE IT_ITEMS.

DATA: L_TABIX LIKE SY-TABIX,

START_TABIX LIKE SY-TABIX,

L_LEVEL LIKE SY-TFILL,

L_OFFSET TYPE I,

L_ID LIKE ITEMS-ID,

L_PARENT_ID LIKE ITEMS-PARENT_ID,

L_PARENT_ID_FOR_VLINE LIKE ITEMS-PARENT_ID,

L_PREV_LEVEL TYPE I,

L_ITEMS_COUNT LIKE SY-TFILL,

L_VLINES_STRING(200).

FORMAT COLOR 2 ON .

WRITE: /3 'Departmentwise Complaints',

60 'No. of Complaints' ,

81 'Closed' ,

93 'Pending'.

FORMAT COLOR OFF.

NEW-LINE.

SKIP 1.

CHECK NOT ITEMS[] IS INITIAL.

SORT ITEMS BY PARENT_ID ID.

READ TABLE ITEMS INDEX 1.

L_PARENT_ID = ITEMS-PARENT_ID.

START_TABIX = 1.

REFRESH IT_TABIX_STACK.

DO.

LOOP AT ITEMS FROM START_TABIX.

L_TABIX = START_TABIX = SY-TABIX."remember current index

L_ID = ITEMS-ID.

L_PARENT_ID_FOR_VLINE = ITEMS-PARENT_ID.

  • decrease level and exit loop if parent not the same as previous

IF ITEMS-PARENT_ID NE L_PARENT_ID.

PERFORM READ_FROM_STACK CHANGING START_TABIX. "level = NoOfRecs

READ TABLE ITEMS INDEX START_TABIX.

L_PARENT_ID = ITEMS-PARENT_ID.

ADD 1 TO START_TABIX. "next loop starts from parent index + 1

  • clear vline

IF L_LEVEL > 1.

L_OFFSET = 2 + ( L_LEVEL - 2 ) * 3.

IF L_LEVEL = 1. L_OFFSET = 1. ENDIF.

L_VLINES_STRING+L_OFFSET = ' '.

ENDIF.

EXIT.

ENDIF.

L_PARENT_ID = ITEMS-PARENT_ID.

  • write item

FORMAT COLOR OFF.

DESCRIBE TABLE IT_TABIX_STACK LINES L_LEVEL.

WRITE: / L_VLINES_STRING.

L_OFFSET = L_LEVEL * 3.

IF L_LEVEL NE 0.

IF L_PREV_LEVEL < L_LEVEL.

WRITE: AT L_OFFSET '|', / ''.

WRITE: / L_VLINES_STRING.

ENDIF.

L_OFFSET = L_LEVEL * 3.

WRITE AT L_OFFSET '|--'.

ENDIF.

L_OFFSET = L_OFFSET + 3.

CASE ITEMS-SYMBOL.

WHEN '+'.

WRITE AT L_OFFSET SYM_PLUS_FOLDER AS SYMBOL

COLOR 4 INTENSIFIED HOTSPOT.

WHEN '-'.

WRITE AT L_OFFSET SYM_MINUS_FOLDER AS SYMBOL

COLOR 4 INTENSIFIED HOTSPOT.

WHEN OTHERS. FORMAT COLOR 5.

ENDCASE.

WRITE: ITEMS-TEXT ,

ITEMS-TOTAL_NO UNDER 'No. of Complaints',

ITEMS-CLOSED_NO UNDER 'Closed' ,

ITEMS-PENDING_NO UNDER 'Pending'.

L_PREV_LEVEL = L_LEVEL.

HIDE: ITEMS-ID.

ADD 1 TO L_ITEMS_COUNT.

READ TABLE ITEMS WITH KEY PARENT_ID = ITEMS-ID.

  • increase level and exit loop if item has children

IF SY-SUBRC = 0.

START_TABIX = SY-TABIX.

APPEND L_TABIX TO IT_TABIX_STACK. "level is no of recs in stack

L_PARENT_ID = ITEMS-PARENT_ID.

  • set vline

L_TABIX = L_TABIX + 1.

READ TABLE ITEMS INDEX L_TABIX.

L_OFFSET = 2 + ( L_LEVEL - 1 ) * 3.

IF L_LEVEL > 0.

IF ITEMS-PARENT_ID = L_PARENT_ID_FOR_VLINE AND SY-SUBRC = 0.

L_VLINES_STRING+L_OFFSET = '|'.

ELSE.

L_VLINES_STRING+L_OFFSET = ' '.

ENDIF.

ENDIF.

EXIT.

ENDIF.

  • at last - decrease level

AT LAST.

  • clear vline

IF L_LEVEL > 1.

L_OFFSET = 2 + ( L_LEVEL - 2 ) * 3.

IF L_LEVEL = 1. L_OFFSET = 1. ENDIF.

L_VLINES_STRING+L_OFFSET = ' '.

ENDIF.

" next loop starts from parent index, not parent index + 1

" because of different parents level will decrease anyway

PERFORM READ_FROM_STACK CHANGING START_TABIX.

APPEND START_TABIX TO IT_TABIX_STACK.

"must return index to stack

ENDAT.

ENDLOOP.

DESCRIBE TABLE ITEMS.

IF START_TABIX > SY-TFILL OR L_ITEMS_COUNT >= SY-TFILL.

EXIT.

ENDIF.

ENDDO.

ENDFORM.

  • form expand_collapse

&----


*& Form EXPAND_COLLAPSE

&----


  • Expand or Collapse the tree

----


  • --> p1 Parent ID

----


FORM EXPAND_COLLAPSE USING VALUE(V_ID).

DATA: V_NO_MORE_ORPHANS,

ITEMS_TEMP LIKE IT_ITEMS OCCURS 100 WITH HEADER LINE.

DELETE ITEMS_SHOW WHERE PARENT_ID = V_ID. "try to collapse

IF SY-SUBRC = 0. "succesfull first collapse

DO. "cascade collapse - delete 'orphans' that are left

REFRESH ITEMS_TEMP.

MOVE ITEMS_SHOW[] TO ITEMS_TEMP[].

SORT ITEMS_TEMP BY ID.

V_NO_MORE_ORPHANS = 'X'.

LOOP AT ITEMS_SHOW WHERE PARENT_ID NE ''.

READ TABLE ITEMS_TEMP WITH KEY ID = ITEMS_SHOW-PARENT_ID

BINARY SEARCH TRANSPORTING NO FIELDS.

IF SY-SUBRC NE 0. "no parent - it's an orphan

CLEAR V_NO_MORE_ORPHANS.

DELETE ITEMS_SHOW.

ENDIF.

ENDLOOP.

IF V_NO_MORE_ORPHANS = 'X'. EXIT. ENDIF.

ENDDO.

ITEMS_SHOW-SYMBOL = '+'.

MODIFY ITEMS_SHOW TRANSPORTING SYMBOL WHERE ID = V_ID.

ELSE. "unsuccessfull collapse - expand

ITEMS_SHOW-SYMBOL = '-'.

MODIFY ITEMS_SHOW TRANSPORTING SYMBOL WHERE ID = V_ID.

LOOP AT IT_ITEMS WHERE PARENT_ID = V_ID. "show children

APPEND IT_ITEMS TO ITEMS_SHOW.

ENDLOOP.

ENDIF.

ENDFORM.

  • form append_item

&----


*& Form APPEND_ITEM

&----


  • Form to get childs for a Parent

----


  • --> p1 Child ID

  • --> p2 Parent ID

  • --> p3 Description

----


FORM APPEND_ITEM USING VALUE(ID) VALUE(PARENT_ID) VALUE(TEXT).

IT_ITEMS-ID = ID.

IT_ITEMS-PARENT_ID = PARENT_ID.

IT_ITEMS-TEXT = TEXT.

APPEND IT_ITEMS.

ENDFORM.

  • form read_from_stack

&----


*& Form READ_FROM_STACK

&----


  • decrease level and exit loop if parent not the same as previous *

----


  • <--P_START_TABIX Current Line ID

----


FORM READ_FROM_STACK CHANGING TABIX LIKE SY-TABIX.

DESCRIBE TABLE IT_TABIX_STACK.

CHECK SY-TFILL NE 0.

READ TABLE IT_TABIX_STACK INDEX SY-TFILL.

TABIX = IT_TABIX_STACK.

DELETE IT_TABIX_STACK INDEX SY-TFILL.

ENDFORM.

*----


  • Function module to print report in graphical representation

*----


*

AT PF08.

CALL FUNCTION 'GRAPH_3D' EXPORTING TITL = TEXT-X05

DIM1 = TEXT-X07

DIM2 = TEXT-X06

MAIL_ALLOW = 'X'

TABLES DATA = IT_DATA.

"

GIVE ME ANY IDEAS

THANKS

ANU

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2008 at 06:07 AM

    I am still waiting for your valuable suggestions

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.