BDC code for transaction XD01

Hi all,
Can anyone of you provide me complete BDC code for Transaction XD01.
An early reply will be highly appreciated and would be rewarded.
Regards,
Neeraj

Hi Prakash
hope this code will help you.
ABAP BDC SAMPLE CODE XD01
Table/Structure declarations. *
TABLES : KNA1. "Customer master
Constants declarations. *
CONSTANTS : C_MODE VALUE 'A',
C_UPDATE VALUE 'S',
C_X VALUE 'X',
C_SESS TYPE APQI-GROUPID VALUE 'ZCUSTOMER', "Session Name
C_XD01 LIKE TSTC-TCODE VALUE 'XD01'.
Variable declarations. *
DATA : V_FNAME(15) VALUE SPACE, " Name of file to be created
V_FAILREC TYPE I, " No of failed records
V_MSG(255), " Message Text
V_ERRREC TYPE I, " No of failed records
V_LINES TYPE I, " No of records
V_BANKS(15), " Table column BANKS
V_BANKL(15), " Table column BANKL
V_BANKN(15), " Table column BANKN
V_TIDX(2) TYPE N. " Table row index
*-- FLAG DECLARATIONS
DATA : FG_DATA_EXIST VALUE 'X', " Check for data
FG_SESSION_OPEN VALUE ' '. " Check for Session Open
*-- MACRO DEFINITIONS
*-- Macro for BANKS
DEFINE BANKS.
CLEAR V_BANKS.
CONCATENATE 'KNBK-BANKS(' &1 ')' INTO V_BANKS.
CONDENSE V_BANKS.
END-OF-DEFINITION.
*-- Macro for BANKL
DEFINE BANKL.
CLEAR V_BANKL.
CONCATENATE 'KNBK-BANKL(' &1 ')' INTO V_BANKL.
CONDENSE V_BANKL.
END-OF-DEFINITION.
*-- Macro for BANKN
DEFINE BANKN.
CLEAR V_BANKN.
CONCATENATE 'KNBK-BANKN(' &1 ')' INTO V_BANKN.
CONDENSE V_BANKN.
END-OF-DEFINITION.
Structures / Internal table declarations *
*-- Structure to hold BDC data
TYPES : BEGIN OF T_BDCTABLE.
INCLUDE STRUCTURE BDCDATA.
TYPES END OF T_BDCTABLE.
*-- Structure to trap BDC messages
TYPES : BEGIN OF T_MSG.
INCLUDE STRUCTURE BDCMSGCOLL.
TYPES : END OF T_MSG.
*-- Structure to trap ERROR messages
TYPES : BEGIN OF T_ERR_MSG,
MESSAGE(255),
END OF T_ERR_MSG.
*--Internal table to store flat file data
DATA : BEGIN OF IT_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
KTOKD LIKE T077D-KTOKD,
NAME1 LIKE KNA1-NAME1,
SORTL LIKE KNA1-SORTL,
ORT01 LIKE KNA1-ORT01,
PSTLZ LIKE KNA1-PSTLZ,
LAND1 LIKE KNA1-LAND1,
SPRAS LIKE KNA1-SPRAS,
LZONE LIKE KNA1-LZONE,
END OF IT_KNA1.
*--Internal table to store bank details
DATA : BEGIN OF IT_BANK OCCURS 0,
BANKS LIKE KNBK-BANKS,
BANKL LIKE KNBK-BANKL,
BANKN LIKE KNBK-BANKN,
END OF IT_BANK.
*-- Internal table to hold BDC data
DATA: IT_BDCDATA TYPE STANDARD TABLE OF T_BDCTABLE WITH HEADER LINE,
*-- Internal Table to store ALL messages
IT_MSG TYPE STANDARD TABLE OF T_MSG WITH HEADER LINE,
*-- Internal Table to store error messages
IT_ERR_MSG TYPE STANDARD TABLE OF T_ERR_MSG WITH HEADER LINE.
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FLNAME(15) OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R_LIST RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 5(20) TEXT-003.
PARAMETERS : R_SESS RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 30(20) TEXT-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Event:Initialization *
INITIALIZATION.
AT Selection Screen. *
AT SELECTION-SCREEN.
Event: Start-of-Selection *
START-OF-SELECTION.
V_FNAME = P_FLNAME.
PERFORM GET_DATA.
PERFORM GET_BANKDATA.
PERFORM GENERATE_DATASET.
Event: End-of-Selection *
END-OF-SELECTION.
IF FG_DATA_EXIST = ' '.
MESSAGE I010 WITH TEXT-009.
EXIT.
ENDIF.
PERFORM GENERATE_BDCDATA.
PERFORM DISPLAY_ERR_RECS.
Event: top-of-page
TOP-OF-PAGE.
FORM DEFINITIONS *
*& Form get_data
Subroutine to get the data from mard
--> p1 text
<-- p2 text
FORM GET_DATA.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\XD01.TXT'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = IT_KNA1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF IT_KNA1[] IS INITIAL.
FG_DATA_EXIST = ' '.
ENDIF.
ENDFORM. " get_data
*& Form GENERATE_DATASET
text
--> p1 text
<-- p2 text
FORM GENERATE_DATASET.
MESSAGE I010 WITH 'OPENING FILE IN APPLICATION SERVER'.
**--Creating a data set in application server
OPEN DATASET V_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
**---Transfering data from internal table to dataset
MESSAGE I010 WITH 'TRANSFERING DATA FROM INETERAL TABLE TO THE FILE'.
LOOP AT IT_KNA1.
TRANSFER IT_KNA1 TO V_FNAME.
ENDLOOP.
**--Closing the dataset
MESSAGE I010 WITH 'CLOSING THE FILE'.
CLOSE DATASET V_FNAME.
ENDFORM. " GENERATE_DATASET
*& Form BDC_DYNPRO
text
-->P_0467 text
-->P_0468 text
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
*& Form BDC_FIELD
text
-->P_0472 text
-->P_0473 text
FORM BDC_FIELD USING FNAM FVAL.
IF NOT FVAL IS INITIAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDIF.
ENDFORM.
*& Form GENERATE_BDCDATA
text
--> p1 text
<-- p2 text
FORM GENERATE_BDCDATA.
REFRESH IT_KNA1.
Opening dataset for reading
OPEN DATASET V_FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
Reading the file from application server
DO.
CLEAR: IT_KNA1,IT_BDCDATA.
REFRESH IT_BDCDATA.
READ DATASET V_FNAME INTO IT_KNA1.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
Populate BDC Data for Initial Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0100',
BDC_FIELD USING 'BDC_CURSOR' 'RF02D-KUNNR',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'RF02D-KUNNR' IT_KNA1-KUNNR,
BDC_FIELD USING 'RF02D-KTOKD' IT_KNA1-KTOKD.
Populate BDC Data for Second Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0110',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NAME1',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'KNA1-NAME1' IT_KNA1-NAME1,
BDC_FIELD USING 'KNA1-SORTL' IT_KNA1-SORTL,
BDC_FIELD USING 'KNA1-ORT01' IT_KNA1-ORT01,
BDC_FIELD USING 'KNA1-PSTLZ' IT_KNA1-PSTLZ,
BDC_FIELD USING 'KNA1-LAND1' IT_KNA1-LAND1,
BDC_FIELD USING 'KNA1-SPRAS' IT_KNA1-SPRAS.
Populate BDC Data for Third Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0120',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-LZONE',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'KNA1-LZONE' IT_KNA1-LZONE.
Populate BDC Data for Fourth Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0125',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NIELS',
BDC_FIELD USING 'BDC_OKCODE' '/00'.
Populate BDC Data for Table control for bank details.
V_TIDX = '01'.
LOOP AT IT_BANK.
BANKS V_TIDX.
BANKL V_TIDX.
BANKN V_TIDX.
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',
BDC_FIELD USING 'BDC_CURSOR' V_BANKN,
BDC_FIELD USING 'BDC_OKCODE' '=ENTR',
BDC_FIELD USING V_BANKS IT_BANK-BANKS,
BDC_FIELD USING V_BANKL IT_BANK-BANKL,
BDC_FIELD USING V_BANKN IT_BANK-BANKN.
V_TIDX = V_TIDX + 1.
ENDLOOP.
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',
BDC_FIELD USING 'BDC_CURSOR' V_BANKS,
BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.
CALL TRANSACTION C_XD01 USING IT_BDCDATA
MODE C_MODE
UPDATE C_UPDATE
MESSAGES INTO IT_MSG.
IF SY-SUBRC <> 0.
*--In case of error list display
IF R_LIST = C_X.
V_ERRREC = V_ERRREC + 1.
PERFORM FORMAT_MESSAGE.
IT_ERR_MSG-MESSAGE = V_MSG.
APPEND IT_ERR_MSG.
CLEAR : V_MSG,IT_ERR_MSG.
ENDIF.
*--In case of session log
IF R_SESS = C_X.
*-- In case of transaction fails.
IF FG_SESSION_OPEN = ' '.
FG_SESSION_OPEN = C_X.
PERFORM BDC_OPEN_GROUP.
ENDIF. " IF FG_SESSION_OPEN = ' '.
*-- Insert BDC Data..
PERFORM BDC_INSERT_DATA.
ENDIF. " IF R_SESS = C_X.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF SY-SUBRC <> 0.
ENDDO.
Closing the dataset
CLOSE DATASET V_FNAME.
*-- Close the session if opened
IF FG_SESSION_OPEN = C_X.
PERFORM BDC_CLOSE_GROUP.
CALL TRANSACTION 'SM35'.
ENDIF.
ENDFORM. " GENERATE_BDCDATA
*& Form BDC_OPEN_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_OPEN_GROUP.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = C_SESS
HOLDDATE = FILLER8
KEEP = C_X
USER = SY-UNAME
RECORD = FILLER1
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
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. " BDC_OPEN_GROUP
*& Form BDC_INSERT_DATA
text
--> p1 text
<-- p2 text
FORM BDC_INSERT_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = C_XD01
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
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. " BDC_INSERT_DATA
*& Form BDC_CLOSE_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_CLOSE_GROUP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
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. " BDC_CLOSE_GROUP
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE.
CLEAR V_LINES.
DESCRIBE TABLE IT_MSG LINES V_LINES.
READ TABLE IT_MSG INDEX V_LINES.
CLEAR V_MSG.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MSG-MSGID
LANG = IT_MSG-MSGSPRA
NO = IT_MSG-MSGNR
V1 = IT_MSG-MSGV1
V2 = IT_MSG-MSGV2
V3 = IT_MSG-MSGV3
V4 = IT_MSG-MSGV4
IMPORTING
MSG = V_MSG
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.
ENDIF.
ENDFORM. " FORMAT_MESSAGE
*& Form DISPLAY_ERR_RECS
text
--> p1 text
<-- p2 text
FORM DISPLAY_ERR_RECS.
LOOP AT IT_ERR_MSG.
WRITE: / IT_ERR_MSG-MESSAGE.
ENDLOOP.
ENDFORM. " DISPLAY_ERR_RECS
*& Form GET_BANKDATA
text
--> p1 text
<-- p2 text
FORM GET_BANKDATA.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = '1000'.
IT_BANK-BANKN = 'S.B A/C'.
APPEND IT_BANK.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = 'CITY'.
IT_BANK-BANKN = 'CURR. A/C'.
APPEND IT_BANK.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = 'H001'.
IT_BANK-BANKN = 'S.B A/C'.
APPEND IT_BANK.
reward if help.

Similar Messages

  • BDC code for the XD01 and VD01

    Hello Masters,
    I am new to SAP-ABAP,could anyone help me to get the BDC code to update the customer master data by using the t.code XD01 and VD01.
    Thanks
    Varsha.

           SESSION METHOD
    report YARINSESSIONBDC2 no standard page heading line-size 255.
    data: bdcdata like bdcdata occurs 0 with header line.
    data: session like apqi-groupid value 'yar1'.
    data: begin of itab occurs 0,
          kunnr like lfa1-kunnr,
          name1 like lfa1-name1,
          pstlz like lfa1-pstlz,
          end of itab.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       FILENAME                        = 'D:\naser.txt'
       FILETYPE                        = 'ASC'
       HAS_FIELD_SEPARATOR             = '|'
      HEADER_LENGTH                  =  0
      READ_BY_LINE                  = 'X'
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                       = itab
    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.
    start-of-selection.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
       CLIENT                     = SY-MANDT
      DEST                      = FILLER8
       GROUP                      = SESSION
      HOLDDATE                  = FILLER8
      KEEP                      = FILLER1
       USER                       = SY-UNAME
      RECORD                    = FILLER1
    IMPORTING
      QID                       =
    EXCEPTIONS
       CLIENT_INVALID             = 1
       DESTINATION_INVALID        = 2
       GROUP_INVALID              = 3
       GROUP_IS_LOCKED            = 4
       HOLDDATE_INVALID           = 5
       INTERNAL_ERROR             = 6
       QUEUE_ERROR                = 7
       RUNNING                    = 8
       SYSTEM_LOCK_ERROR          = 9
       USER_INVALID               = 10
       OTHERS                     = 11.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DO.
    perform fill_bdc_tab.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
       TCODE                   = 'XD02'
      POST_LOCAL             = NOVBLOCAL
      PRINTING               = NOPRINT
      TABLES
        DYNPROTAB              = BDCDATA
    EXCEPTIONS
       INTERNAL_ERROR          = 1
       NOT_OPEN                = 2
       QUEUE_ERROR             = 3
       TCODE_INVALID           = 4
       PRINTING_INVALID        = 5
       POSTING_INVALID         = 6
       OTHERS                  = 7
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDDO.
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
      NOT_OPEN          = 1
      QUEUE_ERROR       = 2
      OTHERS            = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *include bdcrecx1.
    *start-of-selection.
    *perform open_group.
    *&      Form  fill_bdc_tab
          text
    -->  p1        text
    <--  p2        text
    FORM fill_bdc_tab.
    clear bdcdata.
    refresh bdcdata.
    perform bdc_dynpro      using 'SAPMF02D' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02D-D0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02D-KUNNR'
                                  itab-kunnr.
    perform bdc_field       using 'RF02D-BUKRS'
                                  '0001'.
    perform bdc_field       using 'RF02D-D0110'
                                  'X'.
    perform bdc_dynpro      using 'SAPMF02D' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'KNA1-PSTLZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'KNA1-ANRED'
                                  'Company'.
    perform bdc_field       using 'KNA1-NAME1'
                                  itab-name1.
    perform bdc_field       using 'KNA1-PFACH'
                                  'GPO'.
    perform bdc_field       using 'KNA1-ORT01'
                                  '7000091'.
    perform bdc_field       using 'KNA1-PSTLZ'
                                  itab-pstlz.
    perform bdc_field       using 'KNA1-PSTL2'
                                  '123456'.
    perform bdc_field       using 'KNA1-LAND1'
                                  'IN'.
    perform bdc_field       using 'KNA1-SPRAS'
                                  'EN'.
    *perform bdc_transaction using 'XD02'.
    *perform close_group.
    append bdcdata.
    ENDFORM.                    " fill_bdc_tab
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
    ENDIF.
    ENDFORM.
    Reward if useful
    Regards
    ANUPAM

  • BDC code for MM01 Transaction

    Hi All,,
                 Please give Entire BDC code for MM01 Transaction.
    i will change as per my requirement.
    I think this is already done by some ABAP Consultants.
    plz dont give answers like do recording for that transaction MM01. I know recording...
    For time constraiint, I have to complete soon.....
    Thanks in Advance
    BestRegards,
    Anil

    Hi,
    The below code is using the Session Method
    report ZDS_BDC_MM01
           no standard page heading line-size 255.
    include bdcrecx1.
    *parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record OCCURS 0,
    * data element: MATNR
            MATNR_001(018),
    * data element: MBRSH
            MBRSH_002(001),
    * data element: MTART
            MTART_003(004),
    * data element: XFELD
            KZSEL_01_004(001),
    * data element: XFELD
            KZSEL_02_005(001),
    * data element: MAKTX
            MAKTX_006(040),
    * data element: MEINS
            MEINS_007(003),
    * data element: MAKTX
            MAKTX_008(040),
          end of record.
    *** End generated data section ***
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      ='C:\DHRUV.TXT'
       FILETYPE                      = 'DAT'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   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.
    *do.
    LOOP AT record.
    *read dataset dataset into record.
    if sy-subrc <> 0. exit. endif.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-MATNR_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_004.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(02)'
                                  record-KZSEL_02_005.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_006.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_007.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_008.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM01'.
    *enddo.
    ENDLOOP.
    perform close_group.
    *perform close_dataset using dataset.
    *Text elements
    * E00 Error opening dataset, return code:
    * I01 Session name
    * I02 Open session
    * I03 Insert transaction
    * I04 Close Session
    * I05 Return code =
    * I06 Error session created
    * S01 Session name
    * S02 User
    * S03 Keep session
    * S04 Lock date
    * S05 Processing Mode
    * S06 Update Mode
    * S07 Generate session
    * S08 Call transaction
    * S09 Error sessn
    * S10 Nodata indicator
    * S11 Short log
    *Messages
    * Message class: MS
    *613   Please enter a session name and user name
    The Below is the coding for the Call Transaction...
    report ZDS_BDC_MM01_2
           no standard page heading line-size 255.
    *include bdcrecx1.
    *parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record OCCURS 0,
    * data element: MATNR
            MATNR_001(018),
    * data element: MBRSH
            MBRSH_002(001),
    * data element: MTART
            MTART_003(004),
    * data element: XFELD
            KZSEL_01_004(001),
    * data element: MAKTX
            MAKTX_005(040),
    * data element: MEINS
            MEINS_006(003),
    * data element: MTPOS_MARA
            MTPOS_MARA_007(004),
          end of record.
    DATA: FLNAME TYPE STRING.
    *** End generated data section ***
    DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
    *** MESSAGE******
    DATA: BEGIN OF MESSTAB OCCURS 0.
            INCLUDE STRUCTURE BDCMSGCOLL.
            DATA: MATNR TYPE MARA-MATNR,
          END OF MESSTAB.
    ****END OF MESSAGE****
    PARAMETERS: FILENAME TYPE RLGRAP-FILENAME.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.
      CALL FUNCTION 'F4_FILENAME'
       IMPORTING
         FILE_NAME           = FILENAME.
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    FLNAME = FILENAME.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FLNAME
        FILETYPE                      = 'DAT'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   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.
    LOOP AT record.
      DATA:
        CNT TYPE I.
        CNT = CNT + 1.
        REFRESH BDCDATA.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MTART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-MATNR_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_004.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_005.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_006.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_007.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    *perform bdc_transaction using 'MM01'.
    CALL TRANSACTION 'MM01' USING BDCDATA
                            MODE 'N'
                            UPDATE 'A'
                            MESSAGES INTO MESSTAB.
    READ TABLE MESSTAB INTO MESSTAB INDEX CNT.
       IF MESSTAB-MSGTYP = 'E'.
         MESSTAB-MATNR = RECORD-MATNR_001.
         MODIFY MESSTAB INDEX CNT FROM MESSTAB. " TRANSPORTING MATNR.
       ENDIF.
    ENDLOOP.
    FORM OPEN_GROUP.
      CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING  CLIENT   = SY-MANDT
                        GROUP    = 'MM01'
                        USER     = SY-UNAME
                        KEEP     = 'X'.
    ENDFORM.
    FORM BDC_INSERT.
      CALL FUNCTION 'BDC_INSERT'
       EXPORTING
         TCODE                  = 'MM01'
    *     POST_LOCAL             = NOVBLOCAL
    *     PRINTING               = NOPRINT
    *     SIMUBATCH              = ' '
    *     CTUPARAMS              = ' '
        TABLES
          DYNPROTAB              = BDCDATA
       EXCEPTIONS
         INTERNAL_ERROR         = 1
         NOT_OPEN               = 2
         QUEUE_ERROR            = 3
         TCODE_INVALID          = 4
         PRINTING_INVALID       = 5
         POSTING_INVALID        = 6
         OTHERS                 = 7
      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.
    END-OF-SELECTION.
    LOOP AT MESSTAB.
        IF MESSTAB-MSGTYP = 'E'.
          WRITE:/ 'ERROR OCCURED ON MATNR = ',MESSTAB-MATNR , 'MESSAGE : MATNR ALREADY EXISTS IN MARA!!!'.
        ENDIF.
      ENDLOOP.
    perform close_group.
    *perform close_dataset using dataset.
    *&      Form  close_group
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM close_group .
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
       NOT_OPEN          = 1
       QUEUE_ERROR       = 2
       OTHERS            = 3
    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.                    " close_group
    *&      Form  bdc_dynpro
    *       text
    *      -->P_0270   text
    *      -->P_0271   text
    FORM bdc_dynpro  USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
    *       text
    *      -->P_0275   text
    *      -->P_0276   text
    FORM bdc_field  USING  FNAM FVAL.
      IF FVAL <> ' '.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.                    " bdc_field
    *Text elements
    * E00 Error opening dataset, return code:
    * I01 Session name
    * I02 Open session
    * I03 Insert transaction
    * I04 Close Session
    * I05 Return code =
    * I06 Error session created
    * S01 Session name
    * S02 User
    * S03 Keep session
    * S04 Lock date
    * S05 Processing Mode
    * S06 Update Mode
    * S07 Generate session
    * S08 Call transaction
    * S09 Error sessn
    * S10 Nodata indicator
    * S11 Short log
    HTH
    Regards,
    Dhruv Shah

  • Need BDC code for Call Transaction of VL31N, which creates Inbound del.s,

    Hi Experts,
    Is any body does have the BDC (CALL TRANSACTION) code for VL31N transaction, where we can crete INBOUND deliveries from Purc Orders.
    Actually, currently am doing by using FM - GN_DELIVERY_CREATE, but, its not given me a chance to incorporate BATCH SPLIT functionality. So, decided to go with BDC
    1 - Is this VL31N is Okay for BDC, bcoz, some where I red that, since its a ENJOY tx, its NOT recommended?
    2 - Is there any other FM, BAPI to create INBOUND deliveries from POs, which can take care of BATCH SPLIT functionality?
    3 - BDC code for VL31N  tx.
    thanq
    Edited by: Srinivas on Jul 29, 2008 1:47 PM

    1 - Is this VL31N is Okay for BDC, bcoz, some where I red that, since its a ENJOY tx, its NOT recommended?
    yes you can do that .
    2 - Is there any other FM, BAPI to create INBOUND deliveries from POs, which can take care of BATCH SPLIT functionality?
    using BDC we can achieve the  Barch split functionality.
    3 - BDC code for VL31N tx.
    Record using SHDB it will give you.

  • BDC recording for transaction 'Me01'

    Hi,
    Can u help me in BDC recording for transaction 'ME01' .
    I have no idea for transaction 'ME01' .
    give sample code if possible.
    Thanks

    For creating source list you will check that purchasing view has been maintained for this material
    Source list for resticting, purcasing a material from a specific vendor only for the period specified in source list
    Regards,
    Amit R.

  • Problem in creating a BDC program for transaction cj20n(project sytem)

    Hi all,
    I am trying to create project,WBS element ,network and activity using a BDC program,
      I am able to create to a recording for the transaction cj20n using tcode shdb but when i run the recording it doesnt run properly i am not able to create any thing.
    I get error saying that a particular field doesnt exist on the screen.
    Is possible to create a BDC program for transaction CJ20N ?
    Also is there any other alternative  apart from using a BAPI or a function module.
    Thanks,
    Nishant

    Hi,
        Check below link for BAPIs of transaction cj20n.
    [BAPI for cj20n|BAPI for CJ20N transaction]
    Thanks,
    Asit Purbey.

  • BDC code for a PUSHBUTTON

    Hi,
      Can anybody please tell the  BDC CODE FOR A PUSH BUTTON.
    THANKS IN ADVANCE

    which program? which pushbutton?

  • BDC code for MB01 Application(Multiple Line Items)

    Hi,
    Can anybody please send me the BDC CODE for MB01 Application(for Multiple Line items).
    Very urgent.
    Thanks And Regards,
    Ajay

    Instead of BDC you can use following BAPI.
    see the following ex:
    BAPI TO Upload Inventory Data
    GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
                         02 - MB31 - Goods Receipts for Prod Order
                         03 - MB1A - Goods Issue
                         04 - MB1B - Transfer Posting
                         05 - MB1C - Enter Other Goods Receipt
                         06 - MB11
    Domain: KZBEW - Movement Indicator
         Goods movement w/o reference
    B - Goods movement for purchase order
    F - Goods movement for production order
    L - Goods movement for delivery note
    K - Goods movement for kanban requirement (WM - internal only)
    O - Subsequent adjustment of "material-provided" consumption
    W - Subsequent adjustment of proportion/product unit material
    LOOP AT I_TAB.
          count = sy-tabix.
          SELECT SINGLE * FROM ZMM_GI_WIP
                                    WHERE GI_NO = I_TAB-DOCNO AND
                                    GI_DATE = I_TAB-DOCDT.
          IF SY-SUBRC = 0.
            I_TAB-FLAG = 'C'.
            modify i_tab index count.
            CONCATENATE 'ERROR  GI : ' I_TAB-DOCNO
            '  WAS ALREADY UPLOADED' INTO I_MSG1.
            APPEND I_MSG1.
            CLEAR I_TAB-FLAG.
            CONTINUE.
          ELSE.
            CONCATENATE I_TAB-DOCDT+4(2)
                        I_TAB-DOCDT+6(2)
                        I_TAB-DOCDT+2(2)
                        I_TAB-DOCDT+0(2)
                        INTO G_DATE.
            gmhead-pstng_date = G_DATE.
            gmhead-doc_date = sy-datum.
            gmhead-pr_uname = sy-uname.
    "01 - MB01 - Goods Receipts for Purchase Order
            gmcode-gm_code = '03'.
            refresh itab.
            clear itab.
            SORT I_MAIN BY SOL_DOCNO.
            LOOP AT I_MAIN WHERE DOCNO = I_TAB-DOCNO.
              IF I_MAIN-GI_TXN_TYPE = 'MGI'.
                itab-move_type  = '291'.
              ENDIF.
              itab-mvt_ind    = ' '.
              itab-plant      = I_MAIN-WERKS.
              itab-material   = I_MAIN-MATNR.
              itab-entry_qnt  = I_MAIN-ERFMG.
              itab-stge_loc   = I_MAIN-LGOBE.
              itab-ENTRY_UOM = I_MAIN-ERFME.
              IF I_MAIN-WERKS = 'MR'.
                itab-TR_PART_BA = '11'.
              ELSEIF I_MAIN-WERKS = 'MR'.
                itab-TR_PART_BA = '12'.
              ENDIF.
              append itab.
            ENDLOOP.
            if not itab[] is initial.
              call function 'BAPI_GOODSMVT_CREATE'
               exporting
                   goodsmvt_header             = gmhead
                   goodsmvt_code               = gmcode
                 *   TESTRUN                     = ' '
              IMPORTING
                  goodsmvt_headret            = mthead
             *   MATERIALDOCUMENT            =
      MATDOCUMENTYEAR             =
               tables
                 goodsmvt_item               = itab
      GOODSMVT_SERIALNUMBER       =
                return                      = errmsg.
              clear errflag.
              loop at errmsg.
                if errmsg-type eq 'E'.
                  write:/'Error in function', errmsg-message.
                  errflag = 'X'.
                else.
                  write:/ errmsg-message.
                endif.
                move errmsg-message to i_msg1.
                append i_msg1.
              endloop.
              if errflag is initial.
                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                WAIT          =
              IMPORTING
                RETURN        =
               commit work and wait.
                if sy-subrc ne 0.
                  write:/ 'Error in updating'.
                  exit.
                 endif.
            endif.
          ENDIF.
           wait up to 20 seconds.
        ENDLOOP.

  • What is TRANSACTION CODE for TRANSACTION VARIANTS?

    what is TRANSACTION CODE for TRANSACTION VARIANTS?
    please explain

    Hi..
    Goto Tcode: SHD0.
    Create a Transaction Variant :
      Name : ZTVAR1.
      Tcode: MK01
    Save the Settings of Screens as Screen Variants.
    Finally Save the Transaction variant.
    Goto Tcode: SE93.
    Create a Transaction code (Eg: Zmk01) of type Variant transaction.
    Assign ur Transaction variant here.
    Now Save and Execute ZMK01.
    <b>Reward if Helpful.</b>

  • Bdc code for transfer of asset plant wise stock transfer (urgent)

    hi all,
    if anyone has done BDC for this scenario ie.,
    bdc for transfer of asset plant wise stock transfer
    then plz share its code with me.and if someone has done any modification regarding this scenario then plz let me know that what modification he/she has carried out in this & share the code for the same.
    i will be grateful to u for this and promise that i will give points to all ur effort.
    Thanks & regards
    Sanjeev

    Hi Sanjeev,
    Do a recording for the transaction using SHDB. Once you are done with the recording save the recording into a zprogram. You have the code.
    Regards
    Arun

  • T.code for transaction type groups (FI-AA)

    Hi Friends,
    Please can you tell me the t,code for creating transaction type groups. ( Transaction type groups are attached to transaction types in t.code AO73).
    Thanks & Regards
    Bhairavi

    Hiya,
    T.Code: OAVJ
    However, I wouldn't create Transaction Group Types if I were you... since there is a lot of config behind it that you need to be careful with.
    I assume you know what you are doing.
    Cheers.

  • BDC Code for Loan to Employees

    Dear Friends,
    I have to write a BDC where I have to debit the G/L of Empoyee Loan and credit individual employee accounts.
    If you have a similar BDC code available with you please share the same with me.
    Regards,
    Alok.

    hi
    First go to tcode SHDB, there select new recording,give a name for the recording and then give the tcode for which u would want to do recording. Now, enter all the values in the tcode completely and then save it.
    Now, come back to shdb,..select ur recording and say create a program tab. Select option from the recording aand then save the program..save the program.
    Now, upload the flat file from PC using GUI_upload for txt file and ALSM_EXCEL_TO_INTERNAL_TABLE..
    Now, pass the internal table values to the perform statements or subroutines and put them in a loop.
    Regards,
    Vishwa.

  • Need to write BDC program for Transaction VA01(Sales order creation)

    Dear Friends,
    I need to write a BDC program for uploading data into sap from an excel sheet file. The data contain Material Description,Customer Name,Date of Delivery,Quantity,Unit of measure etc.
    material desc customer date of delivery quantity unit of measure
    abcdf xyz ltd 24.12.2011 2 4 gm
    The transaction is VA01.How will I find the correct fields and related tables? What are the related fields needed in the transaction VA01.
    Thanking you
    Sacheen Pukhrambam
    Moderator Message: Put some self-effort before posting your question. Thread locked.
    Edited by: Suhas Saha on Nov 25, 2011 1:25 PM

    Hello,
    You could try using a BDC with VL04 but first preference would be to see if there are any BAPI functions (search for BAPI) that can do this.
    If BUS2032 doesn't have an attribute that you want (eg shipping point) then sub-delegate to ZBUS2032 and add the attribute, it's straightforward. You just have to know how to determine the value programmatically.
    regards
    Rick Bakker
    hanabi technology

  • Problem in BDC recording for transaction /J4I/015W3A

    hello all,
    i am recording for transaction /J4I/015W3A it has 4 select options if we enter all select options and press enter it will guide to another screen which has table control . i need the fill the entries there also and save the recording.
    i have completed recording with all the steps.
    if i try to run the report with this recording the problem is that  the first screen  the entries which i have entered in  select options are not defaulted and instead first enter okcode is getting triggered as there are no values on select options and enter is triggered an error message is displayed saying enter all the values .
    how can i over come this problem...........?

    hi,
      while recording, ok code will come first, for each screen you have to kept ok code at last .
      This will work.
    regards,
    pavan

  • Set up Payment Methods Per Company code for Transaction

    Hi All,
    Can any expert please suggest whether do we need to enter only paying company codes while defining the payment methods per company code or enter all company codes.
    Ex: We have 10 company codes for which there are 3 paying company codes. After defining the payment methods in the country, while defining payment methods per company code do we need to define for only 3 paying company codes or for all 10 company codes. Because when you are paying through one company code on behalf of three company codes, how does it make sense having the payment method in company codes which are not paying. I hope my query is sensible.
    Thanks&Regards
    Srinivas

    Hi,
    You should define the payment method in all the 10 company codes regarding they are the paying or non paying company code.
    If you are not defining them they you will not have the option to select the payment for that particular company code.
    regards
    pbb

Maybe you are looking for