In script we have to write the perform to get the value from outside.
PERFORM DETEMINE_PHONE IN PROGRAM ZF150_DUNN_02
USING &T001-BUKRS&
CHANGING &ADRC-TEL_NUMBER&
ENDPERFORM
Related code:
REPORT zf150_dunn_02.
DATA: v_bukrs TYPE bukrs,
v_adrnr TYPE ad_addrnum,
v_telno TYPE ad_tlnmbr1.
CLEAR sy-subrc.
*&---------------------------------------------------------------------*
*& Form detemine_phone
*&---------------------------------------------------------------------*
* To determine telephone no from ADRC
*----------------------------------------------------------------------*
FORM detemine_phone TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA: wa_in_tab LIKE LINE OF in_tab,
wa_out_tab LIKE LINE OF out_tab.
CLEAR: wa_in_tab,
wa_out_tab.
READ TABLE in_tab INTO wa_in_tab WITH KEY name = 'T001-BUKRS'.
IF sy-subrc EQ 0.
CLEAR sy-subrc.
v_bukrs = wa_in_tab-value.
ENDIF.
SELECT SINGLE adrnr FROM t001 INTO v_adrnr WHERE bukrs = v_bukrs.
IF sy-subrc EQ 0.
CLEAR sy-subrc.
SELECT SINGLE tel_number FROM adrc INTO v_telno WHERE addrnumber = v_adrnr.
IF sy-subrc EQ 0.
CLEAR sy-subrc.
READ TABLE out_tab INTO wa_out_tab WITH KEY name = 'ADRC-TEL_NUMBER'.
IF sy-subrc EQ 0.
MOVE v_telno TO wa_out_tab-value.
MODIFY out_tab FROM wa_out_tab INDEX sy-tabix .
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "detemine_phone
DATA: v_bukrs TYPE bukrs,
v_adrnr TYPE ad_addrnum,
v_telno TYPE ad_tlnmbr1.
CLEAR sy-subrc.
*&---------------------------------------------------------------------*
*& Form detemine_phone
*&---------------------------------------------------------------------*
* To determine telephone no from ADRC
*----------------------------------------------------------------------*
FORM detemine_phone TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA: wa_in_tab LIKE LINE OF in_tab,
wa_out_tab LIKE LINE OF out_tab.
CLEAR: wa_in_tab,
wa_out_tab.
READ TABLE in_tab INTO wa_in_tab WITH KEY name = 'T001-BUKRS'.
IF sy-subrc EQ 0.
CLEAR sy-subrc.
v_bukrs = wa_in_tab-value.
ENDIF.
SELECT SINGLE adrnr FROM t001 INTO v_adrnr WHERE bukrs = v_bukrs.
IF sy-subrc EQ 0.
CLEAR sy-subrc.
SELECT SINGLE tel_number FROM adrc INTO v_telno WHERE addrnumber = v_adrnr.
IF sy-subrc EQ 0.
CLEAR sy-subrc.
READ TABLE out_tab INTO wa_out_tab WITH KEY name = 'ADRC-TEL_NUMBER'.
IF sy-subrc EQ 0.
MOVE v_telno TO wa_out_tab-value.
MODIFY out_tab FROM wa_out_tab INDEX sy-tabix .
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "detemine_phone
No comments:
Post a Comment