2014 Apr 30 2:19 PM
Hello Experts,
I am trying to determine the equipment that resides in all the work centers for a particular organization. I have successfully worked it out to find the list of work centers managed by a parent organization. BUT, when I try to loop on that resulting list to find out the work centers under each of the child work centers, I am getting stuck.
The function '/ISDFPS/GENTAB_GET_RELATIONS' works fine by itself but inside this loop something is not working for me. Only one child object for each organization (I_CRHD-HROID) is populating the internal table, instead of the full list.
The internal table I_ZCRHD_FORCE-ZOBJID is only getting populated with one result per object in I-CRHD instead of all of the results for each object. Therefore when I try to find out the work centers in the second loop, I don't have all of the organizations I need.
Any advice would be greatly appreciated!
LOOP AT I_CRHD.
CALL FUNCTION '/ISDFPS/GENTAB_GET_RELATIONS'
EXPORTING
" PLVAR = '01'
OTYPE = 'O'
OBJID = I_CRHD-HROID
RSIGN = 'B'
RELAT = '002'
SCLAS = 'O'
BEGDA = '19000101'
ENDDA = '99991231'
SVECT = '1234'
OPEXFLAG = 'X'
REFRESH = 'X'
TABLES
DISP_TAB = I_DISP_TAB_2
RELAT_TAB = I_RELAT_TAB_2
EXCEPTIONS
NO_ACTIVE_PLVAR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
"""tring to keep a list of each work center that exists under each organization in the I_CRHD internal table
I_ZCRHD_FORCE-ZOBJID = I_DISP_TAB_2-OBJID.
APPEND I_ZCRHD_FORCE.
ENDLOOP.
LOOP AT I_ZCRHD_FORCE.
CALL FUNCTION '/ISDFPS/FORCE_MNWKCTR'
EXPORTING
IV_OBJID = I_ZCRHD_FORCE-Zobjid
* IV_PLVAR =
IMPORTING
ES_CRHD = I_CRHD_2
ENDLOOP.
2014 Apr 30 2:25 PM
Hi,
it looks you are not loop thru table( I_DISP_TAB_2) output from Function,
Loop at this table & place this 2 statments in that loop.
I_ZCRHD_FORCE-ZOBJID = I_DISP_TAB_2-OBJID.
APPEND I_ZCRHD_FORCE.
This should fix your problem
Raj Patel
2014 Apr 30 2:25 PM
Hi,
it looks you are not loop thru table( I_DISP_TAB_2) output from Function,
Loop at this table & place this 2 statments in that loop.
I_ZCRHD_FORCE-ZOBJID = I_DISP_TAB_2-OBJID.
APPEND I_ZCRHD_FORCE.
This should fix your problem
Raj Patel
2014 Apr 30 2:40 PM
2014 Apr 30 2:35 PM
Hi,
I_DISP_TAB_2 is a table in your example. When you want to use the table entries then you must loop through that table. But you are simply trying to assign the value of WA I_DISP_TAB_2.
If it is a table with header line then I_DISP_TAB_2 means just workarea. But I_DISP_TAB_2[] means the contents in that table. So Please check if you are getting all the entries in the table I_DISP_TAB_2[] in debugging. If you are getting then you just need to loop through that table to append it to different table.
Regards,
Aswath.
2014 Apr 30 2:41 PM
Looks like you are also correct. Thank you for your help as well sir.