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

SAP ABAP ALV Reports Interview Questions and Answers for Experienced.

SAP ABAP ALV Reports Interview Questions and Answers for Experienced. Here, i am sharing very import real time oriented questions which are faced at several interviews on ALV Reports to help for freshers and experienced SAP ABAP consultants with appropriate answers . What is ALV? ALV stands for ABAP List Viewer. ALV gives us a standard List format and user interface to all our ABAP reports. ALV is created by a set of standard function modules provided by SAP. What are the uses of ALV reports? Sorting of records Filtering of records Totals and Sub-totals Download the report output to Excel/HTML Changing the order of the columns in the report Hide the unwanted columns from the report What are standard function modules used to create ALV? REUSE_ALV_LIST_DISPLAY Display an ALV list REUSE_ALV_GRID_DISPLAY Display an ALV grid REUSE_ALV_COMMENTARY_WRITE Output List header information REUSE_ALV_VARIANT_F4 Display variant selection dialog box REUSE_ALV_VARIANT_EXISTENCE Checks w...

Overview of ABAP Programming Language

 Overview of ABAP Programming Language Basic Syntax of ABAP *ABAP 4 is a programming language developed by SAP for the interactive development of application programming. *ABAP 4 is a fourth generation language. ABAP 4 is tightly integrated across all the modules viz like SD, MM, HR etc and most or all of the modules and transactions(like screens are created using ABAP). *All application programs, along with parts of the R/3 Basis system, are written in the ABAP Workbench using ABAP, Sap's programming language. The individual components of application programs are stored in a special section of the database called the R/3 Repository. The R/3 Repository serves as a central store for all of the development objects in the R/3 System ABAP Programs are objects of R/3 Repository. You maintain them using ABAP WorkBench Tool- in this case its ABAP Editor(Transaction SE38). R/3 applications are written in the ABAP programming language, and run within the application layer ...

SAP INTERVIEW QUESTIONS AND ANSWERS

SAP INTERVIEW QUESTIONS AND ANSWERS What is SAP? SAP is the name of the company founded in 1972 under the German name (Systems, Applications, and Products in Data Processing) is the leading ERP (Enterprise Resource Planning) software package. SAP Basics feature * Configuration of the SAP modules o Transaction SPRO - this is the main tree for all the configuration. * Function Key o F1 - Help o F4 - Possible entries or matchcode for the field you are accessing o F5 - Selection screen o F7 - Previous screen o F8 - Next screen o F9 - Technical info o CTRL+X - Cut o CTRL+C - Copy o CTRL+V - Paste * Navigation o /n Skip to the next record if you are processing one batch input session o /bend Cancel a batch input foreground process o /nend Close all R/3 sessions and logoff o /nxxx x Call the transaction xxxx in the same session o /o Generate a session list o /oxxx x Call the transaction xxxx in an additional session o /i Delete the current session o /h Turn the de...