5 Replies Latest reply: Sep 29, 2010 2:26 PM by Kumar Gaurav RSS

BDC not behaving as expected

Kumar Gaurav
Currently Being Moderated

Hi all,

I had done BDC for FB05. It was working fine.

Now the requirement changed a bit and I need to pass one more field special gl indicator.

 

So I added a line in the FM i created using the recording and expected that bdc should work fine. But it didn't . The filed get populated correctly but then the next screen data is not getting populated . Any Idea what could be the problem.

 

perform bdc_field       using 'RF05A-NEWUM'
                              SPL_GL_LINE_1.

 

FUNCTION ZFM_FB05_BDC_BILL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(CTU) LIKE  APQI-PUTACTIVE DEFAULT 'X'
*"     VALUE(MODE) LIKE  APQI-PUTACTIVE DEFAULT 'N'
*"     VALUE(UPDATE) LIKE  APQI-PUTACTIVE DEFAULT 'L'
*"     VALUE(GROUP) LIKE  APQI-GROUPID OPTIONAL
*"     VALUE(USER) LIKE  APQI-USERID OPTIONAL
*"     VALUE(KEEP) LIKE  APQI-QERASE OPTIONAL
*"     VALUE(HOLDDATE) LIKE  APQI-STARTDATE OPTIONAL
*"     VALUE(NODATA) LIKE  APQI-PUTACTIVE DEFAULT '/'
*"     VALUE(BLDAT_001) LIKE  BDCDATA-FVAL DEFAULT '09/09/2010'
*"     VALUE(BLART_002) LIKE  BDCDATA-FVAL DEFAULT 'sa'
*"     VALUE(BUKRS_003) LIKE  BDCDATA-FVAL DEFAULT 'K101'
*"     VALUE(BUDAT_004) LIKE  BDCDATA-FVAL DEFAULT '09/09/2010'
*"     VALUE(MONAT_005) LIKE  BDCDATA-FVAL DEFAULT '9'
*"     VALUE(WAERS_006) LIKE  BDCDATA-FVAL DEFAULT 'USD'
*"     VALUE(DOCID_007) LIKE  BDCDATA-FVAL DEFAULT '*'
*"     VALUE(NEWBS_008) LIKE  BDCDATA-FVAL DEFAULT '09'
*"     VALUE(NEWKO_009) LIKE  BDCDATA-FVAL DEFAULT '1000021'
*"     VALUE(SPL_GL_LINE_1) LIKE  BDCDATA-FVAL DEFAULT '2'
*"     VALUE(WRBTR_010) LIKE  BDCDATA-FVAL DEFAULT '100'
*"     VALUE(ZFBDT_011) LIKE  BDCDATA-FVAL DEFAULT '09/09/2010'
*"     VALUE(AGBUK_012) LIKE  BDCDATA-FVAL DEFAULT 'K101'
*"     VALUE(AGKON_013) LIKE  BDCDATA-FVAL DEFAULT '100000'
*"     VALUE(AGKOA_014) LIKE  BDCDATA-FVAL DEFAULT 'D'
*"     VALUE(AGUMS_015) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(XNOPS_016) LIKE  BDCDATA-FVAL DEFAULT ''
*"     VALUE(ABPOS_017) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_018) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_019) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_020) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(XPOS1_01_021) LIKE  BDCDATA-FVAL DEFAULT ''
*"     VALUE(XPOS1_03_022) LIKE  BDCDATA-FVAL DEFAULT 'X'
*"     VALUE(SEL01_01_023) LIKE  BDCDATA-FVAL DEFAULT '100000002'
*"     VALUE(ABPOS_024) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_025) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_026) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(PSZAH_01_027) LIKE  BDCDATA-FVAL DEFAULT '             50'
*"     VALUE(ABPOS_028) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_029) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(XPOS1_01_030) LIKE  BDCDATA-FVAL DEFAULT ''
*"     VALUE(XPOS1_03_031) LIKE  BDCDATA-FVAL DEFAULT 'X'
*"     VALUE(SEL01_01_032) LIKE  BDCDATA-FVAL DEFAULT '100000000'
*"     VALUE(ABPOS_033) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_034) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(ABPOS_035) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(PSZAH_01_036) LIKE  BDCDATA-FVAL DEFAULT '             50'
*"     VALUE(ABPOS_037) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(DOC_LIST) TYPE  ZTT_DOC_LIST
*"  EXPORTING
*"     VALUE(SUBRC) LIKE  SYST-SUBRC
*"  TABLES
*"      MESSTAB STRUCTURE  BDCMSGCOLL OPTIONAL
*"----------------------------------------------------------------------
data wa_doc_list type zst_doc_list.
subrc = 0.

perform bdc_nodata      using NODATA.

perform open_group      using GROUP USER KEEP HOLDDATE CTU.

perform bdc_dynpro      using 'SAPMF05A' '0122'.


perform bdc_field       using 'BKPF-BLDAT'
                              BLDAT_001.
perform bdc_field       using 'BKPF-BLART'
                              BLART_002.
perform bdc_field       using 'BKPF-BUKRS'
                              BUKRS_003.
perform bdc_field       using 'BKPF-BUDAT'
                              BUDAT_004.
perform bdc_field       using 'BKPF-MONAT'
                              MONAT_005.
perform bdc_field       using 'BKPF-WAERS'
                              WAERS_006.
perform bdc_field       using 'FS006-DOCID'
                              DOCID_007.
perform bdc_field       using 'RF05A-NEWBS'
                              NEWBS_008.

perform bdc_field       using 'RF05A-NEWKO'
                              NEWKO_009.
*perform bdc_field       using 'RF05A-NEWUM'
*                              SPL_GL_LINE_1.  " Uncomment this line and the next screen '0301' values don't get populated.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-NEWUM'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.

perform bdc_dynpro      using 'SAPMF05A' '0301'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-WRBTR'.
perform bdc_field       using 'BDC_OKCODE'
                              '=SL'.
perform bdc_field       using 'BSEG-WRBTR'
                              WRBTR_010.
perform bdc_field       using 'BSEG-ZFBDT'
                              ZFBDT_011.
perform bdc_dynpro      using 'SAPMF05A' '0710'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-AGUMS'.
perform bdc_field       using 'BDC_OKCODE'
                              '=PA'.
perform bdc_field       using 'RF05A-AGBUK'
                              AGBUK_012.
perform bdc_field       using 'RF05A-AGKON'
                              AGKON_013.
perform bdc_field       using 'RF05A-AGKOA'
                              AGKOA_014.
perform bdc_field       using 'RF05A-AGUMS'
                              AGUMS_015.
perform bdc_field       using 'RF05A-XNOPS'
                              XNOPS_016.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=PART'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-ABPOS'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_017.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OMX'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-ABPOS'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_018.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=Z-'.

perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-ABPOS'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_019.
* here !!

loop at doc_list into wa_doc_list.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OSU'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-ABPOS'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_020.
perform bdc_dynpro      using 'SAPDF05X' '2000'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-XPOS1(03)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=GO'.
perform bdc_field       using 'RF05A-XPOS1(01)'
                              XPOS1_01_021.
perform bdc_field       using 'RF05A-XPOS1(03)'
                              XPOS1_03_022.
perform bdc_dynpro      using 'SAPDF05X' '0731'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-SEL01(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=GO'.
perform bdc_field       using 'RF05A-SEL01(01)'
*                              SEL01_01_023.
                               wa_doc_list-belnr.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OMX'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-ABPOS'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_024.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=Z+'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-ABPOS'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_025.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BDC_CURSOR'
                              'DF05B-PSZAH(01)'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_026.
perform bdc_field       using 'DF05B-PSZAH(01)'
*                              PSZAH_01_027.
                              wa_doc_list-WRBTR.


"here
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OSE'.
perform bdc_field       using 'BDC_CURSOR'
                              'DF05B-PSZAH(01)'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_028.
endloop.
*perform bdc_dynpro      using 'SAPDF05X' '3100'.
*perform bdc_field       using 'BDC_OKCODE'
*                              '=OSU'.
*perform bdc_field       using 'BDC_CURSOR'
*                              'RF05A-ABPOS'.
*perform bdc_field       using 'RF05A-ABPOS'
*                              ABPOS_029.
*perform bdc_dynpro      using 'SAPDF05X' '2000'.
*perform bdc_field       using 'BDC_CURSOR'
*                              'RF05A-XPOS1(03)'.
*perform bdc_field       using 'BDC_OKCODE'
*                              '=GO'.
*perform bdc_field       using 'RF05A-XPOS1(01)'
*                              XPOS1_01_030.
*perform bdc_field       using 'RF05A-XPOS1(03)'
*                              XPOS1_03_031.
*perform bdc_dynpro      using 'SAPDF05X' '0731'.
*perform bdc_field       using 'BDC_CURSOR'
*                              'RF05A-SEL01(01)'.
*perform bdc_field       using 'BDC_OKCODE'
*                              '=GO'.
*perform bdc_field       using 'RF05A-SEL01(01)'
**                              SEL01_01_032.
*                              wa_doc_list-WRBTR.
*perform bdc_dynpro      using 'SAPDF05X' '3100'.
*perform bdc_field       using 'BDC_OKCODE'
*                              '=OMX'.
*perform bdc_field       using 'BDC_CURSOR'
*                              'RF05A-ABPOS'.
*perform bdc_field       using 'RF05A-ABPOS'
*                              ABPOS_033.
*perform bdc_dynpro      using 'SAPDF05X' '3100'.
*perform bdc_field       using 'BDC_OKCODE'
*                              '=Z+'.
*perform bdc_field       using 'BDC_CURSOR'
*                              'RF05A-ABPOS'.
*perform bdc_field       using 'RF05A-ABPOS'
*                              ABPOS_034.
*perform bdc_dynpro      using 'SAPDF05X' '3100'.
*perform bdc_field       using 'BDC_OKCODE'
*                              '/00'.
*perform bdc_field       using 'BDC_CURSOR'
*                              'DF05B-PSZAH(01)'.
*perform bdc_field       using 'RF05A-ABPOS'
*                              ABPOS_035.
*perform bdc_field       using 'DF05B-PSZAH(01)'
*                              PSZAH_01_036.
*"here
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BU'.
perform bdc_field       using 'BDC_CURSOR'
                              'DF05B-PSZAH(01)'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_037.
perform bdc_transaction tables messtab
using                         'FB05'
                              CTU
                              MODE
                              UPDATE.
if sy-subrc <> 0.
  subrc = sy-subrc.
  exit.
endif.

perform close_group using     CTU.





ENDFUNCTION.
INCLUDE BDCRECXY .