on 02-11-2019 12:26 PM
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.
Thank you all for the help it is working fine now
There was some problem from the source system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You wrote a 'RFC program in se37', should be a Function Module, RFC enabled,
So what's your exact problem, you dislike corresponding statements?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.