Skip to Content
0
Former Member
Jul 19, 2007 at 10:03 AM

INSERT STATEMENT ERROR

25 Views

HI,

I try to insert the data in database

but one error will coming

''The work area "CUSTOMER_T" is not long enough .'' .

FUNCTION ZRFC_CUSTOMER_INSERT.

*"----


""Local Interface:

*" EXPORTING

*" VALUE(RFCRC) LIKE SY-SUBRC

*" VALUE(ERROR_TEXT) TYPE T100-TEXT

*" TABLES

*" CUSTOMER_T STRUCTURE BRFCKNA1 OPTIONAL

*" EXCEPTIONS

*" INSERT_ERROR

*"----


DATA INSERT_VIA_CALL_TRANSACTION VALUE 'X'.

LOOP AT CUSTOMER_T.

IF INSERT_VIA_CALL_TRANSACTION = 'X'.

  • update via CALL TRANSACTION

PERFORM BDC_INIT.

PERFORM BDC_NEXT_DYNPRO USING 'SAPMF02D' 101.

  • PERFORM BDC_SET_FIELD USING 'RF02D-KUNNR' CUSTOMER_T-KUNNR.

PERFORM BDC_SET_FIELD USING 'RF02D-D0110' 'X'.

PERFORM BDC_NEXT_DYNPRO USING 'SAPMF02D' 110.

PERFORM BDC_SET_FIELD USING 'KNA1-KUNNR' CUSTOMER_T-KUNNR.

PERFORM BDC_SET_FIELD USING 'KNA1-ANRED' CUSTOMER_T-ANRED.

PERFORM BDC_SET_FIELD USING 'KNA1-NAME1' CUSTOMER_T-NAME1.

PERFORM BDC_SET_FIELD USING 'KNA1-PFACH' CUSTOMER_T-PFACH.

PERFORM BDC_SET_FIELD USING 'KNA1-STRAS' CUSTOMER_T-STRAS.

PERFORM BDC_SET_FIELD USING 'KNA1-PSTLZ' CUSTOMER_T-PSTLZ.

PERFORM BDC_SET_FIELD USING 'KNA1-ORT01' CUSTOMER_T-ORT01.

PERFORM BDC_SET_FIELD USING 'KNA1-TELF1' CUSTOMER_T-TELF1.

PERFORM BDC_SET_FIELD USING 'KNA1-TELFX' CUSTOMER_T-TELFX.

PERFORM BDC_SET_FIELD USING 'BDC_OKCODE' '=UPDA'.

PERFORM BDC_CALL USING 'XD02' CHANGING ERROR_TEXT.

INSERT INTO KNA1 VALUES CUSTOMER_T.

*INSERT INTO KNA1 KUNNR,ANRED,NAME1,PFACH,STRAS,PSTLZ,ORT01,

  • TELF1,TELFX VALUES

KNA1-KUNNR = CUSTOMER_T-KUNNR,

KNA1-ANRED = CUSTOMER_T-ANRED,

KNA1-NAME1 = CUSTOMER_T-NAME1,

KAN1-PFACH = CUSTOMER_T-PFACH,

KAN1-STRAS = CUSTOMER_T-STRAS,

KAN1-PSTLZ = CUSTOMER_T-PSTLZ,

KAN1-ORT01 = CUSTOMER_T-ORT01,

KAN1-TELF1 = CUSTOMER_T-TELF1,

KAN1-TELFX = CUSTOMER_T-TELFX.

ENDIF.

  • exception handling

IF SY-SUBRC NE 0.

RFCRC = SY-SUBRC.

  • raise update_error.

ENDIF.

ENDLOOP.

*

ENDFUNCTION.

*----


*

  • Start new screen

*

*----


FORM BDC_INIT.

CLEAR BDC_CALL.

APPEND BDC_CALL.

ENDFORM. "BDC_INIT

FORM BDC_NEXT_DYNPRO USING program dynpro.

CLEAR BDC_CALL.

BDC_CALL-program = program.

BDC_CALL-dynpro = dynpro.

BDC_CALL-dynbegin = 'X'.

APPEND BDC_CALL.

ENDFORM. "BDC_NEXT_DYNPRO

*----


*

  • Insert field

*

*----


FORM BDC_SET_FIELD USING fnam fval.

IF fval <> space.

CLEAR BDC_CALL.

BDC_CALL-fnam = fnam.

BDC_CALL-fval = fval.

APPEND BDC_CALL.

ENDIF.