‎2012 Jan 10 11:48 PM
Hi all,
I need to make some changes in FM.To determine the users in a work center and add them to the list of approvers.
I am able to see all Workcenter userid during debugging.Something I am doing wrong,not getting displayed while running the application.
Here is my code:
TYPES: BEGIN OF T_DATA,
OTYPE TYPE PLOG-OTYPE,
OBJID TYPE PLOG-OBJID,
END OF T_DATA.
DATA: LT_DATA TYPE TABLE OF T_DATA,
LS_DATA TYPE T_DATA.
DATA:LT_WDAT TYPE TABLE OF WPLOG,
LS_WDAT TYPE WPLOG.
************
WHEN 'A'.
select OTYPE OBJID from HRP1001 into table lt_data
where OTYPE = 'A'.
LOOP AT lt_data into ls_data.
CALL FUNCTION 'RH_FETCH_DATA'
EXPORTING
AEDTM = '00000000'
BEGDA = '19000101'
ENDDA = '99991231'
HISTO = '%'
INFTY = '1001'
ISTAT = '1'
OBJID = LS_DATA-OBJID
OTYPE = 'A'
PLVAR = '01'
TABLES
DATA = LT_WDAT
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
ENDLOOP.
IF SY-SUBRC <> 0.
APPEND ls_data TO lt_wdat.
ENDIF.
Thanks
Kiran
*
‎2012 Jan 11 12:03 AM
yes 2 -3 things might be going wrong...
TYPES: BEGIN OF T_DATA,
OTYPE TYPE PLOG-OTYPE,
OBJID TYPE PLOG-OBJID,
END OF T_DATA.
DATA: LT_DATA TYPE TABLE OF T_DATA,
LS_DATA TYPE T_DATA.
DATA:LT_WDAT TYPE TABLE OF WPLOG,
LS_WDAT TYPE WPLOG,
LT_TEMP_WDAT type table of WPLOG. "-======> added this
************
WHEN 'A'.
select OTYPE OBJID from HRP1001 into table lt_data
where OTYPE = 'A'.
LOOP AT lt_data into ls_data.
clear : LT_TEMP_WDAT. "=============>added this
CALL FUNCTION 'RH_FETCH_DATA'
EXPORTING
* AEDTM = '00000000'
BEGDA = '19000101'
ENDDA = '99991231'
* HISTO = '%'
INFTY = '1001'
ISTAT = '1'
OBJID = LS_DATA-OBJID
OTYPE = 'A'
PLVAR = '01'
TABLES
DATA = LT_TEMP_WDAT "LT_WDAT ==>changed this
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0. "=====>taken this inside
APPEND ls_data TO lt_wdat.
ELSE."=========> added these
append lines of LT_TEMP_WDAT to LT_WDAT.
clear LT_TEMP_WDAT.
ENDIF.
ENDLOOP.
"IF SY-SUBRC <> 0. =====>removed these
"
"APPEND ls_data TO lt_wdat.
"ENDIF.
‎2012 Jan 11 12:21 AM
Thanks Som!
Still I am not display to display for workcenter id's.
Please give me some idea why it is not working.or I need to attach this to field catalog to display?
‎2012 Jan 11 12:24 AM
‎2012 Jan 11 12:33 AM
Here is the full code:(Bold section or the previous code I posted is done by me)(I think problem in displaying data:
SELECT * FROM ydm_apprfunction INTO TABLE it_apprfunction
WHERE case_type = case_type.
LOOP AT it_approver INTO is_approver.
i_index = i_index + 1.
READ TABLE it_apprfunction INTO is_apprfunction
WITH KEY function = is_approver-function.
IF sy-subrc = 0.
is_processor-index = i_index.
CASE is_apprfunction-func_type.
WHEN 'US'.
Approver UserID available
is_processor-uname = is_apprfunction-func_name.
CALL FUNCTION 'BN_USER_FETCH'
EXPORTING
input = is_processor-uname
IMPORTING
vollname = is_processor-name
TABLES
user = lt_user
EXCEPTIONS
entry_incorrect = 1
id_not_exist = 2
no_entry = 3
user_locked = 4
user_not_exist = 5
OTHERS = 6.
IF sy-subrc = 0.
APPEND is_processor TO it_processor.
ENDIF.
WHEN 'FU'.
Approver must be determined via function module
CALL FUNCTION is_apprfunction-func_name
EXPORTING
guid = i_guid
IMPORTING
userid = is_processor-uname
name = is_processor-name
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
APPEND is_processor TO it_processor.
ENDIF.
WHEN 'A'.
is_processor-uname = is_apprfunction-func_name.*
select OTYPE OBJID from HRP1001 into table lt_data
where OTYPE = 'A'.
LOOP AT lt_data into ls_data.
CLEAR : LT_TEMP_WDAT.
CALL FUNCTION 'RH_FETCH_DATA'
EXPORTING
AEDTM = '00000000'*
BEGDA = '19000101'
ENDDA = '99991231'
HISTO = '%'*
INFTY = '1001'
ISTAT = '1'
OBJID = ls_data-objid
OTYPE = 'A'
PLVAR = '01'
TABLES
DATA = LT_TEMP_WDAT
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
APPEND ls_data TO lt_wdat.
ELSE.
APPEND LINES OF lt_temp_wdat to lt_wdat.
CLEAR lt_wdat.
APPEND is_processor TO it_processor.*
ENDIF.
ENDLOOP.
ENDCASE.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT it_approve INTO is_approve.
MOVE-CORRESPONDING is_approve TO is_processor.
APPEND is_processor TO it_processor.
ENDLOOP.
*
ENDIF.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZDM_APPROVERS'
CHANGING
ct_fieldcat = it_fieldcatalog
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
SORT it_processor BY uname.
‎2012 Jan 11 3:45 AM
kiram,
after appending you are clearing lt_wda 😛
where will the data get stored?
more over, if you want to display wl_wda in final table, you filed catalog should also be filled with field names from this lt_wda. just check that one as well...