Wednesday, February 20, 2019

How to extend MKPF CDS Views In Sap Hana



       Set Up GUI for SAP In Eclipse and logon to sap same as gui
       Select package where u want to save u r DDL view
       Go To Core Data Services - > Data Definitions and create new Data Definition 






@AbapCatalog.sqlViewAppendName: 'ZZMKPF1_DDL'
@EndUserText.label: 'MKPF Extended View'
extend view nsdm_e_MKPF with ZZMKPF_DDL {
     zztransporter , zztruckno , zzdrivername
}

ZZtransporter , zztruckno , zzdrivername are custom fields in append structure…

Do append structure to MKPF



Save And Activate.

Generate TR for language translation 

1.       Go to SE63 




Enter desired std text name and source and destination language and click on edit and in editor make required changes and click on save activate.


Go to SLXT Tcode or Rs_lxe_record_torder report execute


Select target system and if u want exact std txt then select processing date and click on execute then TR number will be generated.

Adding info button in Selection screen/Input screen


Requirement:     Adding info button in selection screen next to execute button.

Note: Here in the same way you can add any button apart from Info button.

Based on requirement we need to copy respective GUI status into custom one.



TABLESSSCRFIELDS.

AT SELECTION-SCREEN OUTPUT.
DATAls_exclude LIKE rsexfcode,
         LT_EXCLUDE 
LIKE TABLE OF RSEXFCODE,
         ls_submit_info 
TYPE rssubinfo.

CALL FUNCTION 'RS_SUBMIT_INFO'
   
IMPORTING
     P_SUBMIT_INFO       
LS_SUBMIT_INFO.
            
.
 
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
    
EXPORTING
      p_status  
'1000'
      p_program 
sy-repid
    
TABLES
      p_exclude 
LT_exclude
    
EXCEPTIONS
      
OTHERS    0
AT SELECTION-SCREEN.

IF SSCRFIELDS-UCOMM 'INFOO'.

  
CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'
          
EXPORTING

            DOKCLASS                 
'TX'

            DOKNAME                  
'ZINFO_DOC'

         
EXCEPTIONS
           CLASS_UNKNOWN            
1
           OBJECT_NOT_FOUND         
2
           
OTHERS                   3.
*                  .
        
IF SY-SUBRC 0.
        MESSAGE 'Information Displayed Succesfully' TYPE 'S'.

        
ENDIF.
        
ENDIF.

START-OF-SELECTION.
  
PERFORM get_values
.



design GUI status  '1000' in SE41 as shown in below screenshots.
 A. go to SE41
give program name and click on copy  status button then provide info as shown below. and click enter

B. after dat give status as 1000 and click on change button inside in application tool bar delete unnecessary buttons and keep required buttons nly.

Most imp change the std fcode of info button from srch to u r desired fcode here am taken infoo.
after dat activate this gui status.


How to create documentation which we need to display when we click on info buton.

1. In SE61 create documentation with required information


give doc class as : General Text


name : zinfo_doc

click on create then text editor will open . inside write u r required information as shown in below screenshot.



Save.
Now we can use this documentation using F1 help fms.
DSYS_SHOW_FOR_F1HELP.

             Enhancement for MIGO Tcode

Requirement 1: To Do Authorization validations while posting MIGO based on user code given to users.

1.    In MIGO at header level utilized existing field for entering user code given to post GR.




All User Codes will be given to each individual who are using MIGO for posting GR. All the user codes are maintained in custom table for validating in MIGO. If User enters valid user code then only they are able to post GR or else it will throw an error message. You are not authorized to post GR. All user codes will be confidential.


For this implemented logic in customer exit MBCF0002 (EXIT_SAPMM07M_001).



Requirement 2 : Add custom Tab in MIGO header for Adding Transporter details.

For this requirement implemented BADI MB_MIGO_BADI.



Before that append custom fields to MKPF table.


Create function module ZMIGO_BADI_PUT_HEADER for displaying custom field values when Created GR is in Display mode.


Source Code :

*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_MKPF) TYPE  ZZTRANSPORTER_DETAILS
*"----------------------------------------------------------------------
  
DATA ls_transporter TYPE zpo_transporter_name,
         ls_truckno     
TYPE ztruckno,
         ls_driver      
TYPE zdrivername,
         ls_courier     
TYPE zlr_courier.

  
IF zztransporter IS INITIAL.
    
GET PARAMETER ID 'TRANS' FIELD ls_transporter.
    zztransporter 
ls_transporter.
  
ENDIF.

  
IF zztruckno IS INITIAL .
    
GET PARAMETER ID 'TRUCK'  FIELD  ls_truckno.
    zztruckno 
ls_truckno.

ENDIF.

  
IF zzdrivername IS INITIAL.
    
GET PARAMETER ID 'DRIVER' FIELD ls_driver.
    zzdrivername 
ls_driver.
  
ENDIF.

  
IF zzlr_courier IS INITIAL.
    
GET PARAMETER ID 'COURIER' FIELD ls_courier.
    zzlr_courier 
ls_courier.
  
ENDIF.

       In method PBO Header add the custom tab screen created under function group.



1.       In method post document write logic to store values entered in custom fields in MIGO screen.


Function module Z_SET_DATA_MIGO_HEADER is used to get custom field values entered in MIGO.



Function Module ZEXPORT_MEMORY is used to place custom field values in Memory Id’s for using in later purpose .

This FM is of type Update FM because in MIGO (MKPF & MSEG or MATDOC table in HANA) Will get updated in Update task.



       In method STATUS_AND_HEADER implement logic to get custom field values updated in MKPF and place them in Memory to use in PBO Header Method in 

     ZMIGO_BADI_PUT_HEADER FM for displaying GR details in display mode along with custom values.

       Now most important thing is we need to write logic to update custom values in standard tables MKPF/ MATDOC.

For this created Implicit Enhancement in NSDM_MTDCSA_POST FM which is of Update Fm.

ENHANCEMENT 1  ZTRANS_DETAILS_UPDATE_ENH_IMP.    "active version

DATA ls_transporter TYPE ZPO_TRANSPORTER_NAME,
       ls_truckno TYPE ZTRUCKNO,
       ls_driver TYPE ZDRIVERNAME,
       ls_courier TYPE ZLR_COURIER,
       ls_mblnr TYPE mblnr,
       LS_MATDOC TYPE MATDOC.

**Importing Custom Field Values Entered In MIGO In Custom Tab
GET PARAMETER ID 'TRANS' FIELD ls_transporter.
GET PARAMETER ID 'TRUCK' FIELD LS_TRUCKNO.
GET PARAMETER ID 'DRIVER' FIELD LS_DRIVER.
GET PARAMETER ID 'COUR' FIELD LS_COURIER.
GET PARAMETER ID 'MBLNR' FIELD LS_MBLNR.

ls_matdoc-zztransporter ls_transporter.
ls_matdoc-zztruckno ls_truckno.
ls_matdoc-zzdrivername LS_DRIVER.
ls_matdoc-zzlr_courier LS_COURIER.
ls_matdoc-mblnr ls_mblnr.
**Modifying Standard Table With Custom Field Values To Update In Standard Tables ( MKPF , MATDOC )
MODIFY it_matdoc FROM ls_matdoc TRANSPORTING zztransporter zztruckno zzdrivername zzlr_courier
 WHERE mblnr ls_matdoc-mblnr.

ENDENHANCEMENT.

In This FM get the custom values from Memory ID Stored in Badi in Post Document method in ZEXPORT_MEMORY FM and modify IT_MATDOC based on Material Doc number with Custom Values. Beacause IT_MATDOC is the table from which standard tables gets updated.

Monday, February 18, 2019


How to make Field display mode  in ME21N or ME22N .


Field non editable in ME21N or ME22N .


  1. Find meta field number by debugging ME21N or through FM MEMFS_BUILD_MAPPING_PO_DOC
          MY_DYNPRO_FIELDS is the structure that is determined in debugging as per the below screenshot.




2. Through FM.
In SE37 enter FM name click on F8
Enter application





Click on F8
Find meta field number for field







Delivery Date field is  made non-editable as per our requirement . In the same way we can do any other fields as non editable in ME21N / ME22N tcodes.

Create Dynamic Internal Table & Dynamic FIELD CATALOG Introduction: This document explains how to create dynamic internal table ...