2006 Jan 19 11:53 PM
Hi,
<b>I am new to ABAP.Can anyone help me wih this code</b>
<b>The following code is in start routine</b>
LOOP AT DATA_PACKAGE.
SELECT /BIC/ZPACTGY /BIC/ZMPIINIR FROM /BIC/PZCONDTYP
INTO IT_ZCONDTYP
WHERE /BIC/ZCONDTYP = DATA_PACKAGE-/BIC/ZCONDTYP.
IF ( IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR12' OR
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR13' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR14' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVV10' or
IT_ZCONDTYP-/BIC/ZMPIINIR Eq 'Y' or
( IT_ZCONDTYP-/Bic/zcondtyp ge 'Y100'
and IT_ZCONDTYP-/Bic/zcondtyp le 'Y199' ) ).
APPEND DATA_PACKAGE.
ENDIF.
endselect.
ENDLOOP.
<b>what I am trying to accomplish is I want my data which is in the internal table to satisfy the following conditions. and place it in internal table .(or whatever is correct)</b>
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR12' OR
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR13' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR14' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVV10' or
IT_ZCONDTYP-/BIC/ZMPIINIR Eq 'Y' or
( IT_ZCONDTYP-/Bic/zcondtyp ge 'Y100'
and IT_ZCONDTYP-/Bic/zcondtyp le 'Y199' ) ).
<b>and read this from another transfer routine</b>
CLEAR RESULT.
READ TABLE IT_ZCONDTYP WITH KEY
/BIC/ZCONDTYP = COMM_STRUCTURE-/BIC/ZCONDTYP
BINARY SEARCH.
IF SY-SUBRC EQ 0.
RESULT = IT_ZCONDTYP-/BIC/ZCONDTYP.
ENDIF.
<b>This is mostly related to BW.So if someone can give their opinion on how to achieve this I will be very grateful.</b>
thanks,
Kal
Hi,
<b>I am new to ABAP.Can anyone help me wih this code</b>
<b>The following code is in start routine</b>
LOOP AT DATA_PACKAGE.
SELECT /BIC/ZPACTGY /BIC/ZMPIINIR FROM /BIC/PZCONDTYP
INTO IT_ZCONDTYP
WHERE /BIC/ZCONDTYP = DATA_PACKAGE-/BIC/ZCONDTYP.
IF ( IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR12' OR
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR13' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR14' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVV10' or
IT_ZCONDTYP-/BIC/ZMPIINIR Eq 'Y' or
( IT_ZCONDTYP-/Bic/zcondtyp ge 'Y100'
and IT_ZCONDTYP-/Bic/zcondtyp le 'Y199' ) ).
APPEND DATA_PACKAGE.
ENDIF.
endselect.
ENDLOOP.
<b>what I am trying to accomplish is I want my data which is in the internal table to satisfy the following conditions. and place it in internal table .(or whatever is correct)</b>
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR12' OR
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR13' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR14' or
IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVV10' or
IT_ZCONDTYP-/BIC/ZMPIINIR Eq 'Y' or
( IT_ZCONDTYP-/Bic/zcondtyp ge 'Y100'
and IT_ZCONDTYP-/Bic/zcondtyp le 'Y199' ) ).
<b>and read this from another transfer routine</b>
CLEAR RESULT.
READ TABLE IT_ZCONDTYP WITH KEY
/BIC/ZCONDTYP = COMM_STRUCTURE-/BIC/ZCONDTYP
BINARY SEARCH.
IF SY-SUBRC EQ 0.
RESULT = IT_ZCONDTYP-/BIC/ZCONDTYP.
ENDIF.
<b>This is mostly related to BW.So if someone can give their opinion on how to achieve this I will be very grateful.</b>
thanks,
Kal
2006 Jan 20 12:07 AM
Hi
I can't understand what you really want to do:
You can try to use this code instead of your:
Check if there are some hit in the table
IF NOT DATA_PACKAGE[] IS INITIAL.
SELECT /BIC/ZPACTGY /BIC/ZMPIINIR FROM /BIC/PZCONDTYP
INTO TABLE IT_ZCONDTYP
FOR ALL ENTRIES IN DATA_PACKAGE
WHERE /BIC/ZCONDTYP = DATA_PACKAGE-/BIC/ZCONDTYP
AND ( /BIC/ZPACTGY Eq 'VVR12' OR
/BIC/ZPACTGY Eq 'VVR13' or
/BIC/ZPACTGY Eq 'VVR14' or
/BIC/ZPACTGY Eq 'VVV10' or
/BIC/ZMPIINIR Eq 'Y' or
( /Bic/zcondtyp ge 'Y100'
/Bic/zcondtyp le 'Y199' ) ).
ENDIF.
Max
2006 Jan 20 1:28 AM
Hi,
In
LOOP AT DATA_PACKAGE
ENDLOOP,
you are appending DATA_PACKAGE.
You are looping DATA_PACKAGE and appending same record to the same internal tabke.This should not be the case. At the end you will get duplicate records for which atleast one IF condition is satisfied in DATA_PACKEGE internal table. Instead APPEND IT_ZCONDTYP is more meaningful.
SELECT given by Max will be better as that will bring entire data in one shot.
And one more thing is before reading table IT_ZCONDTYP using BINARY SEARCH sort IT_ZCONDTYP. Else you will not get the correct result out of READ statement.
Regards,
Ramesh.