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

internal table

Former Member
0 Likes
819

Hi,

In selection screen using select options i enter fromperiod and toperiod as

03 08.

In my internal table i have fields

ls01,ls02......,ls12.

when i choose 03 to 08 i should be able to add fields

ls01ls03ls04ls05ls06ls07ls08

ls01 should be added defaultly for any case.

How to implement this.

Regards,

Charitha

8 REPLIES 8
Read only

Former Member
0 Likes
778

hi Ratna,

In your selection screen click on multiple selections option ( Arrow Button ) and include the required fields in that and save it as a variant ...

Regards,

Santosh

Read only

Former Member
0 Likes
778

use do.. VARYING..

Read only

Former Member
0 Likes
778

Hi,

Since U have 12 values

write this .

Do 12 times varying v_ls01 from it_ls01 next it_ls02.

v_count = v_count + 1.

if v_count = 1.

v_total = v_total + v_ls01.

endif.

if v_count between v_fromperiod and v_toperiod.

v_total = v_total + v_ls01.

endif.

clear : v_ls01.

enddo.

Pls. Award iff its helpful.

Regards,

GSR.

Read only

Former Member
0 Likes
778

sorry i cannot get your question.

do you want to add heading in the list ike that?

if it is so

then you have to do the coding in at selection-screen.

i think the range is numeric only so you can add 1 and get 03,04, upto higher range.

here you have to concatenate the header text as per selection screen.

now you have to show the header in top-of-page or somewhere else.

please reply back if i am wrong.

regards

shiba dutta

Read only

Former Member
0 Likes
778

c rtna these kind of requirement usvally we find in FI/CO developments....

in these cases u have to take the table with the fields...ls01,ls02......,ls12.

(Since U have 12 period fields/values )

in selection u will enter period like x to y OR

in selection u will enter period like x (only one period)

suppose s_perio is ur selection declared.

append fields apart from ls01,ls02......,ls12. which u required.

do do the below code..

if not s_perio-high initial.

var = s_perio-low.

do.

itab-field = ls+var.

append itab.

if s_perio-high > var.

exit.

endif.

enddo.

else.

itab-field = ls+s_perio-low.

append itab.

endif.

select ( itab ) from GLT0 into table itab ,,,,,,,etc.

Ramesh.

Read only

Former Member
0 Likes
778

rtna these kind of requirement usvally we find in FI/CO developments....

in these cases u have to take the table with the fields...ls01,ls02......,ls12.

(Since U have 12 period fields/values )

in selection u will enter period like x to y OR

in selection u will enter period like x (only one period)

suppose s_perio is ur selection declared.

append fields apart from ls01,ls02......,ls12. which u required.

do do the below code..

if not s_perio-high initial.

var = s_perio-low.

do.

itab-field = ls+var. <<-- directltly we can not do this cancatenate into varible and assign

append itab.

if s_perio-high > var.

exit.

endif.

enddo.

else.

itab-field = ls+s_perio-low.

append itab.

endif.

select ( itab ) from GLT0 into table itab ,,,,,,,etc.

Read only

Former Member
0 Likes
778

Hi,

I hope following code will solve your problem.

clear : v_total.

l_period = fromperiod.

while l_period <= toperiod.

ASSIGN COMPONENT l_period OF STRUCTURE itab TO <fs>.

if sy-subrc = 0.

v_total = v_total + <fs>.

l_period = l_period + 1.

else.

exit.

endwhile.

v_total = v_total + itab-ls01.

Reward points if the answer is helpful.

Regards,

Mukul

Message was edited by:

Mukul R. Kulkarni

Read only

Former Member
0 Likes
778
data : v_sum type p decimals 2.

FIELD-SYMBOLS: <L_AMOUNT> TYPE ANY. 

loop at itab.
 v_sum = v_sum + itab-ls01.
 v_i = s_period-low.
diff = s_period-high - s_period-low.
diff = diff + 1.
do diff times.
 concatenate 'ITAB-LS0'  v_i into  v_value.
ASSIGN (L_VALUE) TO <L_AMOUNT>.
  v_sum = v_sum + <L_AMOUNT>..
v_i = v_i + 1.
endloop.