Application Development 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: 

Loop at

Former Member
0 Kudos

Hi guys,

I have to search partner who have sales contract.

In order to do that i have a Partner number (id) and tables and... ABAP !

With "id" i have to find sales contract. The method is the following one :

in table CRMD_PARTNER, PARTNER_NO = "id".

But many records exist with PARTNER_NO = "id" with an interesting field : guid with is the number of object (sales contract, opportunity, ...).

(for example :

guid g1 ... partner_no "id"

guid g2 ... partner_no "id"

guid g3 ... partner_no "id"

guid g4 ... partner_no "id"

)

So i have to look at CRMD_LINK with GUID_SET = guid if the object is an sales contract.

So my problem is toi use "LOOP AT" in order to verify for each object if one of them is a sales contract.

Points will be assigned...

Best cheers,

Vince.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I create an internal table itab :

TYPES : begin of wat,

gwaf type crmd_partner-guid,

end of wat.

DATA : wa type wat.

DATA : itab like table of wa.

i try to put into itab all entries from CRMD_PARTNER where partner_no = "id" with :

select guid

into corresponding fields of table itab

from crmd_partner

where partner_no = 'id'.

I don't understand why, but itab contains the good number of records but "itab-gwaf" is allways empty !!!

for example :

in CRMD_PARTNER :

guid g1 ... partner_no "id"

guid g2 ... partner_no "id"

guid g3 ... partner_no "id"

guid g4 ... partner_no "id"

and in my itab after the "SELECT" :

gwaf 00000000

gwaf 00000000

gwaf 00000000

gwaf 00000000

do you know why ?

6 REPLIES 6

Former Member
0 Kudos

data: begin of wa,

pno type crmd_partner-partner_no,

end of wa.

data: itab like table of wa.

SELECT p~partner_no

INTO CORRESPONDING FIELDS OF TABLE itab

FROM ( crmd_partner AS p

INNER JOIN crmd_link AS s ON pguid = sguid_set)

former_member624107
Contributor
0 Kudos

According to my understanding u hav an internal table with fileds partner id, guid etc...

n der can b same partner ids repeating with diff guid value..

u want to select row with guid = sales oredr.

if this is the case u can use the following code format

sort itab by partner id.

loop at itab into wa1_itab.

at new partner id.

loop at itab into wa2_itab where partnet id = wa1_itab-parner id.

if wa2_itab-guid = sales oredr.

move to another itab3.

endif.

endloop.

endat.

endloop.

hop this wil help u

Former Member
0 Kudos

Hi Vince,

Create an internal table (ITAB) with Fields Partner ID, GUID, GUID_SET.

Move all the entries in table CRMD_PARTNER for all the partner IDs to ITAB.

Select on CRMD_LINK for all entries in ITAB into ITAB2 (same strcuture of ITAB).

ITAB2 will hold your sales contracts.

Hope it helps.

Lokesh

Message was edited by:

Lokesh Aggarwal

Former Member
0 Kudos

I create an internal table itab :

TYPES : begin of wat,

gwaf type crmd_partner-guid,

end of wat.

DATA : wa type wat.

DATA : itab like table of wa.

i try to put into itab all entries from CRMD_PARTNER where partner_no = "id" with :

select guid

into corresponding fields of table itab

from crmd_partner

where partner_no = 'id'.

I don't understand why, but itab contains the good number of records but "itab-gwaf" is allways empty !!!

for example :

in CRMD_PARTNER :

guid g1 ... partner_no "id"

guid g2 ... partner_no "id"

guid g3 ... partner_no "id"

guid g4 ... partner_no "id"

and in my itab after the "SELECT" :

gwaf 00000000

gwaf 00000000

gwaf 00000000

gwaf 00000000

do you know why ?

0 Kudos

select guid from crmd_partner into table itab where partner_no = 'id'.

0 Kudos

Ok it works.

thanks for help.

Points are assigned...

Cheers,

Vince.