Skip to main content

YCLASSICAL_JOINING

*&---------------------------------------------------------------------* *& Report  YCLASSICAL_JOINING *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT   yclassical_joining  NO   STANDARD   PAGE  HEADING                               LINE - SIZE   110                               LINE - COUNT   255                               MESSAGE - ID  z...

SAP ABAP Program to Send IDOC

SAP ABAP Program to Send IDOC
This is the SAP ABAP Program to send custom Idoc ,it useful for SAP ABAP Developers who are developing idocs .
*&---------------------------------------------------------------------*
*& Report ZIDOC_PROGRAM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZIDOC_PROGRAM.
types : begin of zidoc_table,
zid type zid,
zname type znname2,
zcity type zcity,
END OF zidoc_table.
DATA :it_zidoc type TABLE OF zidoc_table,
wa_zidoc type zidoc_table,
s_segment type zidoc_segment,
it_ddic type TABLE OF edidc,
wa_ddic type edidc,
it_eddis type TABLE OF edids,
wa_eddis type edids,
it_eddid type TABLE OF edidd,
wa_eddid type edidd.
CONSTANTS : c_zseg like edidd-segnam VALUE 'zidoc_segment'.
*SELECTION-SCREEN :
select-OPTIONS : s_zid for wa_zidoc-zid.
PARAMETERS : p_mestyp type edidc-mestyp,
p_prtnr type edidc-rcvprt,
p_ddidc type edidc-idoctp,
p_lgsys type edidc-rcvprn,
p_port type edidc-rcvpor,
p_sndsys type edidc-sndprn,
p_sndprt type edidc-sndprt.
perform generate_datarecords.
perform generate_controlrecords.
perform send_idoc.
*&---------------------------------------------------------------------*
*& Form GENERATE_DATARECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GENERATE_DATARECORDS .
select zid zname zcity from zidoc_table into table it_zidoc where zid in s_zid.
PERFORM arrange-datarecords.
ENDFORM. " GENERATE_DATARECORDS
*&---------------------------------------------------------------------*
*& Form GENERATE_CONTROLRECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GENERATE_CONTROLRECORDS .
wa_ddic-rcvpor = p_port.
wa_ddic-mestyp = p_mestyp.
wa_ddic-idoctp = p_ddidc.
wa_ddic-rcvprt = p_prtnr.
wa_ddic-rcvprn = p_lgsys.
wa_ddic-sndprt = p_sndprt.
wa_ddic-sndprn = p_sndsys.
ENDFORM. " GENERATE_CONTROLRECORDS
*&---------------------------------------------------------------------*
*& Form SEND_IDOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SEND_IDOC .
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = wa_ddic
* OBJ_TYPE = ''
* CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = it_ddic
MASTER_IDOC_DATA = it_eddid
* EXCEPTIONS
* ERROR_IN_IDOC_CONTROL = 1
* ERROR_WRITING_IDOC_STATUS = 2
* ERROR_IN_IDOC_DATA = 3
* SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
* OTHERS = 5
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " SEND_IDOC
*&---------------------------------------------------------------------*
*& Form ARRANGE-DATARECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ARRANGE-DATARECORDS .
loop at it_zidoc INTO wa_zidoc.
s_segment-zid = wa_zidoc-zid.
s_segment-zname = wa_zidoc-zname.
s_segment-zcity = wa_zidoc-zcity.
wa_eddid-segnam = c_zseg.
wa_eddid-sdata = s_segment.
append wa_eddid to it_eddid.
clear wa_eddid.
endloop.
ENDFORM. " ARRANGE-DATARECORDS.

Comments

Popular posts from this blog

How to Create SAP ABAP Query Using SQ01 Step by Step Guide

How to Create SAP ABAP Query Using SQ01 Step by Step. You can create ABAP query objects ,if they are not exist in the SAP system. You can create SAP query without  ABAP programming knowledge. ABAP Query provides users with a variety of ways to define and create different types of  reports , such as  Basic Lists ,  Stats , and  Sorted Lists . ABAP query consists of four elements: Queries InfoSets Groups Translation query Queries The query component is used by end users for Queries. You can create queries, change and queries executed. Transaction  SQ01. Trnslation component / QUERY Many texts to define queries, InfoSets and user groups are generated. These texts are displayed in the language we choose to access the SAP system. We can compare the text or languages ​​that use this component. InfoSets InfoSets are the views of the Special Data Sources. An InfoSet Describes the fields of a data source that can be reported in the q...

ALV Field Catalog in SAP ABAP

ALV Field Catalog in SAP ABAP Field Catalog Field catalog is an internal table which is used to pass a list of fields to display in ALV report, we can set different properties to fields that will be display in ALV output. Type Group It is a data dictionary object which contains all the reusable user-defined types. Example for a type group is SLIS, which contains all the user-defined types for developing ALV reports. TYPE-POOLS is a keyword which is used to assign the type-group to a ALV report . Syntax : TYPE-POOLS SLIS . DATA : <IT_FCAT> TYPE SLIS_T_FIELDCAT_ALV . "INTERNAL TABLE FOR FIELD CATALOG DATA : <WA_FCAT> TYPE SLIS_FIELDCAT_ALV . " WORK AREA FOR FIELD CATLOG Field catalog types Field catalog: Field catalog is a format description of the display area. There are three procedures to build a FIELD CATALOG. 1. Automatic field catalog. 2. Semi-automatic field catalog. 3. Manual field catalog. Automatic field catalog. If the list structure has ...

SAP Table Structure T-codes

SAP table structure tcodes E11 - ABAP Dictionary Maintenance Basis - Dictionary Maintenance SE14 - Utilities for Dictionary tables Basis - Activation Program, Conversion Program, DB Utility, MC,  SPDDCU61 - Create table structure Cross Application - Object Dependencies CU63 - Display table structure Cross Application - Object Dependencies CU62 - Change table structure Cross Application - Object Dependencie CU64 - table structure List Cross Application - Object Dependencies LBWE - LO Data Ext.: Customizing Cockpit Logistics - Logistics Information System (LIS)RSA6 - Maintain DataSources Basis - BW Service APIRSO2 - Oltp Metadata Repository Basis - BW Service  APISE84 - Repository Information System Basis - Workbench Tools: Editors, Painters, Modelers SE38 - ABAP Editor Basis - ABAP Editor SE16 - Data Browser Basis - Workbench Utilities SM30 - Call View Maintenance Basis - Table Maintenance Tool SE37 - ABAP Function Modules Basis - Function Builder SE80 - Object N...