Skip to Content

RFC Program, data not populating in the table

Hello,

I am new to SAP R/3. I know basics of abap reports. So i am trying to write a RFC program in se37 to insert the data from external application. I have written the code as below,

DATA: lt_/ZFK/HEADERTAB_EDI_APRK TYPE STANDARD TABLE OF /ZFK/EDIMSG_APR1,
lt_/ZFK/POSITIONTAB_EDI_APRK TYPE STANDARD TABLE OF /ZFK/EDIMSG_APR2.

*local structure
DATA: ls_/ZFK/EDI_HEADER_APRK TYPE /ZFK/LSZFKEDI_MSG_APR1,
ls_/ZFK/EDI_POSITION_APRK TYPE /ZFK/LSZFKEDI_MSG_APR2.

*local input structure
DATA: ls_/ZFK/EDI_HEADER_APRK_INPUT TYPE /ZFK/LSZFKEDI_MSG_APR1,
ls_/ZFK/EDI_POS_APRK_INPUT TYPE /ZFK/LSZFKEDI_MSG_APR2.

*field symbols
FIELD-SYMBOLS: <ls_/ZFK/EDI_HEADER_APRK> TYPE /ZFK/LSZFKEDI_MSG_APR1,
<ls_/ZFK/EDI_POSITION_APRK> TYPE /ZFK/LSZFKEDI_MSG_APR2.

cl_system_uuid=>if_system_uuid_static~create_uuid_c32( ).

LOOP AT Z_EDI_SD_APRK_HEADERTAB INTO ls_/ZFK/EDI_HEADER_APRK.

ls_/ZFK/EDI_HEADER_APRK_INPUT-TDATE = ls_/ZFK/EDI_HEADER_APRK-TDATE.
ls_/ZFK/EDI_HEADER_APRK_INPUT-TTIME = ls_/ZFK/EDI_HEADER_APRK-TTIME.
ls_/ZFK/EDI_HEADER_APRK_INPUT-SENDNR = ls_/ZFK/EDI_HEADER_APRK-SENDNR.
ls_/ZFK/EDI_HEADER_APRK_INPUT-PEBENE = ls_/ZFK/EDI_HEADER_APRK-PEBENE.
ls_/ZFK/EDI_HEADER_APRK_INPUT-BELNR = ls_/ZFK/EDI_HEADER_APRK-BELNR.
ls_/ZFK/EDI_HEADER_APRK_INPUT-MDATE = ls_/ZFK/EDI_HEADER_APRK-MDATE.
ls_/ZFK/EDI_HEADER_APRK_INPUT-HEADERTEXT = ls_/ZFK/EDI_HEADER_APRK-HEADERTEXT.
ls_/ZFK/EDI_HEADER_APRK_INPUT-ANZAHLF = ls_/ZFK/EDI_HEADER_APRK-ANZAHLF.
ls_/ZFK/EDI_HEADER_APRK_INPUT-RECHNR = ls_/ZFK/EDI_HEADER_APRK-RECHNR.
ls_/ZFK/EDI_HEADER_APRK_INPUT-REFNR = ls_/ZFK/EDI_HEADER_APRK-REFNR.
ls_/ZFK/EDI_HEADER_APRK_INPUT-DATECODE = ls_/ZFK/EDI_HEADER_APRK-DATECODE.
ls_/ZFK/EDI_HEADER_APRK_INPUT-PARTNERNUMMER = ls_/ZFK/EDI_HEADER_APRK-PARTNERNUMMER.
ls_/ZFK/EDI_HEADER_APRK_INPUT-PARTNERNAME = ls_/ZFK/EDI_HEADER_APRK-PARTNERNAME.
ls_/ZFK/EDI_HEADER_APRK_INPUT-EMPFANGER = ls_/ZFK/EDI_HEADER_APRK-EMPFANGER.
ls_/ZFK/EDI_HEADER_APRK_INPUT-EMPFANGERNAME = ls_/ZFK/EDI_HEADER_APRK-EMPFANGERNAME.

APPEND ls_/ZFK/EDI_HEADER_APRK_INPUT to lt_/ZFK/HEADERTAB_EDI_APRK.

ENDLOOP.

LOOP AT Z_EDI_SD_APRK_POSITIONTAB INTO ls_/ZFK/EDI_POSITION_APRK.

ls_/ZFK/EDI_POS_APRK_INPUT-ECODE = ls_/ZFK/EDI_POSITION_APRK-ECODE.
ls_/ZFK/EDI_POS_APRK_INPUT-FEHLERTEXT = ls_/ZFK/EDI_POSITION_APRK-FEHLERTEXT.
ls_/ZFK/EDI_POS_APRK_INPUT-ERRTEXT1 = ls_/ZFK/EDI_POSITION_APRK-ERRTEXT1.
ls_/ZFK/EDI_POS_APRK_INPUT-ERRTEXT2 = ls_/ZFK/EDI_POSITION_APRK-ERRTEXT2.
ls_/ZFK/EDI_POS_APRK_INPUT-ERRTEXT3 = ls_/ZFK/EDI_POSITION_APRK-ERRTEXT3.
ls_/ZFK/EDI_POS_APRK_INPUT-ERRTEXT4 = ls_/ZFK/EDI_POSITION_APRK-ERRTEXT4.
ls_/ZFK/EDI_POS_APRK_INPUT-ERRTEXT5 = ls_/ZFK/EDI_POSITION_APRK-ERRTEXT5.
ls_/ZFK/EDI_POS_APRK_INPUT-FLINE = ls_/ZFK/EDI_POSITION_APRK-FLINE.
ls_/ZFK/EDI_POS_APRK_INPUT-PLINE = ls_/ZFK/EDI_POSITION_APRK-PLINE.

APPEND ls_/ZFK/EDI_POS_APRK_INPUT TO lt_/ZFK/POSITIONTAB_EDI_APRK.


ENDLOOP.

IF sy-subrc = 0.
INSERT /ZFK/EDIMSG_APR1 FROM TABLE lt_/ZFK/HEADERTAB_EDI_APRK.
INSERT /ZFK/EDIMSG_APR2 FROM TABLE lt_/ZFK/POSITIONTAB_EDI_APRK.
ENDIF.

ENDFUNCTION.

There is no errors, Please help me to look into it.

Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Feb 11 at 01:48 PM

    You wrote a 'RFC program in se37', should be a Function Module, RFC enabled,

    So what's your exact problem, you dislike corresponding statements?

    Add comment
    10|10000 characters needed characters exceeded

    • This RFC module as been mapped in the Process Orchestration system from where the data is sent. This sent data is in XML in the PO system. I have to view the those mapped table in the SAP system. Yes Z_EDI_SD_APRK_HEADERTAB is the name of the parameter in the FM.

  • Feb 11 at 02:20 PM

    Hi,

    there are many possibilities for an error. Is the code you attached, the code of a function module? "Who" executes the functino module, a se38 report? Same System or other System via RFC`? Who does the commit work? Why do you have a "IF SY-SUBRC = 0" after ENDLOOP? (Make no sense here, but a check of the SY-SUBRC after INSERT would be great) ...

    lg Johann

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 11 at 02:54 PM

    Can you debug to the insert code part? If yes, then check the SY-SUBRC and check if later a COMMIT WORK is executet.

    Another common mistake in RFC calls is that the parameter names are not completely identical. Check/Compare the names of the parameters of your function and the reporte in the other system.

    What do you mean with the "PO" System? If you want to execute the COMMIT WORK by the remote system, you have to do this by BAPI_TRANSACTION_COMMIT.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 11 at 03:23 PM

    Thank you all for the help it is working fine now

    There was some problem from the source system.

    Add comment
    10|10000 characters needed characters exceeded