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: 

iNSERTINR ANOTHER ERROR

Former Member
0 Kudos

hI,

i Change the Structure of CUSTOMER_T to KNA1 from BRFCKNA1</b>'

BUT another Error will be shown

''Comma without preceding colon (after INSERT ?).''

FUNCTION ZRFC_CUSTOMER_INSERT.

*"----


""Local Interface:

*" EXPORTING

*" VALUE(RFCRC) LIKE SY-SUBRC

*" VALUE(ERROR_TEXT) TYPE T100-TEXT

*" TABLES

*" CUSTOMER_T STRUCTURE KNA1 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.

*DATA : CUSTOMER_T TYPE KNA1.

INSERT INTO KNA1(KUNNR,NAME1) VALUES (CUSTOMER_T-KUNNR,CUSTOMER_T-NAME1).

  • CUSTOMER_T-PFACH,

  • CUSTOMER_T-STRAS,

  • CUSTOMER_T-PSTLZ,

  • CUSTOMER_T-ORT01,

  • CUSTOMER_T-TELF1,

  • 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.

4 REPLIES 4

Former Member
0 Kudos

WHY ARE YOU WRITING A PROGRAM THAT DOES A DIRECT UPDATE TO KNA1.

WILL YOU PLEASE ANSWER THIS QUESTION!!!!!!!!!!!!!!!!!!!!!

Former Member
0 Kudos

Hello,

What is ur actual requirement.

U r performing a BDC in The Tcode XD02 then why u r inserting a value to the same table.

If u want to change the customer then use the BAPI

If you need to change the customer details in background use this

BAPI_CUSTOMER_CHANGEFROMDATA1

Check also :

BAPI_CUSTOMER_EDIT

or std prog RFBIDE00

If useful reward.

Vasanth

former_member235056
Active Contributor
0 Kudos

Hi,

INSERT INTO KNA1 ( KUNNR, NAME1) VALUES ( CUSTOMER_T-KUNNR, CUSTOMER_T-NAME1).

Check out for the spaces between two fields.

Regards,

Ameet

0 Kudos

Ameet,

Are you not curios as to why a direct update is being done or are you just after the points.