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

Parallel cursor process

lella_sri
Explorer
0 Likes
2,002

Hi

Can you please tell me how to use parallel cursor technique if second loop has the NE selection section,

I know normally , but here in where condition NE selection is there.

Thanks,

Srinivas.

10 REPLIES 10
Read only

Former Member
0 Likes
1,974

Hi Srinivas,

I think you can try the below way.

read table fp_it_temp into l_wa_temp with key kunwe eq <l_fs_final_today>-kunwe

                                                                   matnr eq <l_fs_final_today>-matnr binary search.

if l_wa_temp-vbeln ne  <l_fs_final_today>-vbeln.

lv_index = sy-tabix.

loop at fp_it_temp into l_wa_temp from lv_index.

if l_fs_final_today ne l_wa_temp-kunwe. "Add if you need other conditions.

exit.

endif.

"Write your respective coding here

endloop.

endif.

Regards,

Mounika

Read only

0 Likes
1,974

Hi Mounika,

Thanks for your response.

after read table if condition is  satisfied then it will get the sy-tabix.

But my question is if the l_wa_emp-vbeln NE <l_fs_final_today>-vbeln record is in second postion in fp_it_temp,

then the read statement won't go to second record right for that combination.

Read statement will take first record for the satisfied condition , it is the problem if we right the logic suggest by you.

Read only

0 Likes
1,974

Hello,

Am wondering why is it not possible to use the following approach below,

read table fp_it_temp into l_wa_temp with key kunwe eq <l_fs_final_today>-kunwe

                                                                   matnr eq <l_fs_final_today>-matnr

                                                                    vbeln ne  <l_fs_final_today>-vbeln binary search.

lv_index = sy-tabix.

loop at fp_it_temp into l_wa_temp from lv_index.

if l_fs_final_today ne l_wa_temp-kunwe. "Add if you need other conditions.

exit.

endif

I assume this approach will even work, why to check the condition later ??

Regards,

Deepan Swaminathan.

Read only

0 Likes
1,974

Hello deepan,

Read statement doesn't allow Relational operators ( EQ NE ).

Need to use = arithmeticonly 

Read only

0 Likes
1,974

lella sri wrote:

But my question is if the l_wa_emp-vbeln NE <l_fs_final_today>-vbeln record is in second postion in fp_it_temp,

then the read statement won't go to second record right for that combination.

After read statement I've checked 'if l_wa_temp-vbeln ne  <l_fs_final_today>-vbeln.' Only if this satisfies, your loop condition will be executed else it will not.

loop at fp_it_temp into l_wa_temp from lv_index.

if l_fs_final_today-knuwe ne l_wa_temp-kunwe and l_fs_final_today-matnr eq <l_fs_final_today>-matnr and l_wa_temp-vbeln ne  <l_fs_final_today>-vbeln

exit.

endif.

endloop.

If you change your code in the above way for the second record,as you mentioned, if the condition fails then it will exit the loop.

Regards,

Mounika

Read only

0 Likes
1,974

Hello mouinka,

Ex data:

Fp_it_final_today:

VBELN      KUNWE      MATNR

0410          10               FA1010               - header

FP_FINAL_TODAY:

VBELN    KUNWE       MATNR

0410        10              FA1010                   - 1st

0420        10              FA1010                    - 2nd

If we go through the above logic.

Read statement will satisfy the combination of kunwe and matnr

after that in if condition vbeln  won't satisfy so it won't get sy-tabix. because 0410 = 0410.

So it will exit the read statement but my record is in second position,

whenever read statement run it will get the first record only, it won't go to second record

because of this I'm missing the 2nd position record.;

Read only

0 Likes
1,974

Better to loop the item table first followed by header table. You can append the data only when the header table vbeln is not equal to item tab vbeln.

I hope there will not be any issue if you do so.

Regards,

Mounika

Read only

0 Likes
1,974

hi lella,

I think you can read for VBELN after the first loop, than

If sy-subrc = 0.

continue.

endif.

"Normal parallel cursor logic goes Here"

Here no need to check the NE condition for VBELN, because in above logic if it finds the value of VBELN in both the internal tables it will continue with next iteration.

Regards,

Shadab.

Read only

0 Likes
1,974

Thank you guys for your suggestion.

Problem got resolved by my self.

Thanks,

Srinivas.

Read only

Former Member
0 Likes
1,974

This message was moderated.