Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Lik_Wei
Explorer

Introduction

During the execution of the program, a maximum of five lines are displayed in the table control. To get a better understanding of how this works, consider the program's attempt to loop through all the records contained within the ITEM_TAB table.

 

Implementation

In the context of table control, there's a need to reset the counter to 4 after the insertion of a new line. The reason behind this is that once a new line is inserted, the program proceeds to display four lines that include the inserted values. Additionally, there's a blank line, which is positioned on line 5.

Every time a new record is to be added, it should be positioned on line 5, following the execution of OKCODE =0006. This approach ensures the proper display and handling of data within the table control.

To provide a clearer understanding of how this works, below is a snapshot of the BDC program with the associated T-Code FB60:

 

 

* Intialize counter for table control rows (Max 5 lines).
  lv_cnt  = 1.
  
* Insert BDC_FIELD from each line in table ITEM_TAB.
  LOOP AT item_tab ASSIGNING FIELD-SYMBOL(<lf_item_tab>).
    CONDENSE lv_cnt.
    
    lv_txt_fkber = |ACGL_ITEM-FKBER({ lv_cnt })|.
    lv_txt_hkont = |ACGL_ITEM-HKONT({ lv_cnt })|.
    lv_txt_wrbtr = |ACGL_ITEM-WRBTR({ lv_cnt })|.
    lv_txt_sgtxt = |ACGL_ITEM-SGTXT({ lv_cnt })|.
    lv_txt_prctr = |ACGL_ITEM-PRCTR({ lv_cnt })|.
    lv_txt_kostl = |ACGL_ITEM-KOSTL({ lv_cnt })|.
    lv_txt_shkzg = |ACGL_ITEM-SHKZG({ lv_cnt })|.
    
    PERFORM bdc_dynpro      USING 'SAPMF05A' '1100'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=PI'."'/00'.
    PERFORM bdc_field       USING 'RF05A-BUSCS'
                                  lc_r.
    PERFORM bdc_field       USING 'INVFO-ACCNT'
                                  iv_vendor.
    PERFORM bdc_field       USING 'INVFO-XBLNR'
                                  iv_xblnr.
    PERFORM bdc_field       USING 'INVFO-WRBTR'
                                  lv_wrbtr.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  lv_txt_hkont.
    PERFORM bdc_field       USING lv_txt_hkont
				<lf_item_tab>-glaccount.
																
* ............................................................*
																	
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0330'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'BSEG-XREF3'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=RW'.
    PERFORM bdc_field       USING 'BSEG-XREF1'
				<lf_item_tab>-xref1.
    PERFORM bdc_field       USING 'BSEG-XREF2'
				<lf_item_tab>-xref2.
    PERFORM bdc_field       USING 'BSEG-XREF3'
				<lf_item_tab>-xref3.
																	
* Managing line items in the table control of FB60 transaction.
    IF lv_cnt >  4.    "Max 5 records appear in table control.
* Reset the counter to 4 (Last line in the table conrtol) after last record is filled up.
      lv_cnt = 4.
      PERFORM bdc_dynpro      USING 'SAPMF05A' '1100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=0006'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
				lv_txt_hkont.
    ENDIF.
    
    lv_cnt  = lv_cnt + 1. "Counter increment by 1.
  ENDLOOP.
  
  PERFORM bdc_dynpro      USING 'SAPMF05A' '1100'.
  PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=BU'.
  PERFORM bdc_field       USING 'RF05A-BUSCS'
                                lc_r.
  PERFORM bdc_field       USING 'INVFO-ACCNT'
                                iv_vendor.
  PERFORM bdc_field       USING 'INVFO-XBLNR'
                                iv_xblnr.
  PERFORM bdc_field       USING 'INVFO-WRBTR'
                                lv_wrbtr.
  PERFORM bdc_field       USING 'BDC_CURSOR'
                                lv_txt_hkont.
                                
  PERFORM bdc_transaction TABLES messtab
  USING                         'FB60'
                                ctu
                                mode
                                update.

 

 

If you've encountered an error while using different devices, the issue could be due to the varying screen resolutions of your devices. This is a common problem that can occur when working with a variety of devices, each with its own unique specifications. The software needs to adapt to these different environments, and this is where our solution comes into play.

To address this, we need to add a specific part of code, the defsize option, to our program. The defsize option is a powerful tool that ensures consistent handling of table control across all systems. It is designed to provide a uniform experience, regardless of the device or screen resolution being used.

The process begins by recording your transaction using the default screen size. This establishes a baseline for the software to refer to and ensures that the process is calibrated properly.

Next, you will need to increment the index. This is done based on the number you get from the default recording for the table control entries. This step is crucial as it allows the program to adjust the display according to the specific requirements of the device being used.

By following these steps, you can ensure that your program can handle table control consistently across all devices and screen resolutions. This will not only resolve the error you're currently experiencing but also make your program more robust and reliable for future use.

 

 

DATA ctu_options TYPE ctu_params.

ctu_options-defsize = 'X'.

CALL TRANSACTION 'MMZ1' USING bdcdata OPTIONS FROM ctu_options.

 

 

Conclusion

I sincerely hope that this blog has been a helpful resource in your journey to understand how to develop a BDC Table Control program. My aim was to provide you with a comprehensive guide that simplifies the process and makes it more accessible to everyone, regardless of their level of familiarity with the platform. If you found this blog useful, I would greatly appreciate it if you could share it with others who might also benefit from this information.

Your likes and shares help to spread the word about these resources and support the work that goes into creating them. Moreover, your feedback and comments are extremely valuable to me. They not only help me improve my future content, but also provide a space for discussion and learning. I look forward to hearing your thoughts and engaging in fruitful discussions!

3 Comments
Labels in this area