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

Problem in using modify statement inside a Perform

Former Member
0 Likes
947

Hi Experts,

loop at t_data into wa_data.

IF wa_data1-zbukrs IS INITIAL.

wa_data1-zstat = 'E'.

w_messg = 'Company code is blank in upload data'.

CONCATENATE wa_data1-zbukrs w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg wa_data1-zmsg INTO w_msg

SEPARATED BY

'|'.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1.

endif.

IF wa_data1-zfwcd IS INITIAL.

wa_data1-zstat = 'E'.

w_messg = 'Forwarder code is blank in upload data'.

CONCATENATE wa_data1-zfwcd w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg wa_data1-zmsg INTO w_msg

SEPARATED BY

'|'.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1.

endif.

IF wa_data1-zinvno IS INITIAL.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1.

wa_data1-zstat = 'E'.

w_messg = 'Invoice number is blank in upload data'.

CONCATENATE wa_data1-zinvno w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg wa_data1-zmsg INTO w_msg

SEPARATED BY

'|'.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1.

endif.

endloop.

My doubt is:

wa_data1-zstat = 'E'.

w_messg = 'Company code is blank in upload data'.

CONCATENATE wa_data1-zbukrs w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg wa_data1-zmsg INTO w_msg

SEPARATED BY

'|'.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1.

i want write the above code to be written in a perform statement

becos iam using the above code in multiple places in my program.

but the problem iam facing is modify not working in perform statement.

Regards,

Raj.

1 ACCEPTED SOLUTION
Read only

rthoodi
Active Participant
0 Likes
916

Hello,

How can system understand that which record of t_data1 you are modifying, please give some condition like

MODIFY t_data1 FROM wa_data1 index (sy-tabix ) or any key field of t)data1.

Thanks

RK

8 REPLIES 8
Read only

Former Member
0 Likes
916

hi Raj,

use FIELD-SYMBOLS so that you don't have to use MODIFY statement.

-


FIELD-SYMBOLS: <fs> like line of T_data.

loop at t_data ASSIGNING <fs>.

IF <fs>-zbukrs IS INITIAL.

<fs>-zstat = 'E'.

w_messg = 'Company code is blank in upload data'.

CONCATENATE <fs>-zbukrs w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg <fs>-zmsg INTO w_msg

SEPARATED BY '|'.

<fs>-zmsg = w_msg.

endif.

IF <fs>-zfwcd IS INITIAL.

<fs>-zstat = 'E'.

w_messg = 'Forwarder code is blank in upload data'.

CONCATENATE <fs>-zfwcd w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg <fs>-zmsg INTO w_msg

SEPARATED BY '|'.

<fs>-zmsg = w_msg.

endif.

....

.....

.....

endloop.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
916

but the problem i am facing is modify not working in perform statement.

You have to be clear on your statement. What is the error you are facing or is there any compilation error etc ?

Read only

Former Member
0 Likes
916

Hi,

wa_data1-zstat = 'E'.

w_messg = 'Company code is blank in upload data'.

CONCATENATE wa_data1-zbukrs w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg wa_data1-zmsg INTO w_msg

SEPARATED BY

'|'.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1.

Iam using the above code in different places in my program.so thats why i want that code in single perform statement.

Read only

Former Member
0 Likes
916

Hi,

wa_data1-zstat = 'E'.

w_messg = 'Company code is blank in upload data'.

CONCATENATE wa_data1-zbukrs w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg wa_data1-zmsg INTO w_msg

SEPARATED BY

'|'.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1.

Iam using the above code in different places in my program.so thats why i want that code in single perform statement.

Advance Thanks...

Regards,

Raj.

Read only

Former Member
0 Likes
916

Hi,

Perform message using wa_data1-zstat w_messag changing w_msg.

Here you just do the coding according to your requirement.

form message ( you need to give the type of the using and changing fields)

wa_data1-zstat = 'E'.

w_messg = 'Company code is blank in upload data'.

CONCATENATE wa_data1-zbukrs w_messg INTO w_msg

SEPARATED BY space.

CONCATENATE w_msg wa_data1-zmsg INTO w_msg

SEPARATED BY

'|'.

wa_data1-zmsg = w_msg.

MODIFY t_data1 FROM wa_data1 transporting the field that you have changed in the wa.

endform.

With Regards,

Sumodh.P.

Read only

rthoodi
Active Participant
0 Likes
916

HI Mr. Raj,

Put that code in perform , so that you can use that perform statement whereever is required, this is one kind of modularization technique for easy readablity, Ok, anyway,

When you use modify itab from wa_itab , how can system understand that which record of itab you are chaging with respect to work area, So give index or where condition, so that modify will work.

Thanks

RK

Read only

rthoodi
Active Participant
0 Likes
917

Hello,

How can system understand that which record of t_data1 you are modifying, please give some condition like

MODIFY t_data1 FROM wa_data1 index (sy-tabix ) or any key field of t)data1.

Thanks

RK

Read only

Former Member
0 Likes
916

Hi,

How you are passing these values in to the Perform statement. Are you using the parameters for Perform statement? If so just add

changing in the perform statement with wa values.

So you will get the changed value in the work area.

Then modify the internal table from wa transporting the changes fields.

With Regards,

Sumodh.P