‎2006 Jun 15 11:54 PM
Hi all,
for the below code i am getting o/p as nothing(null)...
DATA : v_knttp(25) TYPE c.
SHIFT v_knttp LEFT DELETING LEADING space.
CASE lt_ekpo-knttp.
WHEN 'K'.
MOVE lt_ekkn-kostl TO v_knttp.
WHEN 'P'.
MOVE lt_ekkn-ps_psp_pnr TO v_knttp.
WHEN 'O'.
MOVE lt_ekkn-aufnr TO v_knttp.
WHEN OTHERS.
MOVE lt_ekpo-knttp TO v_knttp.
ENDCASE.
write: v_knttp.
‎2006 Jun 16 12:02 AM
Hi Vj,
Try this way out it works only if there exists data.
DATA : v_knttp(25) TYPE c.
SHIFT v_knttp LEFT DELETING LEADING space.
<b>loop at lt_ekpo.</b>
CASE lt_ekpo-knttp.
WHEN 'K'.
v_knttp = lt_ekkn-kostl.
WHEN 'P'.
v_knttp = lt_ekkn-ps_psp_pnr.
WHEN 'O'.
v_knttp = lt_ekkn-aufnr.
WHEN OTHERS.
v_knttp = lt_ekpo-knttp.
ENDCASE.
<b>endloop.</b>
write: v_knttp.
Regards,
Santosh
‎2006 Jun 16 12:02 AM
Hi Vj,
Try this way out it works only if there exists data.
DATA : v_knttp(25) TYPE c.
SHIFT v_knttp LEFT DELETING LEADING space.
<b>loop at lt_ekpo.</b>
CASE lt_ekpo-knttp.
WHEN 'K'.
v_knttp = lt_ekkn-kostl.
WHEN 'P'.
v_knttp = lt_ekkn-ps_psp_pnr.
WHEN 'O'.
v_knttp = lt_ekkn-aufnr.
WHEN OTHERS.
v_knttp = lt_ekpo-knttp.
ENDCASE.
<b>endloop.</b>
write: v_knttp.
Regards,
Santosh
‎2006 Jun 16 12:02 AM
Hi u need to loop through it_ekpo if it is an internal table. also it is meaningless to SHIFT v_knttp since it doesnt contain any value.Check the below code..
DATA : v_knttp(25) TYPE c.
LOOP AT it_ekpo.
CASE lt_ekpo-knttp.
WHEN 'K'.
MOVE lt_ekkn-kostl TO v_knttp.
WHEN 'P'.
MOVE lt_ekkn-ps_psp_pnr TO v_knttp.
WHEN 'O'.
MOVE lt_ekkn-aufnr TO v_knttp.
WHEN OTHERS.
MOVE lt_ekpo-knttp TO v_knttp.
ENDCASE.
write: v_knttp.
clear v_knttp.
ENDLOOP.
Cheers,
Abdul Hakim
‎2006 Jun 16 12:04 AM
Try this
DATA : v_knttp(25) TYPE c.
SHIFT v_knttp LEFT DELETING LEADING space.
CASE lt_ekpo-knttp.
WHEN 'K'.
<b>write</b> lt_ekkn-kostl TO v_knttp.
WHEN 'P'.
<b>write</b> lt_ekkn-ps_psp_pnr TO v_knttp.
WHEN 'O'.
<b>write</b> lt_ekkn-aufnr TO v_knttp.
WHEN OTHERS.
<b>write</b> lt_ekpo-knttp TO v_knttp.
ENDCASE.
write: v_knttp.
‎2006 Jun 16 12:06 AM
hello experts....
i declared internal table....but see the code i think...there is some more thing to be attached????
‎2006 Jun 16 12:09 AM
hi
you are not looping thru your internal table so plz loop thru it as i have mentioned above and update here with the result..
Cheers,
Abdul Hakim
‎2006 Jun 16 12:25 AM
still it is not showing...please help me ...give other suggestions....
Thanks in advance
‎2006 Jun 16 12:27 AM
‎2006 Jun 16 12:27 AM
‎2006 Jun 16 2:41 AM
You are checking values of 'K', 'O', etc.
Debug your program and see if there is such values for lt_ekpo-knttp.
Otherwise if it is your requirement to check only the first letter, declare another field with a single character.
DATA : v_knttp(25) TYPE c,
v_sing(1).
SHIFT v_knttp LEFT DELETING LEADING space.
move lt_ekpo-knttp to v_sing.
CASE v_sing.
WHEN 'K'.
MOVE lt_ekkn-kostl TO v_knttp.
WHEN 'P'.
MOVE lt_ekkn-ps_psp_pnr TO v_knttp.
WHEN 'O'.
MOVE lt_ekkn-aufnr TO v_knttp.
WHEN OTHERS.
MOVE lt_ekpo-knttp TO v_knttp.
ENDCASE.
write: v_knttp.
‎2006 Jun 16 4:28 AM
After declaring the internal table, did you fill it??
Regards,
Amiya Shrivastava
‎2006 Jun 16 4:58 AM
DATA : v_knttp(25) TYPE c.
LOOP AT it_ekpo.
CASE lt_ekpo-knttp.
WHEN 'K'.
MOVE lt_ekkn-kostl TO v_knttp.
WHEN 'P'.
MOVE lt_ekkn-ps_psp_pnr TO v_knttp.
WHEN 'O'.
MOVE lt_ekkn-aufnr TO v_knttp.
WHEN OTHERS.
MOVE lt_ekpo-knttp TO v_knttp.
ENDCASE.
write: v_knttp.
clear v_knttp.
ENDLOOP.
‎2006 Jun 16 4:57 AM
Hi VJ,
As per your code :
DATA : v_knttp(25) TYPE c.
*Is v_knttp already populated.Chk in debug. If yes, then *in case statement,why are you again moving value into *this field.
SHIFT <b>v_knttp</b> LEFT DELETING LEADING space.
*lt_ekkn-knttp should be coming from internal table *loop. Check if there is an loop before it.
CASE <b>lt_ekpo-knttp</b>.
WHEN 'K'.
MOVE lt_ekkn-kostl TO v_knttp.
WHEN 'P'.
MOVE lt_ekkn-ps_psp_pnr TO v_knttp.
WHEN 'O'.
MOVE lt_ekkn-aufnr TO v_knttp.
WHEN OTHERS.
MOVE lt_ekpo-knttp TO v_knttp.
ENDCASE.
write: v_knttp.
You will get a better picture thru code debug. Still if there is any issue, i think..you should paste the entire code piece.
Cheers,
Vikram
Pls reward for helpful replies!!