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: 

Looping through an internal table order/operation

bryanjacobs
Participant
0 Kudos
788

hie guys

My smart-forms are not very good so can you please help me.

I have a report done in smart-forms which displays only a single name instead of a list of names per order operation.

i have done reports in abap only and i'm comfortable with using abap loops to write the output but

but now i need to display the employee # and the personnel name using internal tables in smart-forms

as you can see that only one name is appearing but i need a whole list.

below is a code snippet that is writing the personnel name.

any ideas how i can loop and display the list which will be dynamic

so how can i tackle this issue

please help.

regards

bryan.

1 ACCEPTED SOLUTION

former_member187748
Active Contributor
0 Kudos
508

Hi Brayan,

just loop into your internal tables with your work area (if you have work area) where you have shown your data

i.e, if you are showing your data in a table, then you can use as shown in screenshot

Means just loop into your internal table where you are showing data

16 REPLIES 16

former_member187748
Active Contributor
0 Kudos
509

Hi Brayan,

just loop into your internal tables with your work area (if you have work area) where you have shown your data

i.e, if you are showing your data in a table, then you can use as shown in screenshot

Means just loop into your internal table where you are showing data

0 Kudos
508

HIE SIR

Now i have two challenges now firstly i created the internal table as shown below

but failed to create a work area???

Which part of the smart-form do i declare the work area cause i keep getting errors.

THEN in my code how to i loop through the internal table cause they want me to display the list

on a text element but i only did it using a write statement before.

0 Kudos
508

Hi Brayan,

please understand, whatever you wants to create in smartforms (tables, variable, etc),

these are declared in global declarations, so define your internal table and work area

in global declaration, and also please declare your all variables, which is giving error that

"unknown".

Then use all these in the import/export parameters, so that it will get accessed

into the program,

so please declare all of them in import/export parameters as shown in your third pic here.

Now when it comes to looping, be sure that, put your this field you wants to show your data

in the same table having other data too, so that, when you will populate your data to be used

for all records, all data should get shown.

Suppose i have already 10 fields to be shown in an internal table, then please add this text field

in the same table, and creates a work area, and define in global declarations as shown in my previos post.

Then you can simply loop into your table to show all the data at same time.

Please do as sujjested, you will get what you need.

former_member187748
Active Contributor
0 Kudos
508

Hi Brayan,

why you have used SELECT SINGLE statement, please delete it,

if it will be, then it will fetch only single entry.

Just use SELECT

0 Kudos
508

ok thanks

i have dropped the select single(just realized that) and i'm creating a new internal table using the method u have pasted.

will update you.

narendar_naidu
Active Participant
0 Kudos
508

hi bryan,

you have an option use loop on a window or inside a window(according to your convinience).

and display data where ever required. you are passing one pernr so you are able to display only one.

Be more clear so that we can help u out.

regards,

0 Kudos
508

yes that was  an error in logic

let me redo my logic and try to loop thru an internal table.

will keep you posted.

regards

0 Kudos
508

HIE SIR

Now i have two challenges now firstly i created the internal table as shown below

but failed to create a work area???

Which part of the smart-form do i declare the work area cause i keep getting errors.

THEN in my code how to i loop through the internal table cause they want me to display the list

on a text element but i only did it using a write statement before.

0 Kudos
508

Hi Brayan,

you have to declare it in Global declaration, as shown here, and also declare it in Input , and output parameters, as you have shown in second pic.

Please declare here, in the global data tab in Global declaration.

If you have created an internal table than declare it also in  above said places.

0 Kudos
508

Hie sir

sorry for late reply was doing a bit of reading to understand

i have done everything u instructed me to do.

i have declared them in the global definition

i ended up using a field symbol to access the information(names) cause i thot its easier

but at the final stage here im getting an error

i read that you apply the form name as i have done but i'm getting an error.

my smartform name is zpm_order_smartform

so im now confused!!! this was supposed to display.

0 Kudos
508

Hi Brayan,

why you have used a field symbol for this,

why not just you creates a variable to show the output.

0 Kudos
508

Brayan,

just tell me one thing, while reviewing this thread (actually i missed what your queries are).

Let me explain, while fetching the data in your report program, please debug and see

are you getting all employee name in your report program.

If not please check your code once, and if you are getting all name in your report, then please

revert me back.

Former Member
0 Kudos
508

Hi Bryan,

Fetch all data in the driver program itself if you find difficult to update a existing table in the smartforms. Just fetch all the fields that you have to display in the internal table and just show them up in smartforms.

Thanks,

Tooshar Bendale

0 Kudos
508

HIE SIR

Now i have two challenges now firstly i created the internal table as shown below

but failed to create a work area???

Which part of the smart-form do i declare the work area cause i keep getting errors.

THEN in my code how to i loop through the internal table cause they want me to display the list

on a text element but i only did it using a write statement before.

0 Kudos
508

You dont need to create it in form interface parameters. Create it in Global data both internal table and work area

Nabheet

former_member210857
Participant
0 Kudos
508

Hi Bryan,

We have global definitions in the smartform .( Data declared can be accessed by the the whole smartform ).

You can declare your Internal table and work area in global definitions

Kindly avoid like statements.Instead you can create a table type and use that.

Regards,

Subeesh Kannottil