SAP/ABAP

BAPI/FM to get equipment / funct. location task list

그녀는애교쟁이 2013. 1. 24. 07:56
Note to the coding
- create a structure with whatever fields you need from EAPL/TAPL for es_tasklist
- create a structure with whatever fields you need from PLPO for et_task
* convert to internal format
  call function 'CONVERSION_EXIT_ALPHA_INPUT'
    exporting
      input  = iv_equnr
    importing
      output = lv_equnr.

* get takslist "header" - EAPL or TAPL *********************************
 if lv_equnr is not initial.
    select single * from eapl
           into corresponding fields of es_tasklist
           where equnr = lv_equnr.
* in case no tasklist was found, set error with 'equipment'
    lv_errtext  = text-013. 
    lv_errvalue = iv_equnr.
  elseif iv_tplnr is not initial.
    select single * from tapl
           into corresponding fields of es_tasklist
           where tplnr = iv_tplnr.
* in case no tasklist was found, set error with 'funct. location'
    lv_errtext  = text-014. 
    lv_errvalue = iv_tplnr.
  endif.

* check if an tasklist exists
  if es_tasklist is initial.
    ls_return-type = 'E'.
    concatenate text-012 lv_errtext lv_errvalue text-050
      into ls_return-message
      separated by space.
    append ls_return to et_return.
    exit.
  endif.

* get text of tasklist group - PLKO ************************************
  select single ktext from plko
         into es_tasklist-ktext
         where plnty = es_tasklist-plnty
         and   plnnr = es_tasklist-plnnr
         and   txtsp = sy-langu.
  " if no text was found with sy-langu...
  if sy-subrc <> 0.
    "...try without
    select single ktext from plko
           into es_tasklist-ktext
           where plnty = es_tasklist-plnty
           and   plnnr = es_tasklist-plnnr.
  endif.

* get tasks of tasklist - PLPO *****************************************
  select * from plpo
         into corresponding fields of table et_tasks
         where plnty = es_tasklist-plnty
         and   plnnr = es_tasklist-plnnr
         order by vornr.

* get production group for each task
  loop at et_tasks assigning <lf_task>.
    call function 'CR_WORKSTATION_READ'
      exporting
        id        = <lf_task>-arbid
      importing
        arbpl     = <lf_task>-arbpl
      exceptions
        not_found = 1
        others    = 2.
  endloop.

반응형

'SAP > ABAP' 카테고리의 다른 글

ALV Grid 색상표  (0) 2013.09.03
CR 소유자 변경  (0) 2013.08.27
Abap Syntax  (0) 2013.08.27
Comparison Operators : 비교 연산자  (0) 2013.08.27
스크린 페이터에 금액 필드 마이너스 입력  (0) 2013.08.27
데이터 그리드 형태 변경  (1) 2013.08.27
상단 메뉴 분리자 라인  (0) 2013.08.27
Source Scan : 소스 키워드 검색 프로그램  (0) 2013.08.27
많이 쓰이는 Transaction Code  (0) 2013.08.27
PPE Start Page 설정  (0) 2013.04.22