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

work area

Former Member
0 Likes
725

hi

y use work area.??.cant v directly access database table directly..y do v require work area??where does it stores????

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
699

Hi Kota,

Above mentioned answer work area are helpful to you when you want to handle data in structured format.

Insted of Accesing data with use of individual variable you can handle them in group.

You can move, copy and write data with help of work area.

Hope this will resolve your query...

Now one request: If u are happy with ANSWERS then pleas reward POINTS.

Cheers,

DARSHAN

5 REPLIES 5
Read only

anversha_s
Active Contributor
0 Likes
699

hi,

WORKAREA is a structure that can hold only one record at a time. It is a collection of fields.

We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea.

When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.

The work area is the temporary space in SAP memory that you are working as an ABAPer and is for the duration that your program is running, you also define that area and space as you define internal tables etc

Each row in a table is a record and each column is a field.

A work area is nothing more than a variable in your program which usually has some strucure. This work area holds data at runtime. A lot of times a work area is used to read lines of an internal table into.

Loop at itab into wa.
  write:/ wa-fld1, wa_fld2.
endloop.

Regards

Anver

Read only

Former Member
0 Likes
700

Hi Kota,

Above mentioned answer work area are helpful to you when you want to handle data in structured format.

Insted of Accesing data with use of individual variable you can handle them in group.

You can move, copy and write data with help of work area.

Hope this will resolve your query...

Now one request: If u are happy with ANSWERS then pleas reward POINTS.

Cheers,

DARSHAN

Read only

Former Member
0 Likes
699

ya we can use database tables directly but when we use select endselect it locks the db table and no other can use the table and the performance becomes slow,we also can have requirements l;ike deleting the table entries if we do it on db then the whole SAP will crash so its better to use internal tables,first we put data into internal tables then use as we like it.

explicit work areas are used because its fast in performance many client will not allow you to use itabs with headers

thanks reward points if useful

Read only

Former Member
0 Likes
699

hi kota,

just have a look on this code to know the purpose of the work area,

here using somany work areas to transfer the data to the global work area for the output display, after the data calculations and Manipulations at different work area levels.

final append global work area to global itab for ouptut display.

FORM move_globe .

LOOP AT g_tab_ekko INTO g_wa_ekko.

READ TABLE g_tab_ekpo INTO g_wa_ekpo WITH KEY ebeln = g_wa_ekko-ebeln.

IF sy-subrc EQ 0.

MOVE-CORRESPONDING: g_wa_ekpo TO g_wa_globe,

g_wa_ekko TO g_wa_globe.

ENDIF.

READ TABLE g_tab_mbew INTO g_wa_mbew WITH KEY matnr = g_wa_ekpo-matnr

bwkey = g_wa_ekpo-werks.

IF sy-subrc EQ 0.

IF g_wa_mbew-vjbwh > 0.

MOVE g_wa_mbew-vjbwh TO g_wa_globe-targe.

ELSEIF g_wa_mbew-stprs > 0.

MOVE g_wa_mbew-stprs TO g_wa_globe-targe.

ELSEIF g_wa_mbew-verpr > 0.

MOVE g_wa_mbew-verpr TO g_wa_globe-targe.

ENDIF.

g_wa_globe-pri_d = g_wa_mbew-verpr - g_wa_globe-targe.

g_wa_globe-%_tar = ( ( g_wa_mbew-verpr / g_wa_globe-targe ) / g_wa_globe-targe ) * 100.

MOVE g_wa_mbew-peinh TO g_wa_globe-peinh.

ENDIF.

APPEND g_wa_globe TO g_tab_globe.

ENDLOOP.

ENDFORM. " move_globe

Read only

Former Member
0 Likes
699

Hi Sandy,

It seems you have got the answer...

I request you to reward points to people who have helped you.

DARSHAN