Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fahridon/6e160fa57dfc7be9634349852b22464f to your computer and use it in GitHub Desktop.
Save fahridon/6e160fa57dfc7be9634349852b22464f to your computer and use it in GitHub Desktop.
DATA: lv_matnr LIKE mara-matnr.
DATA: lv_werks LIKE mapl-werks,
lwa_matpl TYPE maplb,
lit_matpl TYPE TABLE OF maplb,
lwa_opr TYPE capp_opr,
lit_opr TYPE TABLE OF capp_opr,
lv_arbpl LIKE rcr01-arbpl.
lv_matnr = 'CAN21K'.
lv_werks = '1100'.
CALL FUNCTION 'CP_DB_MAPL_READ'
EXPORTING
datub = sy-datum
datuv = sy-datum
matnr = lv_matnr
werks = lv_werks
TABLES
matpl = lit_matpl
EXCEPTIONS
no_records = 1
OTHERS = 2.
IF sy-subrc <> 0.
ELSE.
READ TABLE lit_matpl INTO lwa_matpl INDEX 1.
ENDIF.
CALL FUNCTION 'CARO_ROUTING_READ'
EXPORTING
plnty = lwa_matpl-plnty
plnnr = lwa_matpl-plnnr
plnal = lwa_matpl-plnal
TABLES
opr_tab = lit_opr
EXCEPTIONS
not_found = 1
ref_not_exp = 2
not_valid = 3
OTHERS = 4.
IF sy-subrc <> 0.
ELSE.
READ TABLE lit_opr INTO lwa_opr INDEX 1.
ENDIF.
CALL FUNCTION 'CR_WORKSTATION_READ'
EXPORTING
id = lwa_opr-arbid
IMPORTING
arbpl = lv_arbpl
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ELSE.
WRITE: lv_arbpl.
ENDIF.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment