cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Program, data not populating in the table

0 Kudos

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.

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Thank you all for the help it is working fine now

There was some problem from the source system.

Föß
Active Participant
0 Kudos

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.

Föß
Active Participant
0 Kudos

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

0 Kudos

Yes the code attached is of fuction module. the se38 report executes the module and its from the other system. the commit work is done by the PO system.

raymond_giuseppi
Active Contributor
0 Kudos

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

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

jitendra_it
Active Contributor
0 Kudos

", you dislike corresponding statements?"

Wouldn't Corresponding will give performance issue for this much fields? OR a new(>=7.4) Corresponding is faster than normal field assignment?

0 Kudos

Yes i wrote the RFC Program in se37 and also i have enabled the Function module.

I am not able to get the data of the table fields when the message is sent from the target system. Its showing as No table entries found

raymond_giuseppi
Active Contributor
0 Kudos

This FM receive some data and try to insert this data in two database table, I suppose what you name target is the source system, how did they send the data, did you use the same signature for the RFC FM?

NB: The check on sy-subrc, prevent insertion of data if none ceceived in parameter Z_EDI_SD_APRK_HEADERTAB, is this the name of the parameter of the FM?

Can you provide the actual source of the RFC FM (header part should contains comment with the signature)

0 Kudos

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.