Showing posts with label SAP-ABAP. Show all posts
Showing posts with label SAP-ABAP. Show all posts

Saturday, September 10, 2011

Dynamically show/hide selection screen elements

TABLES: mara.

PARAMETERS: p_901 RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND usr,
            p_948 RADIOBUTTON GROUP rad1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR mara-matnr MODIF ID m1,
                 s_maktl FOR mara-matkl MODIF ID m2.
SELECTION-SCREEN: END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF p_901 = 'X'.
      IF screen-group1 = 'M2'.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ELSEIF p_948 = 'X'.
      IF screen-group1 = 'M1'.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Sunday, June 19, 2011

How to get material revision level

To get material revision level use the function module "REVISION_LEVEL_SELECT".

See the below sample code.

    CALL FUNCTION 'REVISION_LEVEL_SELECT'
      EXPORTING
        aeobj              = '4'
        datuv              = sy-datum
        matnr              = wa_po-matnr
      IMPORTING
        arevlv             = wa_out-revlm
      EXCEPTIONS
        date_not_found     = 1
        ecn_not_found      = 2
        ecn_no_revision    = 3
        input_incomplete   = 4
        input_inconsistent = 5
        revision_not_found = 6
        version_not_found  = 7
        OTHERS             = 8.
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.


Object 4 means for material. You need to pass the date, revision level on date. If you don't pass date you will not get results.

Friday, May 27, 2011

How to get batch characterstics

Combine 18 character material and 10 character batch into OBJEK.
Now pass this OBJEK to table INOB.
pass KLART as '023' - batch
pass OBTAB as 'MCH1'
Now go to AUSP.
Pass the CUOBJ field from the INOB table to OBJEK field.
Here you will get all the characterstics value.
You can get your desired characterstics.
Below is the code for the same.


REPORT  zbatch_characterstics.

TYPES: BEGIN OF d_ausp,
       atinn TYPE ausp-atinn,
       atwrt TYPE ausp-atwrt,
      END OF d_ausp.

DATA: w_matnr TYPE mara-matnr,
      w_charg TYPE lips-charg,
      w_key   TYPE ausp-objek,
      w_cuobj TYPE inob-cuobj,
      w_vinin TYPE ausp-atinn.

DATA: it_ausp TYPE TABLE OF d_ausp.

DATA: wa_ausp TYPE d_ausp.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
  EXPORTING
    input        = w_matnr
  IMPORTING
    output       = w_matnr
  EXCEPTIONS
    length_error = 1
    OTHERS       = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'CONVERSION_EXIT_AUFNR_INPUT'
  EXPORTING
    input  = w_charg
  IMPORTING
    output = w_charg.

CONCATENATE w_matnr w_charg INTO w_key.

SELECT SINGLE cuobj
  FROM inob
  INTO w_cuobj
  WHERE klart = '023'
  AND   obtab = 'MCH1'
  AND   objek = w_key.

SELECT atinn atwrt
  FROM ausp
  INTO TABLE it_ausp
  WHERE objek = w_cuobj.

SELECT SINGLE atinn
  INTO w_vinin
  FROM cabn
  WHERE atnam = 'VEHICLE_VIN'.

READ TABLE it_ausp INTO wa_ausp WITH KEY atinn = w_vinin.

** How to get material batch characterstics in sap

Friday, May 13, 2011

SE16 V/S SE16N

SE16: SE16 is a data browser and it is used to view the contents of the table and we cannot change or append new fields to the existing structure of the table as we cannot view the structure level display using the SE16.

SE16N: The transaction code SE16N (general table display) is an improved version of the old data browser (SE16).

** Once you have entered your table name, type "&SAP_EDIT" without the quotation marks into the transaction code. This enables editing functionality on SE16N and allows you to make table changes. This allows you to access both configuration and data tables which may be otherwise locked in a production environment.
***** Caution *****

Features of SE16N:
The new transaction has a number of advantages over SE16.
  • You no longer have a maximum of 40 fields to select in the output.
  • There are fewer steps involved in executing a number of functions, whether it be outputting the results, maintaining the values in a table etc.
  • Exporting the data into Excel is far easier and quicker.
  • ALV functionality is available as standard.
  • The user is not restricted by having a maximum width of 1023 saved as a default in the user settings.
  • You can directly edit custom table entries which are maintainable from SM30.
  • Enhanced and user friendly user interface and more options.
Difference between se16 and se16n

Wednesday, April 6, 2011

Debugging A Background (Batch) Job In SAP

Very often we come across the situation where we have to debug a report or a particular transaction which is run in background (Batch job). Debugging and analyzing the same when a job is scheduled cannot be done by conventional way. Follow the below steps to debug for a background job. Here we will take an example of a custom report, schedule a job & debug the same.

è  Enter the custom transaction.
è  Enter all required fields on the selection screen.
è  Press F9 directly or Go to program and click Execute in Background


è  A popup screen will appear, press ok once.


è  A screen will appear asking for start time.


è  Click on Date/Time and enter near future date and time. Note that this time should be relative to SAP system time and not your desktop system time. Then press save button.


è  Information message will pop up saying background job has been scheduled.


è  Now go to transaction SM37 (Background Job)
è  Select your job and in the command box type JDBG (Note you only need to type JDBG and no /n or /o)


è  And your debugging will start up as soon as you press enter. (You might have to press F7 to reach to the start of your report)

Pop Up To Select Radiobuttion Dynamic Function Module

Here you need to create a custom function module to get pop up to select radiobuttons.
Here in below function module I have put facility for 6 radiobuttons. Depending on the texts entered radiobuttons will show up.

Import parameters:

Export parameters:





GUI Status 5100:



 
GUI Title 51:


Thursday, March 31, 2011

Convert SQVI Quick Views to SQ01 Queries

Quickviewer in transaction SQVI:


1.      To enable convert quick viewer
è     Transaction SQ01
è     Go Environment
è     Query Areas


è     select standard area (client-specific)
è     choose


2.      Create a user group
è     Go to transaction SQ03


è     Create new user group and assign users.


3.      Converting quick viewer to query
è     Go to SQ01
è     Query
è     Convert Quickview

* Make sure the queries of the user group you created are being displayed in the query list in SQ01 transaction, because it will automatically pick up the user group.
* If not go to SQ03 and display your user group and come back to SQ01 transaction.


è     select your quickview
è     Now input intended query name & infoset name.



Note: Since SQVI quick views are client specific, when we follow above steps and convert to SQ01 queries it would be client specific and would need to transport to access from other clients using report RSAQR3TR.

4.      Assigning transaction to Query:
è     Go to transaction SE93
è     Create parameter transaction
è     Transaction = START_REPORT
è     Select skip first screen checkbox
è     In default values give the below details:
D_SREPOVARI-REPORTTYPE = AQ
D_SREPOVARI-EXTDREPORT = <Name of the Query>
D_SREPOVARI-REPORT = <User Group>