Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

cdpos tabkey separation

Former Member
0 Likes
2,901

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

1 ACCEPTED SOLUTION
Read only

former_member246786
Participant
0 Likes
1,503

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,503

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

Read only

former_member246786
Participant
0 Likes
1,504

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

Read only

Former Member
0 Likes
1,503

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.

Read only

Former Member
0 Likes
1,503

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