Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8150

ABAP- internal table looping

$
0
0

Hi All,

 

I am having a scenario where for different values of PERSON i want the inner loop to run based on the condition present in inner loop.

If there are multiple values of PART_REF for a given PERSON, I want all of them to be displayed along with their respective job family.

 

Example:

 

PERSON     PART_REF

101              ABC

101              DEF

102              PQR

102              XYZ

 

PART_REF   JOB_FAMILY

 

ABC             201

DEF             202

PQR             301

XYZ              302

 

Current Output:                                Required Output:

 

PERSON   JOB_FAMILY                  PERSON   JOB_FAMILY

101            202                                  101             201

102            302                                   101            202

                                                         102             301

                                                          102            302

 

 

 

Below is code by which i am able to display only last value of part_ref along with its job_family.

 

LOOP AT i_A INTO wa_A where PERSON = SOURCE_FIELDS-PERSON.


LOOP AT i_B INTO wa_B WHERE PART_REF = wa_A-PART_REF.


  if sy-subrc = 0.
RESULT = wa_B-Job_Family.
else.
RESULT = 'blank'.
endif.


clear wa_B.


ENDLOOP.


clear wa_A.


endloop.

 

Thanks,

Tanvi


Viewing all articles
Browse latest Browse all 8150

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>