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: 

FK01

Former Member
0 Kudos

HI ALL

CAN ANYBODY TELL ME FIELDS IN FK01 WHILE RUNNING A BDC?

THANKS & REGARDS

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

your code is like this.

use this code in ur program

You can code like ,

DATA: ok_code LIKE sy-ucomm,

BDCDATA TYPE TABLE OF BDCDATA,

WA_BDCDATA TYPE BDCDATA.

*Accountgroup

WA_BDCDATA-PROGRAM = 'SAPMF02K'.

WA_BDCDATA-DYNPRO = '0105'.

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'RF02K-KTOKK'.

WA_BDCDATA-FVAL = 'ZHRO'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

*Leverandør

WA_BDCDATA-FNAM = 'RF02K-LIFNR'.

WA_BDCDATA-FVAL = '1115'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

*Firmakode

WA_BDCDATA-FNAM = 'RF02K-BUKRS'.

WA_BDCDATA-FVAL = '1000'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • Name

WA_BDCDATA-PROGRAM = 'SAPMF02K'.

WA_BDCDATA-DYNPRO = '111'. "v

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'ADDR1_DATA-NAME1'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

*Search Term

WA_BDCDATA-FNAM = 'ADDR1_DATA-SORT1'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • VendorName

WA_BDCDATA-PROGRAM = 'SAPMF02K'.

WA_BDCDATA-DYNPRO = '0110'.

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'LFA1-Name1'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • Sort Key

WA_BDCDATA-FNAM = 'LFA1-SORTL'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • Language Key

WA_BDCDATA-FNAM = 'LFA1-SPRAS'.

WA_BDCDATA-FVAL = 'DA'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

Call Transaction 'FK01' using BDCDATA.

ENDFUNCTION.

*Reward points

Regards

8 REPLIES 8

Former Member
0 Kudos

Hi,

Can you be bit clear, what fields you want for BDC.

For doing BDC- do the Recording, you will know the field names.

Thanks,

Anitha

Former Member
0 Kudos

hi,

your code is like this.

use this code in ur program

You can code like ,

DATA: ok_code LIKE sy-ucomm,

BDCDATA TYPE TABLE OF BDCDATA,

WA_BDCDATA TYPE BDCDATA.

*Accountgroup

WA_BDCDATA-PROGRAM = 'SAPMF02K'.

WA_BDCDATA-DYNPRO = '0105'.

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'RF02K-KTOKK'.

WA_BDCDATA-FVAL = 'ZHRO'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

*Leverandør

WA_BDCDATA-FNAM = 'RF02K-LIFNR'.

WA_BDCDATA-FVAL = '1115'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

*Firmakode

WA_BDCDATA-FNAM = 'RF02K-BUKRS'.

WA_BDCDATA-FVAL = '1000'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • Name

WA_BDCDATA-PROGRAM = 'SAPMF02K'.

WA_BDCDATA-DYNPRO = '111'. "v

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'ADDR1_DATA-NAME1'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

*Search Term

WA_BDCDATA-FNAM = 'ADDR1_DATA-SORT1'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • VendorName

WA_BDCDATA-PROGRAM = 'SAPMF02K'.

WA_BDCDATA-DYNPRO = '0110'.

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'LFA1-Name1'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • Sort Key

WA_BDCDATA-FNAM = 'LFA1-SORTL'.

WA_BDCDATA-FVAL = 'Shou'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

  • Language Key

WA_BDCDATA-FNAM = 'LFA1-SPRAS'.

WA_BDCDATA-FVAL = 'DA'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

Call Transaction 'FK01' using BDCDATA.

ENDFUNCTION.

*Reward points

Regards

Former Member
0 Kudos

This transaction hits so many tables that's why it is good to record this transaction with SD transaction then you will get to know which tables which tables.

Former Member
0 Kudos

Following are some of the screen name, screen number & fieds that are hit while performing BDC on FK01

T FK01

SAPMF02K 0105 X

BDC_CURSOR

BDC_OKCODE

RF02K-LIFNR

RF02K-BUKRS

RF02K-KTOKK

SAPMF02K 0110 X

BDC_CURSOR

BDC_OKCODE

LFA1-ANRED

LFA1-NAME1

LFA1-SORTL

LFA1-LAND1

LFA1-SPRAS

SAPMF02K 0120 X

BDC_CURSOR

BDC_OKCODE

BDC_SUBSCR

BDC_SUBSCR

BDC_SUBSCR

BDC_SUBSCR

BDC_SUBSCR

BDC_SUBSCR

BDC_SUBSCR

SAPMF02K 0130 X

BDC_CURSOR

BDC_OKCODE

SAPMF02K 0210 X

BDC_CURSOR

BDC_OKCODE

LFB1-AKONT

LFB1-ZUAWA

LFB1-FDGRV

SAPMF02K 0215 X

BDC_CURSOR

BDC_OKCODE

LFB1-ZTERM

LFB1-REPRF

LFB1-KULTG

LFB1-ZWELS

SAPMF02K 0220 X

BDC_CURSOR

BDC_OKCODE

SAPMF02K 0610 X

BDC_OKCODE

BDC_SUBSCR

BDC_CURSOR

Please reward points if found helpful

Thanks

Former Member
0 Kudos

the below program is the table control bdc of thE FK01 with all mandatory fields....

report ZSDN_BDC_TBLCTRL
       no standard page heading line-size 255.
*
*** Generated data section with specific formatting - DO NOT CHANGE  ***
data: begin of record occurs 0,
* data element: LIF16
        LIFNR_001(016),
* data element: BUKRS
        BUKRS_002(004),
* data element: KTOKK
        KTOKK_003(004),
* data element: ANRED
        ANRED_004(015),
* data element: NAME1_GP
        NAME1_005(035),
* data element: SORTL
        SORTL_006(010),
* data element: LAND1_GP
        LAND1_007(003),
* data element: KUNNR
        KUNNR_008(010),
* data element: BANKS
        BANKS_01_009(003),
* data element: BANKK
        BANKL_01_011(015),
* data element: BANKN
        BANKN_01_013(018),
* data element: AKONT
        AKONT_015(010),
* data element: FDGRV
        FDGRV_016(010),
      end of record,
 
      it_bdc type bdcdata occurs 0 with header line,
      it_msg type bdcmsgcoll occurs 0 with header line.
data: v_bankl(14), v_banks(14), v_bankn(14).
data: v_numc(2) type n, lv_tabix like sy-tabix.
*** End generated data section ***
 
start-of-selection.
 
perform upload_data.
loop at record.
lv_tabix = sy-tabix.
 
at new lifnr_001.
  read table record index lv_tabix.
  clear v_numc.
 clear : it_bdc, it_bdc[], it_msg, it_msg[].
 
perform bdc_dynpro      using 'SAPMF02K' '0105'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF02K-KTOKK'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF02K-LIFNR'
                              record-LIFNR_001.
perform bdc_field       using 'RF02K-BUKRS'
                              record-BUKRS_002.
perform bdc_field       using 'RF02K-KTOKK'
                              record-KTOKK_003.
perform bdc_dynpro      using 'SAPMF02K' '0110'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFA1-LAND1'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFA1-ANRED'
                              record-ANRED_004.
perform bdc_field       using 'LFA1-NAME1'
                              record-NAME1_005.
perform bdc_field       using 'LFA1-SORTL'
                              record-SORTL_006.
perform bdc_field       using 'LFA1-LAND1'
                              record-LAND1_007.
perform bdc_dynpro      using 'SAPMF02K' '0120'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFA1-KUNNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFA1-KUNNR'
                              record-KUNNR_008.
perform bdc_dynpro      using 'SAPMF02K' '0130'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFBK-BANKN(02)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
 
endat.
v_numc = v_numc + 1.
 
concatenate 'LFBK-BANKS(' v_numc ')' into v_banks.
concatenate 'LFBK-BANKL(' v_numc ')' into v_bankl.
concatenate 'LFBK-BANKN(' v_numc ')' into v_bankn.
 
perform bdc_field       using v_banks
                              record-BANKS_01_009.
 
perform bdc_field       using v_bankl
                              record-BANKL_01_011.
 
perform bdc_field       using v_bankn
                              record-BANKN_01_013.
 
at end of lifnr_001.
  read table record index lv_tabix.
perform bdc_dynpro      using 'SAPMF02K' '0130'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFBK-BANKS(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_dynpro      using 'SAPMF02K' '0210'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB1-FDGRV'.
perform bdc_field       using 'BDC_OKCODE'
                              '=UPDA'.
perform bdc_field       using 'LFB1-AKONT'
                              record-AKONT_015.
perform bdc_field       using 'LFB1-FDGRV'
                              record-FDGRV_016.
*perform bdc_transaction using 'FK01'.
 
call transaction 'FK01' using it_bdc mode 'A' update 'S' messages into
it_msg.
endat.
endloop.
*&---------------------------------------------------------------------*
*&      Form  upload_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM upload_data .
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = 'C:CALLT.TXT'
*   FILETYPE                      = 'ASC'
*   HAS_FIELD_SEPARATOR           = ' '
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            = VIRUS_SCAN_PROFILE
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    = FILELENGTH
*   HEADER                        = HEADER
  TABLES
    DATA_TAB                      = record
* EXCEPTIONS
*   FILE_OPEN_ERROR               = 1
*   FILE_READ_ERROR               = 2
*   NO_BATCH                      = 3
*   GUI_REFUSE_FILETRANSFER       = 4
*   INVALID_TYPE                  = 5
*   NO_AUTHORITY                  = 6
*   UNKNOWN_ERROR                 = 7
*   BAD_DATA_FORMAT               = 8
*   HEADER_NOT_ALLOWED            = 9
*   SEPARATOR_NOT_ALLOWED         = 10
*   HEADER_TOO_LONG               = 11
*   UNKNOWN_DP_ERROR              = 12
*   ACCESS_DENIED                 = 13
*   DP_OUT_OF_MEMORY              = 14
*   DISK_FULL                     = 15
*   DP_TIMEOUT                    = 16
*   OTHERS                        = 17
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
 
ENDFORM.                    " upload_data
 
*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR it_bdc.
  it_bdc-PROGRAM  = PROGRAM.
  it_bdc-DYNPRO   = DYNPRO.
  it_bdc-DYNBEGIN = 'X'.
  APPEND it_bdc.
ENDFORM.
 
*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
  IF FVAL <> ' '.
    CLEAR it_bdc.
    it_bdc-FNAM = FNAM.
    it_bdc-FVAL = FVAL.
    APPEND it_bdc.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  format_msg
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM format_msg .
 
  data: lv_str type string.
 
  loop at it_msg.
    clear lv_str.
  CALL FUNCTION 'FORMAT_MESSAGE'
   EXPORTING
     ID              = it_msg-MSGID
     LANG            = 'EN'
     NO              = it_msg-MSGNR
     V1              = it_msg-MSGV1
     V2              = it_msg-MSGV2
     V3              = it_msg-MSGV3
     V4              = it_msg-MSGV4
   IMPORTING
     MSG             = lv_str
   EXCEPTIONS
     NOT_FOUND       = 1
     OTHERS          = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  else.
   write 😕 lv_str.
  ENDIF.
  endloop.
 
ENDFORM.                    " format_msg


Regards

Girish

Former Member
0 Kudos

hi kanny,

whatever the t.code it may be,

u just record that T.code through T.code <b>shdb</b> by giving dummy data in the mandatory fields,

then transfwer this recording to <b>zreport</b>,

in this <b>zreport</b> u can find the required fields.

regards,

seshu.

Former Member
0 Kudos

data: begin of record,

  • data element: LIF16

LIFNR_001(016),

  • data element: BUKRS

BUKRS_002(004),

  • data element: KTOKK

KTOKK_003(004),

  • data element: ANRED

ANRED_004(015),

  • data element: NAME1_GP

NAME1_005(035),

  • data element: SORTL

SORTL_006(010),

  • data element: LAND1_GP

LAND1_007(003),

  • data element: AKONT

AKONT_008(010),

end of record.

perform bdc_dynpro using 'SAPMF02K' '0105'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

record-LIFNR_001.

perform bdc_field using 'RF02K-BUKRS'

record-BUKRS_002.

perform bdc_field using 'RF02K-KTOKK'

record-KTOKK_003.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-LAND1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-ANRED'

record-ANRED_004.

perform bdc_field using 'LFA1-NAME1'

record-NAME1_005.

perform bdc_field using 'LFA1-SORTL'

record-SORTL_006.

perform bdc_field using 'LFA1-LAND1'

record-LAND1_007.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_dynpro using 'SAPMF02K' '0210'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-AKONT'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFB1-AKONT'

record-AKONT_008.

perform bdc_transaction using 'FK01'.

Former Member
0 Kudos

use the t.code shdb.click on new recording in this give transaction code as fk01.go on entering the mandatory fields.save all these and then click on program u'll get all the fields.