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

How to get fixed value for incomming data?

Former Member
0 Likes
701

Hi Guru's,

A custom table is getting data from XI, for one of the fields in table i want to set fixed value "X" for all records geting loaded. I tried to set fixed value at domain level for that field its not working am i missing something ? How to fix constant value to a field ?

Hi Guru's,

A custom table is getting data from XI, for one of the fields in table i want to set fixed value "X" for all records geting loaded. I tried to set fixed value at domain level for that field its not working am i missing something ? How to fix constant value to a field ?

4 REPLIES 4
Read only

Former Member
0 Likes
670

Hi,

First get the data to the internal table from XI....

then loop at the table itab and modify the table with changed value...

See the given code as an example... this is tested and it works perfectly fine...

data t_itab type table of scarr.
data wa type scarr.
select * from scarr into table t_itab.     " here is the place where you are fetching data from XI... here I 
" am fetching data from SCARRR table

loop at t_itab into wa.   " looping at an internal table....
wa-carrname = 'CHANGED VALUE'.           " Here I am changing the field with the constant value ...
modify t_itab from wa.         "   After changing the field am modifying the table with the new value
endloop.

"  Displaying the data
loop at t_itab into wa.
write wa.
endloop.

Hope this helps you in solving the problem

Regards,

Siddarth

Read only

Former Member
0 Likes
670

giving value at domin level can make its value search but it wont assing that value to field..

you have to do by coding....

modify that field once you get the value in internal table

Read only

former_member585060
Active Contributor
0 Likes
670

Hi,

Add the code to the Report after the data is in your internal table.

LOOP AT it_itab INTO wa_itab.

wa_itab-field = 'X'.

"Not required if below INSERT statements added    
' MODIFY it_itab INDEX sy-tabix FROM wa_itab TRANSPORTING field.  " Field with 'X'
 " here add the insert statement into ur custom table

INSERT ztable FROM  wa_itab.
      IF sy-subrc = 0.
        COMMIT WORK.                                           "This is also inside loop after each record.
      ELSE.
        UPDATE ztable FROM wa_itab.                     "<<-----It means Record already exist
              IF sy-subrc = 0.
          COMMIT WORK.
        ENDIF.
ENDIF.                      
   
ENDLOOP.

Regards

Bala Krishna

Edited by: Bala Krishna on Feb 14, 2009 11:10 AM

Read only

Former Member
0 Likes
670

Resolved