Hi Experts,
I am in process of writing a logic for user exit variable in CMOD,As I am not expert in ABAP struggling to implement the logic to meet the requirement…probably to meet the requirement need to execute Loop inside loop….Please advise logic to define to meet below requirement
This user exit variable is created on 0PROFIT_CTR
IF i_vnam = 'ZXXXXXX'.
LV_USER = SY-UNAME.
*Get the data from ZPCTRUSER Master Data Table for Relevant User
*This is the table consists to which Node a User is Authorized
SELECT /BIC/ZPCTRUSER
INTO TABLE IT_STORES
FROM /BIC/MZPCTRUSER
WHERE /BIC/ZUSERNAME = LV_USER AND
/BIC/ZPCTRUSER <> ' ' AND
( DATEFROM <= SY-DATUM AND DATETO >= SY-DATUM ).
IF SY-SUBRC = 0 AND NOT IT_STORES IS INITIAL.
*Get the data from Profit Centre Master Data Table
SELECT * FROM /BI0/MPROFIT_CTR
INTO TABLE IT_TPCTR
WHERE PROFIT_CTR <> ' ' AND
OBJVERS = 'A' AND
( DATEFROM <= SY-DATUM AND DATETO >= SY-DATUM ).
At this point both IT_STORES and IT_TPCTR are filled with data.
Requirement
IT_TPCTR is an internal table similar to structure of 0PROFIT_CTR and filed with all valid Profit Centre Master Data in the above select statement, Consists of fields Business Segment(L1),Sub segment(L2),Contract(L3),Business Site(L4), Managing Directory(L5), Regional MD (L6) ,Account Director(L7) & Account Manager(L8).
Now requirement is fill another Internal table IT_XYZ with profit centre values by reading IT_TPCTR for each entry in IT_STORES and pass it to variable - L_S_RANGE-LOW and where
Read IT_TPCTR-Business Segment (L1) = IT_STORES-/BIC/ZPCTRUSER
If entries found fill IT_XYZ
Read IT_TPCTR- Sub segment(L2) = IT_STORES-/BIC/ZPCTRUSER
If entries found fill IT_XYZ
Read IT_TPCTR- Contract(L3) = IT_STORES-/BIC/ZPCTRUSER
If entries found fill IT_XYZ and then
.
.
.
Read IT_TPCTR- Account Manager (L8) = IT_STORES-/BIC/ZPCTRUSER
If entries found fill IT_XYZ and then
(Total 8 Reads, The read has to be performed irrespective of entries found or not found…if found then keep on filling IT_XYZ) and finally pass the Profit centre values to variable - L_S_RANGE-LOW
Please advise.
Thanks in advance