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

Covert into CASE ENDCASE

Hi,

How to convert into CASE & ENDCASE logic the below code:

LOOP AT lt_element INTO ls_element.

READ TABLE lt_element_ident INTO ls_element_ident

WITH KEY element_id = ls_element-element_id BINARY SEARCH.

IF sy-subrc EQ 0.

MOVE ls_element_ident-value TO lv_guid.

SELECT * FROM zcm_valuation_at

APPENDING CORRESPONDING FIELDS OF TABLE lt_caseattributes

WHERE case_guid = lv_guid.

ENDIF.

ENDLOOP.

***

LOOP AT lt_caseattributes INTO ls_caseattributes.

IF ls_caseattributes-ext_key IS INITIAL.

SELECT SINGLE ext_key

INTO CORRESPONDING FIELDS OF ls_caseattributes

FROM scmg_t_case_attr

WHERE case_guid = ls_caseattributes-case_guid.

ENDIF.

*To get the Status description of the Case

SELECT SINGLE stat_ordno_descr

INTO ls_caseattributes-status

FROM scmgstatprofst AS a

INNER JOIN scmg_t_case_attr AS b

ON aprofile_id = bprofile_id

AND astat_orderno = bstat_orderno

WHERE case_guid = ls_caseattributes-case_guid.

MODIFY lt_caseattributes FROM ls_caseattributes INDEX sy-tabix TRANSPORTING status ext_key.

ENDLOOP.

READ TABLE lt_caseattributes INTO ls_caseattributes INDEX 1.

Regards,

Maruti

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jun 16, 2008 at 07:54 AM
    CASE sy-subrc.
      WHEN  0.

    matt

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 06:27 AM

    Hi,

    I do not see the real advantage of case in the above code. What I notice is a DB select within a loop which can easily be avoided using FOR ALL ENTRIES IN clause.

    I am not sure what you want to achieve, but the code seems to be DB extensive.

    Regards,

    Saurabh

    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.