Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BDC not behaving as expected

Private_Member_49934
Contributor
0 Kudos

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 .

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Kumar,

When you want to add a new field in the BDC after you have created the program. Record it once more as screens may have changed and adjust your program based on the same.

For Ex , like the one below.

If w_splgl = 'X'.

PERFORM bdc_dynpro using 'SAPMF05K' '1000'.

ELSE.

PERFORM bdc_dynpro using 'SAPMF05K' '1010'.

ENDIF.

Hope it helps

Sujay

5 REPLIES 5

Former Member
0 Kudos

Hi Kumar,

When you want to add a new field in the BDC after you have created the program. Record it once more as screens may have changed and adjust your program based on the same.

For Ex , like the one below.

If w_splgl = 'X'.

PERFORM bdc_dynpro using 'SAPMF05K' '1000'.

ELSE.

PERFORM bdc_dynpro using 'SAPMF05K' '1010'.

ENDIF.

Hope it helps

Sujay

Former Member
0 Kudos

Hi,

Please highlight the lines were you have done changes....

Regards

GK.

Private_Member_49934
Contributor
0 Kudos

Sujay,

Thanks a lot man. I spent around 3 hrs changing the BDCDATA. The screens look so similar that it didn't come to my mind that screen number could be different.

Thanks again.

KG

former_member187457
Active Contributor
0 Kudos

I agree with Sujay.......redo recording...

The reason of error maight be the GL Indicator.....

Check the combination of Posting Key & GL Indicator exits or not.......by posting directly thru txn FB05....

With the GL indicator & Posting key...might be the next screen no. changes.....just check...wild guess....

If so....Redo the recording for each combination of PK & GL Ind.

Thnx

RK

Private_Member_49934
Contributor
0 Kudos

Ya. Even we don't need to do the recording for each combination. We can just manually see check the screen number for that particular special gl and posting key and put it in the code