Anda di halaman 1dari 5

DATA :lv_itemno TYPE i .

DATA : lv_count TYPE char12,


lv_ebelp TYPE char35,
lv_menge TYPE char35,
lv_ematn TYPE char35.
IF it_upo IS NOT INITIAL.
it_upo_item[] = it_upo[].
ENDIF.

LOOP AT it_upo INTO wa_upo.


wa_upo_head-ebeln = wa_upo-ebeln.
APPEND wa_upo_head TO it_upo_head.
CLEAR wa_upo_head.
ENDLOOP.

SORT it_upo_head.
DELETE ADJACENT DUPLICATES FROM it_upo_head.

LOOP AT it_upo_head INTO wa_upo_head.

REFRESH gt_bdcdata .

PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.


PERFORM bdc_field USING 'BDC_OKCODE'
'=MECHOB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO1319-MATKL'.
PERFORM bdc_field USING 'MEPO1319-EAN11'
'038548151014'.
PERFORM bdc_field USING 'MEPO1319-SPINF'
'X'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0002'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=MEOK'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO_SELECT-EBELN'.
PERFORM bdc_field USING 'MEPO_SELECT-EBELN'
wa_upo_head-ebeln. "'4500120041'.
PERFORM bdc_field USING 'MEPO_SELECT-BSTYP_F'
'X'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=MEV4000BUTTON'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO_TOPLINE-BSART'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=MEV4000BUTTON'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO1226-ZTERM'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=MEV4001BUTTON'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO_TOPLINE-BSART'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.

* For Multipe items


LOOP AT it_upo_item INTO wa_upo_item WHERE ebeln = wa_upo_head-ebeln.
lv_itemno = 10 + lv_itemno.
lv_count = 1 + lv_count.
CONDENSE lv_count.

CONCATENATE 'MEPO1211-MENGE' '(' lv_count ')' INTO lv_menge.


CONCATENATE 'MEPO1211-EBELP' '(' lv_count ')' INTO lv_ebelp.
CONCATENATE 'MEPO1211-EMATN' '(' lv_count ')' INTO lv_ematn.

PERFORM bdc_field USING 'BDC_CURSOR'


lv_menge ."'MEPO1211-MENGE(01)'.
PERFORM bdc_field USING lv_ebelp " 'MEPO1211-EBELP(01)'
lv_itemno ."'10'.
PERFORM bdc_field USING lv_ematn "'MEPO1211-EMATN(01)'
wa_upo_item-matnr . " '15101'.
PERFORM bdc_field USING lv_menge " 'MEPO1211-MENGE(01)'
wa_upo_item-
menge. " ' 78'.

ENDLOOP.

PERFORM bdc_field USING 'DYN_6000-LIST'


' 1'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
*perform bdc_field using 'BDC_CURSOR'
* 'MEPO1211-MENGE(02)'.
*perform bdc_field using 'MEPO1211-EBELP(02)'
* '20'.
*perform bdc_field using 'MEPO1211-EMATN(02)'
* '783'.
*perform bdc_field using 'MEPO1211-MENGE(02)'
* ' 89'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_field USING 'MEPO1319-EAN11'
'038548151014'.
PERFORM bdc_field USING 'MEPO1319-SPINF'
'X'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO1222-EKORG'.
PERFORM bdc_field USING 'MEPO1222-EKORG'
'1000'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_field USING 'MEPO1319-EAN11'
'038548151014'.
PERFORM bdc_field USING 'MEPO1319-SPINF'
'X'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO1222-EKGRP'.
PERFORM bdc_field USING 'MEPO1222-EKORG'
'1000'.
PERFORM bdc_field USING 'MEPO1222-EKGRP'
'005'.
PERFORM bdc_field USING 'MEPO1222-BUKRS'
'1000'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_field USING 'MEPO1319-EAN11'
'038548151014'.
PERFORM bdc_field USING 'MEPO1319-SPINF'
'X'.
PERFORM bdc_dynpro USING 'SAPLMEGUI' '0014'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=MESAVE'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BSART'
'NB'.
PERFORM bdc_field USING 'MEPO_TOPLINE-SUPERFIELD'
'10000 CITY OF FAIRFIELD'.
PERFORM bdc_field USING 'MEPO_TOPLINE-BEDAT'
'03/22/2016'.
PERFORM bdc_field USING 'MEPO1222-EKORG'
'1000'.
PERFORM bdc_field USING 'MEPO1222-EKGRP'
'005'.
PERFORM bdc_field USING 'MEPO1222-BUKRS'
'1000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MEPO1211-NAME1(01)'.
PERFORM bdc_field USING 'DYN_6000-LIST'
' 1'.
PERFORM bdc_field USING 'MEPO1319-EAN11'
'038548151014'.
PERFORM bdc_field USING 'MEPO1319-SPINF'
'X'.
PERFORM bdc_dynpro USING 'SAPLSPO2' '0101'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=OPT1'.

PERFORM upo_call.

CLEAR : lv_count,lv_itemno.
ENDLOOP.

REFRESH : it_upo_head,it_upo_item,it_upo.