Posts

BAPI for material storage location Add

 We can add material storage location plant wise using third party app or web. BAPI names : BAPI_MATERIAL_MAINTAINDATA_RT Import parameters: HEADDATA: Material Tables: STORAGELOCATIONDATA: Material: Plant: STGE_LOC:   STORAGELOCATIONDATAX: Material: Plant: STGE_LOC:   use below code after completing steps. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.        

Resource Creation in SAP

Image
  T-Code: CRC1. Insert Plant, Resource Name (8 Char) & Resource Category :0008 Press Enter.     Provide Resource Description. In Basic Data Tab: Person Responsible : 007 , Usage : 008, Standard Value Key: Z001     Default Value Tab: Control Key: PI01, Provide Unit of measurement.      Capacity Tab: Insert Capacity Category: 008, Other Formula: Z013. Double click and fill all the required field.     Start Time, End Time, Length of Breaks, Capacity Utilization, No. Ind. Capacities, Capacity.Tick Can be used by several Operation.   Capacity Category : 008, Int.Proc. Duration: Z013.       Costing Tab: Insert Cost Center, Cleaning Time, Setup Time, Machine Time, Labor Time, Machine Delay Time ,WFI/PW for process  and Tick all Reference Indicator. Then Save.            

Different types of ALV Report in SAP

 Different types of ALV: ALV list: this uses the function module 'REUSE_ALV_LIST_DISPLAY' Hierarchical sequential list: function module 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' Fullscreen grid: this uses the function module 'REUSE_ALV_GRID_DISPLAY' ALV Grid Control: Methods of the class CL_GUI_ALV_GRID ALV Tree: Methods of the class CL_GUI_ALV_TREE In Basis Release 6.40, an object-oriented ALV wrapper is provided.  This can be used for three different types of tables. - for simple, two-dimensional tables using the classCL_SALV_TABLE - for hierarchical sequential tables (class CL_SALV_HIERSEQ_TABLE) - for tree structures (class CL_SALV_TREE)   The methods of the class CL_GUI_ALV_GRID , which are required for an ALV grid that cannot be edited, are released for use in customer-specific programs.  The documentation is accessed in the class documentation. The object-oriented ALV wrapper, which is provided in Basis Release 6.40, is also released for customers.  For more ...

Find Out Read_Text FM Parameter

Image
 Suppose we have a requirement to show long text value in a smartforms. In this case we need to  use ' Read_Text ' FM. In read_text FM we need to provide some field values for: Client,ID, Language,Name,Object. We can find out those value from our desired field. Firstly we need to go desired T-Code, I am showing one example: QA03:  Follow below steps:       DATA :  LINES  TYPE  STANDARD  TABLE  OF  TLINE .   CALL FUNCTION 'READ_TEXT' EXPORTING CLIENT = SY-MANDT OBJECT = 'QPRUEFLOS'                          NAME = 'concatenate of Sy-mandt Insp_lot' ID = 'QALS' LANGUAGE = 'E' ARCHIVE_HANDLE = 0 IMPORTING HEADER = TABLES LINES = LINES EXCEPTIONS ID = LANGUAGE = NAME = NOT_FOUND = OBJECT = REFERENCE_CHECK = WRONG_ACCESS_TO_ARCHIVE =

Create .csv file from ABAP report

 We can use like below: types truxs_t_text_data ( 4096 ) type c occurs 0 . data : csv_converted_table type table of TRUXS_T_TEXT_DATA . START-OF-SELECTION. call function 'SAP_CONVERT_TO_CSV_FORMAT' exporting i_field_seperator = ';' * I_LINE_HEADER = * I_FILENAME = '' * I_APPL_KEEP = ' ' tables i_tab_sap_data = internal_table changing i_tab_converted_data = csv_converted_table exceptions conversion_failed = 1 others = 2 . CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING filename = 'C:\example.csv' tables data_tab = csv_converted_table .

READ_TEXT Function Module in SAP ABAP

  Use of FM 'READ_TEXT' to read the various text objects not only in sale order, any document in SAP.  The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options. CALL FUNCTION 'READ_TEXT' EXPORTING ID = '0001' LANGUAGE = 'E' NAME = TDNAME OBJECT = 'VBBK' HEADER = HTEXT TABLES LINES = LTEXT EXCEPTIONS ID = 1 LANGUAGE = 2 NAME = 3 NOT_FOUND = 4 OBJECT = 5 REFERENCE_CHECK = 6 .    

Function Module to get user details in SAP ABAP

 Based on user we need to find out user details in sap. we can use below FM to get our desire result. FM:  'SUSR_USER_ADDRESS_READ'      DATA: user_address LIKE  addr3_val.     CALL FUNCTION 'SUSR_USER_ADDRESS_READ'       EXPORTING       IMPORTING         user_address                 = user_address       EXCEPTIONS         user_address_not_found       = 1         OTHERS                       = 2.        write:/ user_address-name_text.     ENDIF.

Inline Declaration in ABAP (Keyword: DATA)

 The new declaration operator DATA allows inline declarations of variables with declaration expressions in declaration positions. Declaration positions are write positions where the operand type can be determined from the context statically. lets look at below examples on how to use this in real world programming. Example:  while use loop:       Loop at itab into DATA(wa_itab).       ...........  Endloop.     Call transformation .... result XML  DATA(xml).   The work area can now be dynamically defined and used via inline declaration. While importing data in methods, the target variables can now be dynamically defined and used by inline declaration. using in select query also:      SELECT  a ~ prueflos ,  a ~ plnty ,  a ~ plnnr ,  a ~ plnal ,  b ~ vorglfnr ,  b ~ merknr ,  b ~ verwmerkm ,  b ~ formelsl      FROM ...

Spell amount in SAP ABAP

Use of  FM  ' SPELL_AMOUNT '   DATA :  WS_SPELL TYPE SPELL,  pLANGU LIKE T002-SPRAS DEFAULT SY-LANGU,  pCURR LIKE TCURC-WAERS DEFAULT 'USD',  pAMOUNT LIKE VBAP-MWSBP ,  pFILLER(1) TYPE C DEFAULT ' '.   CALL FUNCTION 'SPELL_AMOUNT'  EXPORTING   AMOUNT = pAMOUNT   CURRENCY = pCURR   FILLER = pFILLER   LANGUAGE = pLANGU "SY-LANGU  IMPORTING   IN_WORDS = WS_SPELL  EXCEPTIONS   NOT_FOUND = 1   TOO_LARGE = 2   OTHERS = 3 . IF sy-subrc <> 0.  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE.  WRITE :/ WS_SPELL-word , WS_SPELL-decword. ENDIF.

Text color in a Smartforms

Image
 Based on user requirement we need to color text. Here i show you how to color text in a smartforms. We can fulfill our requirement by adding a new paragraph format or character format in smartforms style.In below show how to  add color.Hope it will help you adding text color in your smartforms. You can just assign this format in your smartforms text.

FM for fetch value against unconverted value in SAP ABAP

 In SAP ABAP sometimes we need to show value field data but when we fetch data from table we get unconverted value. Most of the time its happens when we need to show Base unit of measurement. In below I show you the process with example.Hope it will help you to find the desire field. Function module name: " CONVERSION_EXIT_CUNIT_OUTPUT "   CALL  FUNCTION  'CONVERSION_EXIT_CUNIT_OUTPUT'              EXPORTING                INPUT     =  GS_QAMV - MASSEINHSW                LANGUAGE  =  SY - LANGU              IMPORTING *             LONG_TEXT           ...

Function Module for sign (+/-) position change in SAP ABAP

 In SAP sign's are coming after number. But in our real life practice we need to show them before number.We can solve the problem by using a FM. The name of FM is   "CLOI_PUT_SIGN_IN_FRONT" Here I show you how to use it with a example. Suppose you get your value and keep it in a variable. Now need to follow as like below. UPP_val = GS_QAS- TOLERANZOB.            CALL  FUNCTION  'CLOI_PUT_SIGN_IN_FRONT'              CHANGING                VALUE  =  UPP_VAL .   By using it you are getting your desire result. 

Sum of a field in SAP ALV Report

 In sap ALV report some times we need to sum column value. We can easily doing this job just define <field catalog>-do_sum = 'X' and must define <field catalog>-fieldname = 'QUAN' / 'CUR'. example given below:       W_FIELDCAT - FIELDNAME  =  'Deviation' .   W_FIELDCAT - DO_SUM  =  'X' .   W_FIELDCAT - DATATYPE  =  'QUAN' .   W_FIELDCAT - SELTEXT_L  =  'Deviation %' .   W_FIELDCAT - TABNAME  =  'TY_TABLE' .    APPEND  W_FIELDCAT  TO  FIELDCAT .