Application Development 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: 

It's too urgent

Former Member
0 Kudos

Hi,

iam concatenating P and infotype number which has subtypes (ex: 0006 or 00021 e.tc.) into variable "intext" which is of type string.

now i use ASSIGN and send that work area to <ptr> which is of type any;

data : <ptr> type any.

assign intext to <ptr>.

so now <ptr> has work area. now i want to read a field from the <ptr> which may contain 0006 or 0021 work area. how to write generally to retrieve a field.

<ptr> is type ANY. i can't loop it as internal table.

if i take <ptr> as type standard table, i cant use

assign intext to <ptr>. because intext is of type string.

how to solve it? urgent.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

The following coding will work for any infotype which we give from an internal table using field symbol.

Try this way ...

types: begin of ty_infotype,

itno(7) type c,

end of ty_infotype.

FIELD-SYMBOLS: <fsmb_table> TYPE ANY TABLE,

<wa>,<wa1>.

data: int_infotype type table of ty_infotype,

fs_infotype type ty_infotype,

wf_table(7) type c,

wf_ref TYPE REF TO data,

w_dref1 TYPE REF TO data.

clear fs_infotype.

fs_infotype-itno = 'PA0014'.

append fs_infotype to int_infotype.

clear fs_infotype.

fs_infotype-itno = 'PA0015'.

append fs_infotype to int_infotype.

clear fs_infotype.

fs_infotype-itno = 'PA0315'.

append fs_infotype to int_infotype.

  • Take each infotype from internal table and process..

clear fs_infotype.

loop at int_infotype into fs_infotype.

clear wf_table.

wf_table = fs_infotype-itno.

CREATE DATA wf_ref TYPE TABLE OF (wf_table).

ASSIGN wf_ref->* TO <fsmb_table>.

create data w_dref1 like line of <fsmb_table>.

assign w_dref1->* to <wa>.

SELECT * FROM (wf_table) up to 2 rows INTO TABLE <fsmb_table>.

loop at <fsmb_table> into <wa>.

do.

assign component sy-index

of structure <wa> to <wa1>.

if sy-subrc ne 0.

exit.

endif.

if sy-index = 1.

write:/ <wa1>.

else.

write: <wa1>.

endif.

enddo.

endloop.

clear fs_infotype.

endloop.

Hope it will help u...

    • Kindly reward points if helpful ***

Cheers,

Shanthi.

Edited by: shanthi ps on Jan 28, 2008 8:43 AM

1 REPLY 1

Former Member
0 Kudos

Hi,

The following coding will work for any infotype which we give from an internal table using field symbol.

Try this way ...

types: begin of ty_infotype,

itno(7) type c,

end of ty_infotype.

FIELD-SYMBOLS: <fsmb_table> TYPE ANY TABLE,

<wa>,<wa1>.

data: int_infotype type table of ty_infotype,

fs_infotype type ty_infotype,

wf_table(7) type c,

wf_ref TYPE REF TO data,

w_dref1 TYPE REF TO data.

clear fs_infotype.

fs_infotype-itno = 'PA0014'.

append fs_infotype to int_infotype.

clear fs_infotype.

fs_infotype-itno = 'PA0015'.

append fs_infotype to int_infotype.

clear fs_infotype.

fs_infotype-itno = 'PA0315'.

append fs_infotype to int_infotype.

  • Take each infotype from internal table and process..

clear fs_infotype.

loop at int_infotype into fs_infotype.

clear wf_table.

wf_table = fs_infotype-itno.

CREATE DATA wf_ref TYPE TABLE OF (wf_table).

ASSIGN wf_ref->* TO <fsmb_table>.

create data w_dref1 like line of <fsmb_table>.

assign w_dref1->* to <wa>.

SELECT * FROM (wf_table) up to 2 rows INTO TABLE <fsmb_table>.

loop at <fsmb_table> into <wa>.

do.

assign component sy-index

of structure <wa> to <wa1>.

if sy-subrc ne 0.

exit.

endif.

if sy-index = 1.

write:/ <wa1>.

else.

write: <wa1>.

endif.

enddo.

endloop.

clear fs_infotype.

endloop.

Hope it will help u...

    • Kindly reward points if helpful ***

Cheers,

Shanthi.

Edited by: shanthi ps on Jan 28, 2008 8:43 AM