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

hi

Former Member
0 Likes
387

i have created a ztable with the fields same as my selection screen fields. i need to populate my ztable the data which i am giving in the selection screen when i execute the program.(only the values which are given in the selectionscreen)

types: begin of ty_data2,

ryear like zupi5t-ryear, "Fiscal year

rbukrs like zupi5t-rbukrs, "Company code

racct like zupi5t-racct, "Account number

rzzps_posid like zupi5t-rzzps_posid, "WBS element

end of ty_data2.

types: begin of ty_final1,

ryear like zupi5t-ryear, "Fiscal year

rbukrs like zupi5t-rbukrs, "Company code

racct like zupi5t-racct, "Account number

rzzps_posid like zupi5t-rzzps_posid, "WBS element

end of ty_final1.

data: i_data2 type standard table of ty_data2,

i_final1 type standard table of ty_final1,

wa_data2 type ty_data2,

wa_final1 type ty_final1.

parameters:

p_ryear like zupi5t-ryear obligatory. "Fiscal year

select-options:

s_rpmax for zupi5t-rpmax obligatory no-extension. "Period

s_racct for zupi5t-racct obligatory, "Account number

s_rzzps for zupi5t-rzzps_posid obligatory no intervals, "WBS Element

select ryear rbukrs racct rzzps_posid

from zupi5a

into table i_data2

where ryear = p_ryear

and POPER in s_rpmax

and rbukrs = p_rbukrs

and racct in s_racct

and rzzps_posid in s_rzzps.

loop at i_data2 into wa_data2.

wa_final1-ryear = wa_data2-ryear.

wa_final1-rbukrs = wa_data2-rbukrs.

wa_final1-racct = wa_data2-racct.

wa_final1-rzzps_posid = wa_data2-rzzps_posid.

append wa_final1 to i_final1.

clear : wa_final1-ryear,

wa_final1-rbukrs, wa_final-racct,

wa_final1-rzzps_posid.

move wa_final1-ryear to zfirestate_log-ryear.

move wa_final1-rbukrs to zfirestate_log-rbukrs.

move wa_final1-rzzps_posid to zfirestate_log-rzzps_posid.

move s_rpmax-low to zfirestate_log-from_period.

move s_rpmax-high to zfirestate_log-to_period.

move s_racct-low to zfirestate_log-from_acct.

move s_racct-high to zfirestate_log-to_acct.

insert zfirestate_log.

clear wa_final1.

i written the above code . i dont know whether to write this select query or not because i need to populate the table only with the data given in the selection scrren. please help me i need this very urgently.

i have created a ztable with the fields same as my selection screen fields. i need to populate my ztable the data which i am giving in the selection screen when i execute the program.(only the values which are given in the selectionscreen)

types: begin of ty_data2,

ryear like zupi5t-ryear, "Fiscal year

rbukrs like zupi5t-rbukrs, "Company code

racct like zupi5t-racct, "Account number

rzzps_posid like zupi5t-rzzps_posid, "WBS element

end of ty_data2.

types: begin of ty_final1,

ryear like zupi5t-ryear, "Fiscal year

rbukrs like zupi5t-rbukrs, "Company code

racct like zupi5t-racct, "Account number

rzzps_posid like zupi5t-rzzps_posid, "WBS element

end of ty_final1.

data: i_data2 type standard table of ty_data2,

i_final1 type standard table of ty_final1,

wa_data2 type ty_data2,

wa_final1 type ty_final1.

parameters:

p_ryear like zupi5t-ryear obligatory. "Fiscal year

select-options:

s_rpmax for zupi5t-rpmax obligatory no-extension. "Period

s_racct for zupi5t-racct obligatory, "Account number

s_rzzps for zupi5t-rzzps_posid obligatory no intervals, "WBS Element

select ryear rbukrs racct rzzps_posid

from zupi5a

into table i_data2

where ryear = p_ryear

and POPER in s_rpmax

and rbukrs = p_rbukrs

and racct in s_racct

and rzzps_posid in s_rzzps.

loop at i_data2 into wa_data2.

wa_final1-ryear = wa_data2-ryear.

wa_final1-rbukrs = wa_data2-rbukrs.

wa_final1-racct = wa_data2-racct.

wa_final1-rzzps_posid = wa_data2-rzzps_posid.

append wa_final1 to i_final1.

clear : wa_final1-ryear,

wa_final1-rbukrs, wa_final-racct,

wa_final1-rzzps_posid.

move wa_final1-ryear to zfirestate_log-ryear.

move wa_final1-rbukrs to zfirestate_log-rbukrs.

move wa_final1-rzzps_posid to zfirestate_log-rzzps_posid.

move s_rpmax-low to zfirestate_log-from_period.

move s_rpmax-high to zfirestate_log-to_period.

move s_racct-low to zfirestate_log-from_acct.

move s_racct-high to zfirestate_log-to_acct.

insert zfirestate_log.

clear wa_final1.

i written the above code . i dont know whether to write this select query or not because i need to populate the table only with the data given in the selection scrren. please help me i need this very urgently.

1 REPLY 1
Read only

Former Member
0 Likes
290

Check the below logic :

types: begin of ty_data2,

ryear like zupi5t-ryear, "Fiscal year

rbukrs like zupi5t-rbukrs, "Company code

racct like zupi5t-racct, "Account number

rzzps_posid like zupi5t-rzzps_posid, "WBS element

end of ty_data2.

types: begin of ty_final1,

ryear like zupi5t-ryear, "Fiscal year

rbukrs like zupi5t-rbukrs, "Company code

racct like zupi5t-racct, "Account number

rzzps_posid like zupi5t-rzzps_posid, "WBS element

end of ty_final1.

data: i_data2 type standard table of ty_data2,

i_final1 type standard table of ty_final1,

wa_data2 type ty_data2,

wa_final1 type ty_final1.

Data : v_lines type i.

parameters:

p_ryear like zupi5t-ryear obligatory. "Fiscal year

select-options:

s_rpmax for zupi5t-rpmax obligatory no-extension. "Period

s_racct for zupi5t-racct obligatory, "Account number

s_rzzps for zupi5t-rzzps_posid obligatory no intervals, "WBS Element

<b>start-of-selection.</b>

select ryear rbukrs racct rzzps_posid

from zupi5a

into table i_data2

where ryear = p_ryear

and POPER in s_rpmax

and rbukrs = p_rbukrs

and racct in s_racct

and rzzps_posid in s_rzzps.

loop at i_data2 into wa_data2.

wa_final1-ryear = wa_data2-ryear.

wa_final1-rbukrs = wa_data2-rbukrs.

wa_final1-racct = wa_data2-racct.

wa_final1-rzzps_posid = wa_data2-rzzps_posid.

append wa_final1 to i_final1.

clear : wa_final1-ryear,

wa_final1-rbukrs, wa_final-racct,

wa_final1-rzzps_posid.

endloop.

<b>Describe table i_final1 lines v_lines.</b>

If v_lines = 0.

Error message “ No records found for given selection’.

Endif.

<b>insert zfirestate_log from table i_final1.</b>

Thanks

Seshu