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

All about Classes in ABAP Object Oriented Programming?

All about Classes in ABAP Object Oriented Programming? Class describes real world Object that may be car ,home and Animal .In ABAP Object Oriented (OO)Programming ,Class concept is first and Fore most Topic ,so through this post ,we will learn class in ABAP and Types of class and How to create classes and Methods in SAP ABAP. Class consists the Properties and Attributes. Properties are Methods or Functions or Procedures. Attributes are Variables . One class can have Any number of Objects that is Object is like a class but object can never be a Class. Example :Car is a class ,Here class contains some common Properties for its related Objects. Object may be different companies like Ford Maruthi etc. Objects are instances of a class ,so for one class ,we can create many objects Class Definition in SAP ABAP Class: we can build an Object properties using class. The attributes of objects are defined by the components of the class, which describe the state and behavior of O...

What is SAP (System Applications Products)?

What is SAP (System Applications Products)? The following articles guides you everything about SAP ERP Systems. The first question which arises in our mind “what is SAP” ? what is SAP ERP software? which is the best SAP module and which module has a best scope for bright future ?? What does SAP stands for  – SAP stands for Systems, Applications and Products in data processing. • SAP is the fourth largest software company in the world. • The SAP R/3 system is a business software package designed to What is SAP (System Applications Products)? The following articles guides you everything about SAP ERP Systems. The first question which arises in our mind “what is SAP” ? and  what is SAP ERP software? which is the best SAP module and which module has a best scope for bright future  ?? What does SAP stands for – integrate all areas of a              business. • It provides end to end solutions for financials, manufacturing...

BDC Recording in SAP ABAP

BDC Recording in SAP ABAP Here ,I explained The Steps to record any  Transaction (Example: VA01) to create BDC(Batch Data Communication) Program. Step 1  Execute transaction  SHDB  . Step 2  Enter  name  for recording  Step 3  Enter  transaction  to be executed Step 4  The transaction will now be executed, simply enter the values in the screen fields which you want to record.  Step 5  Once you have finished the recording and selected the  save  button or exit the transaction you  Creating an ABAP program Using a BDC recording   Go to SHDB Transaction Code and Click on New Recording. Give the Record name and Transaction code and click on Start New Recording Button. Now enter the Bank country and Key Now enter the Bank name ,City ,country and street.  Now Save the Recording . Now select the created record and click on Program. Now give the program title ...