Application Development and Automation 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: 
Read only

Function location

Former Member
0 Likes
763

Hi All,

Is there is any function module or BAPI for function location hierarchy (PM).Actually my requirement is to show all the function locations of a specified user as a hierarchy.

Thanks&regds,

Srinivas.

1 REPLY 1
Read only

Former Member
0 Likes
345

Hi

try this code for Fn. Location---

reward if help.

REPORT zpm_functional_location_upload

NO STANDARD PAGE HEADING

LINE-SIZE 255.

  • Standard Include for Selection Screen

INCLUDE bdcrecx1.

  • Internal Table for Upload Data

DATA: BEGIN OF i_fun_loc OCCURS 0,

strno(040), " Fun Location Label

tplkz(005), " StrIndicator

fltyp(001), " Fun Location Category

  • General Data

pltxt(040), " Description

eqart(010), " Object Type

  • Location Data

swerk(004), " Maintenance Plant

msgrp(008), " Room

beber(003), " Plant Section

abckz(001), " ABC indicator

eqfnr(030), " Sort Field

  • Organization data

bukrs(004), " Company Code

kostl(010), " Cost Center

iwerk(004), " Planning Plant

ingrp(003), " Planner Group

gewrk(008), " Main Work Center

wergw(004), " Plant(Work Center)

rbnr(009), " Catalog Profile

END OF i_fun_loc.

  • Data Variables & Constants

CONSTANTS : c_x VALUE 'X'. " Flag

  • Parameters

PARAMETERS: p_file LIKE ibipparms-path. " Filename

  • At selection-screen on Value Request for file Name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • Get the F4 Values for the File

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

  • Start of Selection

START-OF-SELECTION.

  • Open the BDC Session

PERFORM open_group.

  • Upload the File into internal Table

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = i_fun_loc

EXCEPTIONS

conversion_error = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

OTHERS = 7.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Upload the Data from Internal Table

LOOP AT i_fun_loc.

PERFORM bdc_dynpro USING 'SAPMILO0' '1110'.

PERFORM bdc_field USING 'BDC_CURSOR'

'IFLOS-STRNO'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'IFLOS-STRNO'

i_fun_loc-strno.

PERFORM bdc_field USING 'RILO0-TPLKZ'

i_fun_loc-tplkz.

PERFORM bdc_field USING 'IFLO-FLTYP'

i_fun_loc-fltyp.

  • General Data

PERFORM bdc_dynpro USING 'SAPMILO0' '2100'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=T\02'.

PERFORM bdc_field USING 'IFLO-PLTXT'

i_fun_loc-pltxt.

PERFORM bdc_field USING 'BDC_CURSOR'

'ITOB-EQART'.

PERFORM bdc_field USING 'ITOB-EQART'

i_fun_loc-eqart.

  • Location Data

PERFORM bdc_dynpro USING 'SAPMILO0' '2100'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=T\03'.

PERFORM bdc_field USING 'BDC_CURSOR'

'ITOB-EQFNR'.

PERFORM bdc_field USING 'ITOB-SWERK'

i_fun_loc-swerk.

PERFORM bdc_field USING 'ITOB-MSGRP'

i_fun_loc-msgrp.

PERFORM bdc_field USING 'ITOB-BEBER'

i_fun_loc-beber.

PERFORM bdc_field USING 'ITOB-ABCKZ'

i_fun_loc-abckz.

PERFORM bdc_field USING 'ITOB-EQFNR'

i_fun_loc-eqfnr.

  • Organization Data

PERFORM bdc_dynpro USING 'SAPMILO0' '2100'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_field USING 'ITOB-BUKRS'

i_fun_loc-bukrs.

PERFORM bdc_field USING 'ITOB-KOSTL'

i_fun_loc-kostl.

PERFORM bdc_field USING 'BDC_CURSOR'

'ITOB-RBNR'.

PERFORM bdc_field USING 'ITOB-IWERK'

i_fun_loc-iwerk.

PERFORM bdc_field USING 'ITOB-INGRP'

i_fun_loc-ingrp.

PERFORM bdc_field USING 'ITOBATTR-GEWRK'

i_fun_loc-gewrk.

PERFORM bdc_field USING 'ITOBATTR-WERGW'

i_fun_loc-wergw.

PERFORM bdc_field USING 'ITOB-RBNR'

i_fun_loc-rbnr.

  • Call The Transaction

PERFORM bdc_transaction USING 'IL01'.

ENDLOOP.

  • Close the BDC Session

PERFORM close_group.