‎2010 Dec 27 9:15 AM
In cdpos table ,field TABKEY consists of values which i need to separate it and put it into different column. For example , if the tabkey field value is XXXXXXXXXX00000SBM1, the first 10 digits is po number . how can i separate the po number(X) alone from this field and put it into a separate column?
Moderator Message: Basic Question.
Edited by: kishan P on Dec 27, 2010 3:56 PM
‎2010 Dec 27 9:31 AM
Hi,
what do you mean by "different columns" ?
You mean, after database selection to dispaly on screen or something like that ?
Just have to use offset.
select tabkey
int w_tabkey
from cdpos
move w_tabkey(10) to ...
move w_tabkey+10(4) to ...
regards
Morgan
‎2010 Dec 27 9:29 AM
Hi,
First read the table keys into an internal table.
Move the part of table key (Subfields ex: ld_tkey+0(10)) into another internal table
Regards
Praveen
‎2010 Dec 27 9:31 AM
Hi,
what do you mean by "different columns" ?
You mean, after database selection to dispaly on screen or something like that ?
Just have to use offset.
select tabkey
int w_tabkey
from cdpos
move w_tabkey(10) to ...
move w_tabkey+10(4) to ...
regards
Morgan
‎2010 Dec 27 9:40 AM
Hi Madhan,
declare 1 variable of 10 character v_po
than using offset and length
v_po = v_tab+0(10)
you can get the value of PO number.
‎2010 Dec 27 9:52 AM
Hi Madhan,
Check the CDPOS table..
and the tabkey is nothing but the key fields of the table.
so try to create a structure and move the table key to the structure...
example :
tables :cdpos.
*key fields of vbpa table...
types : begin of ty_vbpa,
mandt type mandt,
vbeln type vbeln,
posnr type posnr,
end of ty_vbpa.
data : wa_vbpa type ty_vbpa.
select single * for cdpos
where object = <objectkey>
and TABNAME = 'vbpa'.
if sy-subrc = 0.
move cdpos-TABKEY to wa_vbpa.
endif.
write wa_vbpa-vbeln .
Prabhudas