Skip to Content
0
Former Member
May 09, 2008 at 07:40 AM

Urgent: Need to Page Down on a Table Control for BDC Recording

394 Views

Hi Gurus,

I am facing a problem in CRM transaction COMMPR01. I am trying to create Services of Category 'SRV_ALL' and I need to assign a Sales Org to the service. A table control sub-screen pops up and I need to select one of the Sales Orgs on display. But I have to scroll down and select the relevant Sales Org. But the BDC does not capture any ok_code for the Page Down and there is no button for it.

When I record the transaction, an empty Ok_code comes in which doesn't work while processing the same recording.

Can any of you guys help me in this regard?

This is the code I'm using:

*---------------------------------------------------------------------*
*                     Form  FILL_BDC_TABLE
*---------------------------------------------------------------------*
*         Fill the BDC table with the contents from record
*---------------------------------------------------------------------*
FORM fill_bdc_table .

* Local Constants - Screen related (OKcode/ScreenNumber/Program-name/
  CONSTANTS: l_c_okcode    TYPE c LENGTH 10 VALUE 'BDC_OKCODE'               ,   " BDC Okcode
             l_c_enter     TYPE c LENGTH 06 VALUE '=ENTER'                   ,   " Enter
             l_c_entr      TYPE c LENGTH 05 VALUE '=ENTR'                    ,   " Enter
             l_c_select    TYPE c LENGTH 10 VALUE '=PRWB_C_02'               ,   " Select
             l_c_mark      TYPE c LENGTH 05 VALUE '=MARK'                    ,   " Select All Sales Org
             l_c_save      TYPE c LENGTH 10 VALUE '=PRWB_SAVE'               ,   " Save Services
             l_c_allow     TYPE c LENGTH 17 VALUE '=COM_PR_ORG_ALLOW'        ,   " Allow
             l_c_tab1      TYPE c LENGTH 12 VALUE '=TABREITER01'             ,   " SAP Basic Data tab
             l_c_tab2      TYPE c LENGTH 12 VALUE '=TABREITER02'             ,   " General Tab
             l_c_tab3      TYPE c LENGTH 12 VALUE '=TABREITER03'             ,   " Services Tab
*            { (+) DCEK902300
             l_c_pro_no    TYPE c LENGTH 25 VALUE 'COMM_PRODUCT-PRODUCT_ID'  ,   " Product External Number
             l_c_down      TYPE c LENGTH 03 VALUE '/00'                      ,   " Scroll Down by 1
*            } (+) DCEK902300
             l_c_sh_txt    TYPE c LENGTH 25 VALUE 'COMM_PRSHTEXT-SHORT_TEXT' ,   " Product Description
             l_c_program1  TYPE c LENGTH 15 VALUE 'SAPLBUS_LOCATOR'          ,   " Program Name for Product Workbench Screens
             l_c_program2  TYPE c LENGTH 26 VALUE 'SAPLCRM_CRMM_PR_SALESH_UI',   " Program Name for Selection of Sales Org Selector Screens
             l_c_scr_3000  TYPE c LENGTH 04 VALUE '3000'                     ,   " Screen 3000
             l_c_scr_0400  TYPE c LENGTH 04 VALUE '0400'                     .   " Screen 0400

* Local Constants - Screenfields
  CONSTANTS: l_c_category_id(25) TYPE c VALUE 'COMT_CATEGORY-CATEGORY_ID'               ,     " Category ID
             l_c_base_unit(32)   TYPE c VALUE 'COML_PR_BASE_UOM_UI-BASE_UOM_UI'         ,     " Base Unit of Measure of a Material
             l_c_duration(32)    TYPE c VALUE 'CRMT_CRMM_PR_SRVDUR_UI-DURATION'         ,     " Duration of Work
             l_c_unit_dur(35)    TYPE c VALUE 'CRMT_CRMM_PR_SRVDUR_UI-DURATION_UOM'     ,     " Unit for Duration of Work
             l_c_con_class(30)   TYPE c VALUE 'CRM_PR_UBB_SLS_DYNP_SV-FF0010'           ,     " Contract Class
             l_c_usg_fn_grp(30)  TYPE c VALUE 'CRM_PR_UBB_SLS_DYNP_SV-FF0011'           ,     " Usage Function Group
             l_c_pro_unit(40)    TYPE c VALUE 'CRMT_CRMM_PR_SALESA_UI-PROCESS_UNIT'     ,     " Unit of Measure in Which the Product Is Sold
             l_c_min_order(35)   TYPE c VALUE 'CRMT_CRMM_PR_SALESA_UI-MIN_ORDER'        ,     " Minimum Order Quantity in Base Unit of Measure
             l_c_min_ord_ui(35)  TYPE c VALUE 'CRMT_CRMM_PR_SALESA_UI-MIN_ORDER_UI'     ,     " Minimum Order Quantity Unit
             l_c_del_unit(32)    TYPE c VALUE 'CRMT_CRMM_PR_SALESA_UI-DELY_UNIT'        ,     " Delivery Unit
             l_c_undel(30)       TYPE c VALUE 'CRMT_CRMM_PR_SALESA_UI-UNDEL'            ,     " Unit of Measure of Delivery Unit
             l_c_s_it_cat(40)    TYPE c VALUE 'CRMT_CRMM_PR_SALESA_UI-S_ITEM_CAT_GROUP' ,     " Distribution-Chain-Dependent Item Category Group
             l_c_location(35)    TYPE c VALUE 'CRMT_CRMM_PR_SALESA_UI-LOC_BUPA'         ,     " Delivering Location
             l_c_item_cat(35)    TYPE c VALUE 'CRMT_CRMM_PR_BTR_UI-ITEM_CAT_GROUP'      ,     " Item Category Group
             l_c_language(35)    TYPE c VALUE 'COMT_PRSHTEXT_DYNPRO-LANGU_DESC(02)'     ,     " Language
             l_c_short_txt(35)   TYPE c VALUE 'COMT_PRSHTEXT_DYNPRO-SHORT_TEXT(02)'     ,     " Product Description
             l_c_country(35)     TYPE c VALUE 'CRMT_PR_TAX-TAX_CTY(01)'                 ,     " Country
             l_c_tax_type(35)    TYPE c VALUE 'CRMT_PR_TAX-TAX_TYPE(01)'                ,     " Tax Type
             l_c_taxgroup(35)    TYPE c VALUE 'CRMT_PR_TAX-TAX_GROUP(01)'               .     " Tax Group

* Refresh the table before populating it
  REFRESH i_bdc.
* Initial Screen
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.           " Initial screen for Product Workbench (COMMPR01)
  PERFORM bdc_field       USING l_c_okcode
                                l_c_select.                          " Select Services
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_enter.                           " Enter
  PERFORM bdc_field       USING l_c_category_id
                                is_file-category_id.                 " Category ID = SRV_ALL / SRV_GRND
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_allow.                           " Continue
* { (-) DCEK902300
*  PERFORM bdc_dynpro      USING l_c_program2 l_c_scr_0400.
*  PERFORM bdc_field       USING l_c_okcode
*                                l_c_mark.                            " Select All Sales Org
*  PERFORM bdc_dynpro      USING l_c_program2 l_c_scr_0400.
* } (-) DCEK902300
* { (+) DCEK902300
* This is to page down N times.. But doesn't work.. :(
  DO g_page_down TIMES.
  PERFORM bdc_dynpro      USING l_c_program2 l_c_scr_0400.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_down.
  ENDDO.
  PERFORM bdc_dynpro      USING l_c_program2 l_c_scr_0400.
  PERFORM bdc_field       USING 'GV_PR_MARK_0400(10)'
                                'X'.
* } (+) DCEK902300
  PERFORM bdc_field       USING l_c_okcode
                                l_c_entr.                            " OK ALL Sales Orgs
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
* { (+) DCEK902300
  PERFORM bdc_field       USING l_c_pro_no
                                is_file-product_number.              " Product External Number
* } (+) DCEK902300
  PERFORM bdc_field       USING l_c_sh_txt
                                is_file-short_text.                  " Product Description
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_tab3.                            " Select Tab 3 - Services
  PERFORM bdc_field       USING l_c_sh_txt
                                is_file-short_text.                  " Product Description

* 3rd Tab - Service
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_tab1.                            " Select Tab 1 - Basic SAP Data
  PERFORM bdc_field       USING l_c_base_unit
                                is_file-base_uom_ui.                 " Base Unit of Measure of a Material
  PERFORM bdc_field       USING l_c_duration
                                is_file-duration.                    " Duration of Work
  PERFORM bdc_field       USING l_c_unit_dur
                                is_file-duration_uom.                " Unit for Duration of Work
  PERFORM bdc_field       USING l_c_con_class
                                is_file-ff0010.                      " Contract Class
  PERFORM bdc_field       USING l_c_usg_fn_grp
                                is_file-ff0011.                      " Usage Function Group
** { (+) DCEK902300
*  PERFORM bdc_field       USING l_c_pro_no
*                                is_file-product_number.              " Product External Number
** } (+) DCEK902300
  PERFORM bdc_field       USING l_c_sh_txt
                                is_file-short_text.                  " Product Description

* 1st Tab - SAP Basic Data
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_tab2.                            " Select Tab 2 - General
  PERFORM bdc_field       USING l_c_pro_unit
                                is_file-process_unit.                " Unit of Measure in Which the Product Is Sold
  PERFORM bdc_field       USING l_c_min_order
                                is_file-min_order.                   " Minimum Order Quantity in Base Unit of Measure
  PERFORM bdc_field       USING l_c_min_ord_ui
                                is_file-min_order_ui.                " Minimum Order Quantity Unit
  PERFORM bdc_field       USING l_c_del_unit
                                is_file-dely_unit.                   " Delivery Unit
  PERFORM bdc_field       USING l_c_undel
                                is_file-undel.                       " Unit of Measure of Delivery Unit
  PERFORM bdc_field       USING l_c_s_it_cat
                                is_file-s_item_cat_group.            " Distribution-Chain-Dependent Item Category Group
  PERFORM bdc_field       USING l_c_location
                                is_file-loc_bupa.                    " Delivering Location
  PERFORM bdc_field       USING l_c_item_cat
                                is_file-item_cat_group.              " Item Category Group
  PERFORM bdc_field       USING l_c_sh_txt
                                is_file-short_text.                  " Product Description

* 2nd Tab - General
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_enter.
  PERFORM bdc_field       USING l_c_language
                                is_file-langu_desc_02.               " Language
  PERFORM bdc_field       USING l_c_short_txt
                                is_file-short_text_02.               " Product Description
  PERFORM bdc_field       USING l_c_country
                                is_file-tax_cty_01.                  " Country
  PERFORM bdc_field       USING l_c_tax_type
                                is_file-tax_type_01.                 " Tax Type
  PERFORM bdc_field       USING l_c_taxgroup
                                is_file-tax_group_01.                " Tax Group
  PERFORM bdc_field       USING l_c_sh_txt
                                is_file-short_text.                  " Product Description
  PERFORM bdc_dynpro      USING l_c_program1 l_c_scr_3000.
  PERFORM bdc_field       USING l_c_okcode
                                l_c_save.                            " Save the CRM Service
  PERFORM bdc_field       USING l_c_sh_txt
                                is_file-short_text.                  " Product Description

ENDFORM.                    " FILL_BDC_TABLE