Friday, March 15, 2019

RFC Function Module Create step by step in sap ABAP.


  • RFC Function Module Create step by step in sap ABAP.
  • Go to T-code-SE37
  • At first created function group.
  • If function group not created that time first create function group.
  • At first go to T-code-:-SE37=>Go to=>Function group=>Create Group



  1.  If function group already has created so you can selected your created function group.


  • After that give function module name next select create option.

  • After that select remote enable module option and also give the short text.   Program name and include option automatically created.


  •  Go to import tab


  •  Go to tables tab


BAPI MATERIAL CREATION........................

After that go to Source Code

FUNCTION zrth_pre_ord_chek_list.
*"-----------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_AUFNR) TYPE  AUFNR
*"  TABLES
*"      GT_FINAL STRUCTURE  ZPP_PRODORD_PRE_CHK
*"      GT_FINAL_AUIT STRUCTURE  ZPPRTHID_VALUE
*"      GT_FINAL_AREA STRUCTURE  ZPP_RTH_OP_AREA
*"------------------------------------------------------
*******************************************************
*              BAPI RELATED DATA                      *
*******************************************************
  
DATA:lv_werks TYPE werks_d.
  
DATAnumber           TYPE  bapi_order_key-order_number,
        collective_order 
TYPE  bapi_order_func_cntrl-collective_order,
        order_objects    
TYPE  bapi_pp_order_objects,
        
return           TYPE  bapireturn1,
        return2          
TYPE  bapiret2.

  
DATA:header           TYPE TABLE OF  bapi_order_header1,
       ls_header        
TYPE bapi_order_header1,
       
position         TYPE TABLE OF  bapi_order_item,
       ls_position      
TYPE bapi_order_item,
       sequence         
TYPE TABLE OF  bapi_order_sequence,
       ls_sequence      
TYPE  bapi_order_sequence,
       operation        
TYPE TABLE OF  bapi_order_operation1,
       ls_operation     
TYPE bapi_order_operation1,
       trigger_point    
TYPE TABLE OF  bapi_order_trigger_point,
       ls_trigger_point 
TYPE bapi_order_trigger_point,
       
component        TYPE TABLE OF  bapi_order_component,
       ls_component     
TYPE bapi_order_component,
       prod_rel_tool    
TYPE TABLE OF  bapi_order_prod_rel_tools,
       ls_prod_rel_tool 
TYPE  bapi_order_prod_rel_tools.

  
DATAi_insplot        TYPE  qibplosnr,
        i_inspoper       
TYPE  qibpvornr,
        lt_inspchar      
TYPE TABLE OF  bapi2045l3,
        ls_inspchar      
TYPE bapi2045l3,
        lt_insppointdata 
TYPE TABLE OF  bapi2045l4,
        ls_insppointdata 
TYPE bapi2045l4.

  
DATAlt_char_results   TYPE TABLE OF  bapi2045d2,
        lt_sample_results 
TYPE TABLE OF  bapi2045d3,
        lt_single_results 
TYPE TABLE OF  bapi2045d4,
        returntable       
TYPE TABLE OF  bapiret2.

*****************************************************
*                       Get Result                  *
*****************************************************
  
IF i_aufnr IS NOT INITIAL.
    
SELECT aufnr
           stlnr
           stlal
      
FROM afko
      
INTO TABLE gt_afko
      
WHERE aufnr EQ i_aufnr.

    
IF gt_afko[] IS NOT INITIAL.
      
SELECT  matnr
              werks
              stlal
              maktx
              stlnr
        
FROM zpp_bom
        
INTO TABLE gt_zpp_bom
*       INTO CORRESPONDING FIELDS OF TABLE gt_final
        
FOR ALL ENTRIES IN gt_afko
        
WHERE stlal  gt_afko-stlal
          
AND stlnr gt_afko-stlnr.

      
SELECT *
        
FROM zpprthid
        
INTO CORRESPONDING FIELDS OF TABLE gt_zppr.

      
IF gt_zppr[] IS NOT INITIAL.
        
SELECT z_op_type_id
               z_op_type_desc
               z_op_value
          
FROM zpprthid_value
          
INTO TABLE gt_zpprval
          
FOR ALL ENTRIES IN gt_zppr
          
WHERE z_op_type_id gt_zppr-z_op_type_id.
      
ENDIF.
    
ENDIF.

*******************************************************
*Call Bapi For Output Details of a Production Order   *
*******************************************************
    
number i_aufnr.
    order_objects
-header         'X'.
    order_objects
-positions      'X'.
*   order_objects-sequences      = 'X'.
    order_objects
-operations     'X'.
*   order_objects-components     = 'X'.
*   order_objects-prod_rel_tools = 'X'.
*   order_objects-trigger_points = 'X'.
*   order_objects-suboperations  = 'X'.

    
CALL FUNCTION 'BAPI_PRODORD_GET_DETAIL'
      
EXPORTING
        
number           number
        collective_order 
collective_order
        order_objects    
order_objects
      
IMPORTING
        
return           return2
      
TABLES
        
header           header
        
position         position
        sequence         
sequence
        operation        
operation
        trigger_point    
trigger_point
        
component        component
        prod_rel_tool    
prod_rel_tool.


    
IF sy-subrc EQ 0.
      
READ TABLE header INTO ls_header INDEX 1.
      
IF sy-subrc EQ 0.
        lv_werks 
ls_header-production_plant.
      
ENDIF.

      
IF lv_werks IS NOT INITIAL.
        
SELECT *
          
FROM zrth_area_id
          
INTO CORRESPONDING FIELDS OF TABLE gt_zarea.

        
IF gt_zarea[] IS NOT INITIAL.
          
SELECT plant
                 matnr
                 zsection
                 z_section_desc
                 z_areaid
                 z_areaname
                 z_checklist_id
                 z_chk_list_ty_desc
                 z_remarks
                 zflag
            
FROM zpp_rth_op_area
            
INTO CORRESPONDING FIELDS OF TABLE gt_zarea_val
            
FOR ALL ENTRIES IN gt_zarea
            
WHERE z_areaid gt_zarea-z_areaid.
        
ENDIF.
      
ENDIF.
    
ENDIF.
  
ENDIF.
*****************************************************
****                   This is order                *
*****************************************************
  
LOOP AT gt_afko INTO gs_afko.
    gs_final
-aufnr  =  gs_afko-aufnr.
    
READ TABLE header INTO ls_header INDEX 1.
    
IF sy-subrc EQ 0.
      gs_final
-plant  ls_header-production_plant.
    
ENDIF.
    
READ TABLE gt_zpp_bom INTO gs_zpp_bom WITH KEY stlal gs_afko-stlal
                                                   stlnr 
gs_afko-stlnr.
    
IF sy-subrc EQ 0.
      gs_final
-material          gs_zpp_bom-matnr.
      gs_final
-material_text  gs_zpp_bom-maktx.
    
ENDIF.
    
APPEND gs_final TO gt_final.
    
CLEARgs_afkogs_final.
  
ENDLOOP.
*****************************************************
****                   This is adit                 *
*****************************************************
  
LOOP AT gt_zpprval INTO gs_zpprval.
    gs_final_auit
-z_op_type_id      gs_zpprval-z_op_type_id.
    gs_final_auit
-z_op_type_desc  gs_zpprval-z_op_type_desc.
    gs_final_auit
-z_op_value          gs_zpprval-z_op_value.
    
APPEND gs_final_auit TO gt_final_auit.
    
CLEAR:gs_final_auit,gs_zpprval.
  
ENDLOOP.
*****************************************************
****                   This is area                 *
*****************************************************
  
LOOP AT gt_zarea_val INTO gs_zarea_val.
    gs_final_area
-plant                     gs_zarea_val-plant.
    gs_final_area
-matnr                    gs_zarea_val-matnr.
    gs_final_area
-zsection                gs_zarea_val-zsection.
    gs_final_area
-z_section_desc     gs_zarea_val-z_section_desc.
    gs_final_area
-z_areaid               gs_zarea_val-z_areaid.
    gs_final_area
-z_areaname         gs_zarea_val-z_areaname.
    gs_final_area
-z_checklist_id     gs_zarea_val-z_checklist_id.
    gs_final_area
-z_chk_list_ty_desc gs_zarea_val-z_chk_list_ty_desc.
    gs_final_area
-z_remarks          gs_zarea_val-z_remarks.
    gs_final_area
-zflag                  gs_zarea_val-zflag.
    
APPEND gs_final_area TO gt_final_area.
    
CLEAR:gs_final_area,gs_zarea_val.
  
ENDLOOP.

ENDFUNCTION.

3 comments:

  1. Thanks for Sharing a Very Nice Details about SAP & It’s really helpful for everyone. We have Some List OF World Best SAP Training Center in Delhi, India

    SAP Training in Delhi
    SAP Course in Delhi
    sap Institute in Delhi
    sap training institute in Delhi
    sap training center in Delhi

    ReplyDelete
  2. Great Article. Thank you for sharing! Really an awesome post for every one.

    IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Projects for CSE It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai


    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete