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

Explain the following ABAP Code please

Former Member
0 Likes
568

Hi,

Can any one please explain me what this code is performing

(Convert this machine language into human language in detail please)

Data: i_t_data like ZOXWRD0054.

case i_datasource.

when ' Z_TRM_LMS'.

Loop at c_t_data into i_t_data.

Select single bonus_cat perfinc active from ztrm_labdlycat into

(i_t_data-zzbonus, i_t_data-zzperf, i_t_data-zzactive)

Where locat = i_t_data-locat and

exrsn = i_t_data-exrsn and

apobj = i_t_data-apobj.

Modify c_t_data from i_t_data.

Endloop.

Endcase.

Thanks in advance

3 REPLIES 3
Read only

Pawan_Kesari
Active Contributor
0 Likes
506

When the i_datasource = ' Z_TRM_LMS'

Code is getting values BONUS_CAT PERFINC and ACTIVE from table ZTRM_LABDLYCAT and updating all records of the the internal table C_T_DATA.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
506

This include is related to BW extractor or assimilated product.

For each record extracted by the standard extractor, access to a custom table to fill fields appended to the DataSource.

The use of select single is bad-performance, better select for all entries in the current InfoPackage and then LOOP and READ FROM TABLE to update records.

Regards

Read only

Former Member
0 Likes
506

HI,

This is a code written in a user exit in BW.

<b>*-- Declare a work area (Temporary storage) same as the structure ZOXWRD0054</b>

Data: i_t_data like ZOXWRD0054.

<b>the program has already a variable called i_datasource</b> and we use Case <b>statement to perform various actions for different values

say if a = 0

do something

if b= 0

do someting..

like this.. Case is used to branch to differnt part of the code based on the value of i_datasouce variable</b>

case i_datasource.

<b>*-- When the value of i_datasouce is 'Z_TRM_LMS' then execute the code between loop and endloop.</b>

when ' Z_TRM_LMS'.

<b>*-- Loop will process record by record</b>

Loop at c_t_data into i_t_data.

<b>*-- Select a single occurence of bonus_cat perfinc active fields from the table ztrm_labdlycat where the values of the fields locat is equal to value in i_t_data-locat and

exrsn is equal to value in i_t_data-exrsn and

apobj is equal to value in i_t_data-apobj.

and copy the values bonus_cat perfinc active from which are in table ztrm_labdlycat into the variables (i_t_data-zzbonus, i_t_data-zzperf, i_t_data-zzactive)</b>

Select single bonus_cat perfinc active from ztrm_labdlycat into

(i_t_data-zzbonus, i_t_data-zzperf, i_t_data-zzactive)

Where locat = i_t_data-locat and

exrsn = i_t_data-exrsn and

apobj = i_t_data-apobj.

<b>*-- Here you are trying to modify the content of the table c_t_data with the new values that the select stament above has returned..</b>

Modify c_t_data from i_t_data.

Endloop.

Endcase.

Hope this help do let me know if any thing else is required

Thanks

Mahesh