2009 Oct 09 3:39 AM
dear all,
In the midst of converting some 3.5 update rules to version 7.0 and i'm at a deadlock - lack of the dark art of ABAP... Can someone here please provide me some help for the below codes? Thanks.
READ TABLE I_MWBS_ELEMT WITH KEY WBS_ELEMT = SOURCE_FIELDS-POSID TRANSPORTING NO FIELDS.
IF SY-SUBRC IS INITIAL.
RESULT = I_MWBS_ELEMT-RESP_CCTR.
ELSE.
SELECT SINGLE * FROM /BI0/MWBS_ELEMT INTO I_MWBS_ELEMT
WHERE WBS_ELEMT = SOURCE_FIELDS-POSID
AND OBJVERS = 'A'.
IF SY-SUBRC IS INITIAL.
APPEND I_MWBS_ELEMT SORTED BY RESP_CCTR. <-- I think the error is coming from here.
RESULT = I_MWBS_ELEMT-RESP_CCTR.
ELSE.
CLEAR RESULT.
ENDIF.
ENDIF.
My err. msg is
E:An explicit work area is necessary in the OO context. Use "APPEND wa TO I_MWBS_ELEMT SORTED BY".
2009 Oct 09 3:53 AM
Hi,
You need to create work area for internal table instead of having table with header line. In oops it does not allow you.
Try this way.
<li>Define work area
<li>Remove header option for i_mwbs_elemt table and change like below.
DATA:w_mwbs_elemt LIKE LINE OF i_mwbs_elemt.
Thanks
Venkat.OREAD TABLE i_mwbs_elemt INTO w_mwbs_elemt WITH KEY wbs_elemt = source_fields-posid TRANSPORTING NO FIELDS.
IF sy-subrc IS INITIAL.
result = w_mwbs_elemt-resp_cctr.
ELSE.
SELECT SINGLE * FROM /bi0/mwbs_elemt INTO i_mwbs_elemt
WHERE wbs_elemt = source_fields-posid
AND objvers = 'A'.
IF sy-subrc IS INITIAL.
APPEND w_mwbs_elemt TO i_mwbs_elemt SORTED BY resp_cctr.
result = i_mwbs_elemt-resp_cctr.
ELSE.
CLEAR result.
ENDIF.
ENDIF.
dear all,
In the midst of converting some 3.5 update rules to version 7.0 and i'm at a deadlock - lack of the dark art of ABAP... Can someone here please provide me some help for the below codes? Thanks.
READ TABLE I_MWBS_ELEMT WITH KEY WBS_ELEMT = SOURCE_FIELDS-POSID TRANSPORTING NO FIELDS.
IF SY-SUBRC IS INITIAL.
RESULT = I_MWBS_ELEMT-RESP_CCTR.
ELSE.
SELECT SINGLE * FROM /BI0/MWBS_ELEMT INTO I_MWBS_ELEMT
WHERE WBS_ELEMT = SOURCE_FIELDS-POSID
AND OBJVERS = 'A'.
IF SY-SUBRC IS INITIAL.
APPEND I_MWBS_ELEMT SORTED BY RESP_CCTR. <-- I think the error is coming from here.
RESULT = I_MWBS_ELEMT-RESP_CCTR.
ELSE.
CLEAR RESULT.
ENDIF.
ENDIF.
My err. msg is
E:An explicit work area is necessary in the OO context. Use "APPEND wa TO I_MWBS_ELEMT SORTED BY".
2009 Oct 09 3:49 AM
Hi SCHT,
Why don't you try it like this way and see if it helps.
***************
IF SY-SUBRC IS INITIAL.
APPEND I_MWBS_ELEMT.
SORT I_MWBS_ELEMT BY RESP_CCTR.
RESULT = I_MWBS_ELEMT-RESP_CCTR.
**************
Thanks,
Sid
Edited by: sidharth suri on Oct 9, 2009 8:19 AM
2009 Oct 09 3:53 AM
Hi,
You need to create work area for internal table instead of having table with header line. In oops it does not allow you.
Try this way.
<li>Define work area
<li>Remove header option for i_mwbs_elemt table and change like below.
DATA:w_mwbs_elemt LIKE LINE OF i_mwbs_elemt.
Thanks
Venkat.OREAD TABLE i_mwbs_elemt INTO w_mwbs_elemt WITH KEY wbs_elemt = source_fields-posid TRANSPORTING NO FIELDS.
IF sy-subrc IS INITIAL.
result = w_mwbs_elemt-resp_cctr.
ELSE.
SELECT SINGLE * FROM /bi0/mwbs_elemt INTO i_mwbs_elemt
WHERE wbs_elemt = source_fields-posid
AND objvers = 'A'.
IF sy-subrc IS INITIAL.
APPEND w_mwbs_elemt TO i_mwbs_elemt SORTED BY resp_cctr.
result = i_mwbs_elemt-resp_cctr.
ELSE.
CLEAR result.
ENDIF.
ENDIF.
2009 Oct 09 3:57 AM
Hi SCHT,
Try declaring an explicit work area for internal table I_MWBS_ELEMT and use that work area. Replace ur code with below code.
Data: wa LIKE LINE OF I_MWBS_ELEMT.
READ TABLE I_MWBS_ELEMT WITH KEY WBS_ELEMT = SOURCE_FIELDS-POSID TRANSPORTING NO FIELDS INTO wa. <----
IF SY-SUBRC IS INITIAL.
RESULT = wa-RESP_CCTR. <----
ELSE.
SELECT SINGLE * FROM /BI0/MWBS_ELEMT INTO wa
WHERE WBS_ELEMT = SOURCE_FIELDS-POSID
AND OBJVERS = 'A'.
IF SY-SUBRC IS INITIAL.
APPEND wa SORTED BY RESP_CCTR. <----
RESULT = wa-RESP_CCTR. <-----
ELSE.
CLEAR RESULT.
ENDIF.
ENDIF.
Thanks,
2009 Oct 09 4:36 AM
2009 Oct 28 3:01 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |