Code: Alles auswählen.
DATA : it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
wa_bdcdata TYPE bdcdata,
it_bdcmsgcoll TYPE TABLE OF bdcmsgcoll.
LOOP AT pt_knvk.
REFRESH it_bdcdata.
PERFORM bdc_dynpro USING 'SAPMF02K' '0380'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNVK-NAME1'
pt_knvk-name1.
PERFORM bdc_field USING 'KNVK-NAMEV'
pt_knvk-namev.
PERFORM bdc_field USING 'KNVK-ANRED'
pt_knvk-anred.
PERFORM bdc_field USING 'KNVK-ABTNR'
pt_knvk-abtnr.
PERFORM bdc_field USING 'KNVK-PAFKT'
pt_knvk-pafkt.
PERFORM bdc_field USING 'KNVK-TELF1'
pt_knvk-telf1.
** PERFORM bdc_transaction USING 'XK02'.
CALL TRANSACTION 'XK02' USING it_bdcdata
MESSAGES INTO it_bdcmsgcoll.
ENDLOOP.
Code: Alles auswählen.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
CLEAR it_bdcdata.
it_bdcdata-program = program.
it_bdcdata-dynpro = dynpro.
it_bdcdata-dynbegin = 'X'.
APPEND it_bdcdata.
ENDFORM. "bdc_dynpro
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
CLEAR it_bdcdata.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
APPEND it_bdcdata.
ENDFORM. "bdc_field
Code: Alles auswählen.
DATA : it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
it_bdcmsgcoll TYPE TABLE OF bdcmsgcoll.
LOOP AT pt_knvk.
REFRESH it_bdcdata.
PERFORM bdc_dynpro USING 'SAPMF02K' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
* PERFORM bdc_field USING 'RF02K-LIFNR'
* pt_knvk-lifnr.
PERFORM bdc_dynpro USING 'SAPMF02K' '0111'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0380'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNVK-NAME1'
pt_knvk-name1.
PERFORM bdc_field USING 'KNVK-NAMEV'
pt_knvk-namev.
PERFORM bdc_field USING 'KNVK-ANRED'
pt_knvk-anred.
PERFORM bdc_field USING 'KNVK-ABTNR'
pt_knvk-abtnr.
PERFORM bdc_field USING 'KNVK-PAFKT'
pt_knvk-pafkt.
PERFORM bdc_field USING 'KNVK-TELF1'
pt_knvk-telf1.
CALL TRANSACTION 'XK02' USING it_bdcdata
MESSAGES INTO it_bdcmsgcoll.
ENDLOOP.
ENDFORM. " zzaddresscontpart_create1
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
CLEAR it_bdcdata.
it_bdcdata-program = program.
it_bdcdata-dynpro = dynpro.
it_bdcdata-dynbegin = 'X'.
APPEND it_bdcdata.
ENDFORM. "bdc_dynpro
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
CLEAR it_bdcdata.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
APPEND it_bdcdata.
ENDFORM. "bdc_field
Code: Alles auswählen.
FORM zzaddresscontpart_create1
TABLES pt_knvk STRUCTURE knvk
pt_return STRUCTURE bapiret2
USING ps_rf02k TYPE rf02k
ps_wrf02k TYPE wrf02k.
DATA : it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
it_bdcmsgcoll TYPE TABLE OF bdcmsgcoll.
LOOP AT pt_knvk.
REFRESH it_bdcdata.
PERFORM bdc_dynpro USING 'SAPMF02K' '0101'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02K-LIFNR'
ps_rf02k-lifnr.
PERFORM bdc_field USING 'RF02K-EKORG'
ps_rf02k-ekorg.
PERFORM bdc_field USING 'WRF02K-D0380'
ps_wrf02k-d0380.
PERFORM bdc_dynpro USING 'SAPMF02K' '0380'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNVK-ANRED'
pt_knvk-anred.
PERFORM bdc_field USING 'KNVK-NAMEV'
pt_knvk-namev.
PERFORM bdc_field USING 'KNVK-NAME1'
pt_knvk-name1.
PERFORM bdc_field USING 'KNVK-TELF1'
pt_knvk-telf1.
PERFORM bdc_field USING 'KNVK-ABTNR'
pt_knvk-abtnr.
PERFORM bdc_field USING 'KNVK-PAFKT'
pt_knvk-pafkt.
CALL TRANSACTION 'XK02' USING it_bdcdata
MESSAGES INTO it_bdcmsgcoll.
ENDLOOP.
ENDFORM.
Code: Alles auswählen.
FUNCTION ZZADDRESSCONTPART_CREATE.
perform zzaddresscontpart_create1 tables t_knvk
t_customer_fields
t_customer_field
t_idocctrl
t_return
using i_rf02k
i_wrf02k.
ENDFUNCTION.