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

Getting the record data.

Former Member
0 Likes
883

Hi All,

Good Morning.

I had same question before, but there I was not getting the record data.

This is my internal table structure.

KUNNR, VKORG, VTWEG, SPART, CRDATE, EFDATE, SPRICE, EPRICE, SQTY, EQTY.

This internal table is the user selected records using a report display with check box to select the records.

From the internal table with the user selected records if the KUNNR, VKORG, VTWEG, SPART values are same it has to go to if condition and I need to catch the data of the records to use in the Function other wise go to else condition.

lOOP AT ITAB.

IF ---

CALL FUNCTION

ELSE

EXIT.

ENDIF.

ENDLOOP.

1) 1001 300 20 01 12/01/2006 01/01/2007 10.00 9.00 10 09

2) 1001 300 10 01 -


3) 1001 300 20 01 -


If the user selects records 1 and 3 it has to go in to IF condition. Here I need the records data of 1 and 3.

If the user selects records 1 and 2 it has to go in to ELSE condition.

Please help me. Sorry for the confusion.

Thanks,

Neelu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
859

HI,

Loop at itab.

*--Write logic to get the selected records and store it in jtab. (Hope this logic is already in place with you)

put them into jtab.

endloop.

ktab[] = jtab[]. " Ktab to get the seleted records

sort table jtab by KUNNR, VKORG, VTWEG, SPART .

delete adjacent duplicates from jtab comparing VKORG, VTWEG, SPART .

describe table jtab lines v_lines.

and now your condition.

with your requirment.

if lv_lines is 1 then it indicates that you have selected lines 1 and 3 and in delete command it got deleted only one left as they have same values.

else

here you have selected lines 1 and 2 and the delete statment will not delete any records...

endif.

Hope this helps .. let me know if its not clear

Thanks

Mahesh

8 REPLIES 8
Read only

Former Member
0 Likes
860

HI,

Loop at itab.

*--Write logic to get the selected records and store it in jtab. (Hope this logic is already in place with you)

put them into jtab.

endloop.

ktab[] = jtab[]. " Ktab to get the seleted records

sort table jtab by KUNNR, VKORG, VTWEG, SPART .

delete adjacent duplicates from jtab comparing VKORG, VTWEG, SPART .

describe table jtab lines v_lines.

and now your condition.

with your requirment.

if lv_lines is 1 then it indicates that you have selected lines 1 and 3 and in delete command it got deleted only one left as they have same values.

else

here you have selected lines 1 and 2 and the delete statment will not delete any records...

endif.

Hope this helps .. let me know if its not clear

Thanks

Mahesh

Read only

0 Likes
859

Hi Mahesh,

I do not want to delete any records. I want to get the data of the records if 4 0f 10 fields are same other wise go to else condition.

Thanks,

Neelu.

Read only

0 Likes
859

HI,

Check the code i have made a copy of all the selected records into ktab

ktab[] = jtab[]. "

I am just deleting to arrive to ur condition..

Ktab will have all the seleted records..

Thanks

Mahesh

Read only

0 Likes
859

Hi Mahesh,

Sorry for the confusion.

I want ktab[] to include only records with same VKORG,VTWEG,SPART and KUNNR.

Thanks,

Neelu.

Read only

0 Likes
859

HI,

See you have only two conditions..

1) when both seleted or same... then Ktab will only contian the same records

2) when both seleted or different.. ktab wil contain distinct records

irrespetive of what is seleted the thing that you were asking was if the seleted recrods or same or not if same do some thing with the seleted records if not same do some thing else with the seleted records.. right.

so Ktab will contain all the seleted records..

and i have taken jtab just to arrive to whether all of them or same or not.

This is what i have understood out of your post... let me know if you stil have prob....

Thanks

Mahesh

thanks

Mahesh

Read only

0 Likes
859

Hi Mahesh,

Yes. It is exactly my req.

So is the following logic correct.

Loop at itab.

*--logic to get the selected records and store it in jtab.

put them into jtab.

endloop.

ktab[] = jtab[].

sort table jtab by KUNNR, VKORG, VTWEG, SPART .

delete adjacent duplicates from jtab comparing VKORG, VTWEG, SPART .

describe table jtab lines v_lines.

if lv_lines = 1

then call function with ktab[].

else

EXIT

endif.

Thanks,

Neelu.

Read only

0 Likes
859

HI ,

cool.. njoy.

Thanks

Mahesh

Read only

0 Likes
859

Thank you Mahesh.

I really appriciate your help.

Regards,

Neelu.