Application Development and Automation 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: 
Read only

IDOC

Former Member
0 Likes
618

Hi,

I created one IDOC inbound program, i want to store IDOC values to table. But here IDOC number should take automatically from the EDID4 table nobody should give IDOC number as input.How i can do it. If anybody know please tell.

4 REPLIES 4
Read only

former_member404244
Active Contributor
0 Likes
525

Hi,

For inbound idoc program u will get the idoc number straight away ryt,use the number and retrieve the data from EDID4 table.

check the below sample code..

FUNCTION zdtsint052f_gpoms_to_sap_gm.

*"----


""Local interface:

*" IMPORTING

*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD

*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC

*" EXPORTING

*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT

*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR

*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK

*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS

*" TABLES

*" IDOC_CONTRL STRUCTURE EDIDC

*" IDOC_DATA STRUCTURE EDIDD

*" IDOC_STATUS STRUCTURE BDIDOCSTAT

*" RETURN_VARIABLES STRUCTURE BDWFRETVAR

*" SERIALIZATION_INFO STRUCTURE BDI_SER

*" EXCEPTIONS

*" WRONG_FUNCTION_CALLED

*"----


  • Purpose :On recording the material consumption from *

  • manufacturing tickets in GPOMS system, GPOMS *

  • will report the data to the SAP system.Based *

  • on this message, goods issue to the process order*

  • will be posted in SAP. This interface will *

  • used for storage location managed materials *

  • in SAP. *

  • Program Logic :Loop at the data records of IDOC and to get the *

  • Order number and SAP Movement type *

  • If the Material document already exists for this *

  • Order number and Movement type then give error *

  • else call standard FM 'BAPI_IDOC_INPUT1' to *

  • Material Documents in SAP. *

************************************************************************

  • Declaration of Constants *

************************************************************************

CONSTANTS :lc_item_create(25) TYPE c VALUE 'E1BP2017_GM_ITEM_CREATE',

lc_mbgmcr(6) TYPE c VALUE 'MBGMCR'.

************************************************************************

  • Declaration of Variables *

***********************************************************************

DATA : lv_index TYPE sytabix,

lv_retcode type sy-subrc.

************************************************************************

  • Declaration of Workareas *

************************************************************************

DATA: lwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create,

lwa_data TYPE edidd, " Work area for IDOC

lwa_control TYPE edidc. " Work Area for control rec

  • Read the control data information of idoc.

loop at idoc_contrl INTO lwa_control Where mestyp = lc_mbgmcr.

  • Extract the data from the segments.

LOOP AT idoc_data INTO lwa_data

WHERE docnum = lwa_control-docnum and

segnam = lc_item_create.

*->> Set the tabix of the internal table

lv_index = sy-tabix.

  • Move the Material Document Item Segment data

MOVE lwa_data-sdata TO lwa_e1bp2017_gm_item_create.

  • Modify the material document item data internal table

PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create.

*->> set the changed values to the IDOC SDATA

MOVE lwa_e1bp2017_gm_item_create TO lwa_data-sdata.

*->> Modify the table

MODIFY idoc_data FROM lwa_data index lv_index.

  • Clear the Work areas

CLEAR : lwa_data,

lwa_e1bp2017_gm_item_create.

ENDLOOP. "LOOP AT t_idoc_data

  • Call the BAPI function module to create the

  • appropriate Material Document

CALL FUNCTION 'BAPI_IDOC_INPUT1'

EXPORTING

input_method = input_method

mass_processing = mass_processing

IMPORTING

workflow_result = workflow_result

application_variable = application_variable

in_update_task = in_update_task

call_transaction_done = call_transaction_done

TABLES

idoc_contrl = idoc_contrl

idoc_data = idoc_data

idoc_status = idoc_status

return_variables = return_variables

serialization_info = serialization_info

EXCEPTIONS

wrong_function_called = 1

OTHERS = 2.

IF sy-subrc = 1.

RAISE wrong_function_called.

ENDIF.

endloop.

ENDFUNCTION.

Reward if helpful.

Reagrds,

Nagaraj

Read only

Former Member
0 Likes
525

Hi uday,

EDID4,EDIDC,EDIDS table will get populated automatically when you are creating IDOC.How you are creating inbound IDOC through your program?i am confused why you want to take IDOC number from EDID4 table?please give details so that we can give some solution

regards

shibu

Read only

Former Member
0 Likes
525

I want to store IDOC values to another one sap tables. So i need to get IDOC values from EDID4 table

Read only

0 Likes
525

Hi,

U can get it ryt..I ahve given the code,plz go through it ,u will get the idoc number from idoc data and then use that number and retrieve the data from edid4 and then update other sap tables..

Regards,

nagaraj