Skip to Content
0
Former Member
Aug 29, 2007 at 11:56 AM

improve performance

21 Views

how can i improve the below source code

SELECT ATINN ATNAM FROM CABN INTO CORRESPONDING FIELDS OF TABLE I_CABN.

LOOP AT I_CABN.

CASE I_CABN-ATNAM.

WHEN 'Z_BP_SOURCE'.

SOURCE = I_CABN-ATINN.

WHEN 'Z_BP_VERTICAL'.

VERTICAL = I_CABN-ATINN.

WHEN 'CLIENT_TYPE'.

CLIENT = I_CABN-ATINN.

WHEN 'Z_SIZE_OF_ORG'.

SIZE_OF_ORG = I_CABN-ATINN.

WHEN 'Z_LOB'.

ZLOB = I_CABN-ATINN.

WHEN 'Z_GEOGRAPHY'.

ZGEOGRAPHY = I_CABN-ATINN.

ENDCASE.

ENDLOOP.

  • sort itab by partner1.

*************to get mkkting attributes*****************

loop at itab into itab.

SOURCE**

SELECT SINGLE atwrt FROM AUSP INTO SOURCETYPE WHERE

PARTNER_GUID = Itab-Partner_GUID. "AND ATINN = SOURCE.

IF SOURCETYPE <> ''.

IF SY-SUBRC = 0.

SELECT SINGLE atzhl FROM CAWN INTO ITAB-ATZHL2

WHERE ATINN = SOURCE AND Atwrt = SOURCETYPE.

IF SY-SUBRC = 0.

SELECT SINGLE ATWTB FROM CAWNT INTO (ITAB-SOURCE)

WHERE ATZHL = ITAB-ATZHL2 AND ATINN = SOURCE.

ENDIF.

ENDIF.

ENDIF.

*VERTICAL

SELECT SINGLE atwrt FROM AUSP INTO verticalTYPE WHERE

PARTNER_GUID = Itab-Partner_GUID AND ATINN = VERTICAL.

IF verticaltype <> ''.

IF SY-SUBRC = 0.

SELECT SINGLE atzhl FROM CAWN INTO ITAB-ATZHL1

WHERE ATINN = VERTICAL AND Atwrt = verticalTYPE.

ENDIF.

IF SY-SUBRC = 0.

SELECT SINGLE ATWTB FROM CAWNT INTO (ITAB-vertical)

WHERE ATZHL = ITAB-ATZHL1 AND ATINN = VERTICAL.

ENDIF.

ENDIF.

  • client type

SELECT SINGLE atwrt FROM AUSP INTO clienttype WHERE

PARTNER_GUID = ITAB-PARTNER_GUID AND ATINN = CLIENT.

IF clienttype <> ''.

IF SY-SUBRC = 0.

SELECT SINGLE ATZHL FROM CAWN INTO (ITAB-ATZHL)

WHERE ATINN = CLIENT AND ATWRT = clienttype.

ENDIF.

IF SY-SUBRC = 0.

SELECT SINGLE ATWTB FROM CAWNT INTO ITAB-CLIENT

WHERE ATINN = CLIENT AND ATZHL = ITAB-ATZHL.

ENDIF.

endif.

  • SELECT SINGLE ATVALUEDESCR FROM CAWNT INTO ITAB-CLIENT

  • WHERE ATINN = '10858' AND ATZHL = clienttype.

  • ENDIF.

**SIZE_OF_ORG**

SELECT SINGLE atwrt FROM AUSP INTO ORGSIZE WHERE

PARTNER_GUID = Itab-Partner_GUID AND ATINN = SIZE_OF_ORG.

IF ORGSIZE <> ''.

IF SY-SUBRC = 0.

SELECT SINGLE atzhl FROM CAWN INTO ITAB-ATZHL3

WHERE ATINN = SIZE_OF_ORG AND Atwrt = ORGSIZE.

ENDIF.

IF SY-SUBRC = 0.

SELECT SINGLE ATWTB FROM CAWNT INTO (ITAB-ORGSIZE)

WHERE ATZHL = ITAB-ATZHL3 AND ATINN = SIZE_OF_ORG.

ENDIF.

ENDIF.

*LOB*

SELECT SINGLE atwrt FROM AUSP INTO LOB WHERE

PARTNER_GUID = Itab-Partner_GUID AND ATINN = ZLOB.

IF LOB <> ''.

IF SY-SUBRC = 0.

SELECT SINGLE atzhl FROM CAWN INTO ITAB-ATZHL4

WHERE ATINN = ZLOB AND Atwrt = LOB.

ENDIF.

IF SY-SUBRC = 0.

SELECT SINGLE ATWTB FROM CAWNT INTO (ITAB-LOB)

WHERE ATZHL = ITAB-ATZHL4 AND ATINN = ZLOB.

ENDIF.

ENDIF.

******GEOGRAPHY

SELECT SINGLE atwrt FROM AUSP INTO GEOGRAPHY WHERE

PARTNER_GUID = Itab-Partner_GUID AND ATINN = ZGEOGRAPHY.

IF GEOGRAPHY <> ''.

IF SY-SUBRC = 0.

SELECT SINGLE atzhl FROM CAWN INTO ITAB-ATZHL5

WHERE ATINN = ZGEOGRAPHY AND Atwrt = GEOGRAPHY.

ENDIF.

IF SY-SUBRC = 0.

SELECT SINGLE ATWTB FROM CAWNT INTO (ITAB-GEOGRAPHY)

WHERE ATZHL = ITAB-ATZHL5 AND ATINN = ZGEOGRAPHY.

ENDIF.

ENDIF.

modify itab.

endloop.

*************************end mkktg attr**************

LOOP AT ITAB.

IF ITAB-CLASSIFIC <> ''.

ITAB-ROLE = 'Sold-To-Party'.

ELSE.

ITAB-ROLE = 'Business Partner'.

ENDIF.

MODIFY ITAB.

ENDLOOP.

*

Message was edited by:

EKTA JAIN