Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all 8332 articles
Browse latest View live

Can we display Quality fields with two decimals places on the screen?

$
0
0

Hi~everyone~

I have create a transparent table ZTSD001 with a Quality field KWMENG, which type KWMENG,like the field in vbap

KWMENGKWMENGQUAN153Order quantity

 

then,DATA: LT_ZTSD001 TYPE STANDARD TABLE OF ZTSD001.

i created a table control to output LT_ZTSD001,and for edit

 

my question is, since field kwmeng is defined as decimals 3,

can i set the colmun in table control to output as decimals 2?  and how ?

 

since the program is used for about half an year, there are some data sotred in the table

can i adjust the field "kwmneg" in table ztsd001 from decimals 3 to decimals 2?

 

thx~


F4 Help for Multiple fields in Modulepool - Process on Value request

$
0
0

Hi ,

 

 

I am trying to add F4 help depending upon input in the first field.

 

Ex :  First Fields is  STUD COUNTRY : USA, IND...etc

                                   STD  STATE       : CT    - F4 Help - CT, NJ, Maharastra ...etc

                                    STD CITY        :  Plainville , Mumbai

                                     STD ADD       :   Southington...AIROLI, etc....

 

I have written the code but the cursor is not at all triggering to get multiple on Value request.

 

 

  PROCESS ON VALUE-REQUEST.

  field  TABLE-STATE MODULE get_data_state.
      field  TABLE-CITY MODULE get_data_city.

 

When I debug, cursor is going to module get_data_state but it is not passing to get_data_city...even after putting the hard break point in there...

 

 

Any suggestions will be appreciated!

 

Best Regards,

KC

CL_GUI_ALV_TREE event for expand/collapse

$
0
0

Hello,

 

Does anyone know which event can be triggered in class CL_GUI_ALV_TREE when you expand or collapse a node?

 

Thanks a lot!,

 

Eloi

auto update count in table control

$
0
0

Hi Group,

 

I am working on table control(a) with 7 columns , in one of the columns I need to populate count of the records from different custom table(z001) based on passing first column1 value , this count needs to be updated when user selected records in the other screen table control (b) which is calling when user press push button on right hand side ,

 

Table Control(b) is showing Z001 custom table entries  , when user press save on table control(b) needs to update table control(a) count , can any body suggest how we can achieve this.

 

Capture11.JPGCapture23.JPG

How to use dynamic Zebra designer picture in Smartforms

$
0
0


Hi All

 

I am able to generate ITF file for Zebra designer label which is using dynamic picture and also, able to see ZPL file for the picture. I have converted the ZPL file to TEXT file which has ASCII characters.

 

Finally, created a Smartforms with Include text for ITF file and passing the picture ASCII value to the variable which will print the picture. However, label is printing without picture. We are using device type "LZ_ZEB".

 

Please suggest if I am missing anything.

 

Regards

PP

Attach .csv files to Sales order in background

$
0
0


Hi All,

 

We have a requirment to attach 2 or 3 .csv files in the midnight everyday for saved Sales Order.

It will be a backgorund job .

File will be placed in application server.

Need to know if any FM exist for that....

We know there is option.....System-->Services for Object-->Create-->Create attachment-->pick ur file-->save.

 

But we need to do tht every midnight and in backgorund.

 

(JFYI, we tried BDC it is not working).

 

Please suggest.

 

Thanks,

RK

Code pushdown for database other than HANA

$
0
0

Hello All,

 

There is lot of buzz around code pushdown to HANA database to take maximum advantage of HANA capabilities. My question here is how effective is code pushdown if backend database is not HANA but any other traditional database?

Similarly for New Open SQL, are all the features equally optimized for all databases.

 

Thanks

Shibha Jain

How to change Cust. enhancement tab name?

$
0
0

Hello gurus,

I have Applied a user exit in cj20n transaction to add a customer field, but the tab name it is:  Cus. enhancement:

enha.PNG

Anyone can help me to tell me how can I change this tab name?

regards.


Function Module: CD_EVALUATION_PERIODS

$
0
0

HI,

I have some query about the Function Module: CD_EVALUATION_PERIODS

 

my program is calling the FM by passing the below value shown in screen shot.

 

call function 'CD_EVALUATION_PERIODS'

       exporting

            bonus_date      = selected_rgdir-bondt

            inper                = selected_rgdir-inper

            inper_modif     = selected_rgdir-permo

            pay_ident       = selected_rgdir-payid

            pay_type        = selected_rgdir-payty

       tables

            evpdir          = evp

            rgdir           = rgdir

       exceptions

            no_record_found = 01.

 

The Values :

bonus_date = 00000000

inper            = 200021

inper_modify = 04

 

and the rgdir entries are:

 

 

Current        Payment    For-Period    IN-period     Start/FP     End/FP     End Of            Period                 Sequential

Indicator        Date                                                                                In-Period        perameter           Number

 

 

P     09/29/2000 20.2000    20.2000    09/08/2000   09/21/2000 09/21/2000  04                   00175

 

 

A     09/29/2000 20.2000   21.2000    09/08/2000    09/21/2000  10/05/2000 04                          00178

 

 

A     10/13/2000  21.2000  21.2000    09/22/2000    10/05/2000   10/05/2000 04                         00179

 

 

And it is fetching the above 3 records into the table u2018evpdiru2019 once we execute the FM execution.

 

 

Please explain what exactly this FM does and how it is fetching the above three records in the above example.

 

 

Thanks in Advance.

 

 

Regards,

Krishna.

 

Edited by: krishna chaitanya on Jul 13, 2009 3:34 PM

"WA_FCAT" cannot be converted to the line type of "IT_FCAT".

$
0
0

Hi,

 

I am new to ABAP please help me to solve the problem. I am trying to create an ALV report

 

Main program

ZTEST_PROGRAM_ALV

 

*&---------------------------------------------------------------------*

*& Report  ZTEST_PROGRAM_ALV

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

 

INCLUDE ZTEST_PROGRAM_ALV_TOP                   .    " global Data

INCLUDE ZTEST_PROGRAM_ALV_F01                   " FORM-Routines

 

INITIALIZATION.

 

 

 

 

AT SELECTION-SCREEN.

 

START-OF-SELECTION.

 

PERFORM f_get_data.

 

 

End-OF-SELECTION.

 

if NOT it_vbak IS INITIAL" if the internal table has some value the we will decide how to display it through field ctalogue

   PERFORM f_fieldcat_alv.   " we will decide the properties of field catalgue

ENDIF.




Top Include

ZTEST_PROGRAM_ALV_TOP

*&---------------------------------------------------------------------*

*& Include ZTEST_PROGRAM_ALV_TOP                             Report ZTEST_PROGRAM_ALV

*&

*&---------------------------------------------------------------------*

 

REPORT ZTEST_PROGRAM_ALV.

 

TYPe-POOLs: slis.                 "standard pool provided by SAp for alv

 

DATA: gs_vbak TYPE vbak.    " declaring data as table statement is absolute in ECC6

 

 

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

 

   SELECT-OPTIONS : s_vbeln for gs_vbak-vbeln.

 

SELECTION-SCREEN END OF BLOCK b1.

 

TYPES: BEGIN OF ty_vbak,

   VBELN  type VBELN_VA,

   ERDAT  type ERDAT,

   ERZET  type ERZET,

   ERNAM  type ERNAM,

   ANGDT  type ANGDT_V,

   BNDDT  type BNDDT,

   AUDAT  type AUDAT,

   VBTYP  type VBTYP,

   TRVOG  type TRVOG,

   AUART  type AUART,

   AUGRU  type AUGRU,

  END OF ty_vbak.

 

 

  DATA: it_vbak TYPE TABLE OF ty_vbak,

        wa_vbak TYPE          ty_vbak.

 

 

 

  DATA: it_fcat type TABLE OF SLIS_T_FIELDCAT_ALV,      " internal table for field catalogue

        wa_fcat TYPE          SLIS_FIELDCAT_ALV.        "work area for field catalogue





Subroutine include

ZTEST_PROGRAM_ALV_F01

*&---------------------------------------------------------------------*

*&  Include           ZTEST_PROGRAM_ALV_F01

*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*

*&      Form  F_GET_DATA

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM F_GET_DATA .

 

" before fetching the data we can clear and refresh

Refresh: it_vbak.

clear: wa_vbak.

 

 

if NOT s_vbeln IS INITIAL" if there is some input value in s_vbeln

SELECT VBELN

       ERDAT

       ERZET

       ERNAM

       ANGDT

       BNDDT

       AUDAT

       VBTYP

       TRVOG

       AUART

       AUGRU

FROM vbak

INTO TABLE it_vbak

WHERE vbeln IN s_vbeln.

 

ELSE.

   SELECT VBELN      " if there is no input value in s_vbeln then select only first 1000 rows

       ERDAT

       ERZET

       ERNAM

       ANGDT

       BNDDT

       AUDAT

       VBTYP

       TRVOG

       AUART

       AUGRU

FROM vbak

INTO TABLE it_vbak

*WHERE vbeln IN s_vbeln

UP TO 1000 ROWS.

ENDIF.

 

 

 

ENDFORM.                    " F_GET_DATA

*&---------------------------------------------------------------------*

*&      Form  F_FIELDCAT_ALV

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM F_FIELDCAT_ALV .

 

Refresh: it_fcat.

CLEAR: wa_fcat.

 

" setting the properties of the field catalgue in the work area

 

wa_fcat-row_pos = '1'.

wa_fcat-col_pos = '1'.

wa_fcat-fieldname = 'vbeln'.

wa_fcat-tabname = 'IT_VBAK'.

wa_fcat-seltext_m = 'Sales Document'.

Append wa_fcat to it_fcat.

CLEAR: wa_fcat.

ENDFORM.                    " F_FIELDCAT_ALV

 

 

 

The error is at subroutine include line Append wa_fcat to it_fcat.

and the error states "WA_FCAT" cannot be converted to the line type of "IT_FCAT".


How to stop a sales order creation

$
0
0

Hello Experts,

 

I've a requirement where I need to check the following detail and if found then stop an order to be created.

 

VBAK-NETWR = 0.00

VBAK-AUART  = 'ZZAC'

XVBAP-MATNR = 677 OR 678.

 

We identified an Include in program (SAPMV45A) and added the following logic but it doesn't prevent order to be created.

 

if  VBAK-NETWR = '0.00'

And VBAK-AUART = 'ZZAC'

And ( xvbap-matnr = '000000000000000677' or xvbap-matnr = '000000000000000678' ).

exit.

endif.

 

Can anybody please give me some suggestion to accomplish the desired results.

 

Many thanks in advance.

Batch Job analysis in SAP ECC

$
0
0

Hi Expert,

 

We have few batch jobs that are taking a lot of time. We know the reason and working on this.

 

I need to know few things for a batch job for further analysis:

 

1.How much memory usage this batch job is taking?

2.How much database resource this batch job is utilizing during its run period?

 

If i check in SM37, only time and duration is displayed.

 

The Basis could not find any such information.

 

Please help.

 

regards,

Vicky

How to driver program for printing different smartforms based on Company codes

$
0
0

Hi

 

I am working on a requirement for Invoice smartform(vf03).

 

Question :

 

I have 3 different smartform formats for 3 company codes.

 

When I hit vf03-> billing doc no - > issue output -> it is picking only one smartform linked to that output type(RD00)

 

I want to use same output type but with 3 different smartforms , how to assign 3 different samrtforms in NACE transaction or I should go for some Zreport (driver report) ???

 

Below is the screen shot , please explain me in brief how the----->      Program, FORM Routine & Forms

 

ssf.GIF

 

Please advice

Exception CX_DOCUMENT_BCS occurred

$
0
0

Hi all.

 

We have a program which reads file content from AL11 and send an email to User's. We are trying to send an 'XLS' file as an attachment of an email and using I  the cl_document_bcs->add_attachment. I am getting an error 'Exception CX_DOCUMENT_BCS occurred (program: CL_DOCUMENT_BCS===============CP, include: CL_DOCUMENT_BCS===============CM01C, line: 64).' while executing this report. Email has been successfully sent but attachment is missing. I debugged the program and found that in include LSOB2U02, program is calling exit SO_EXT_DB_EXIT and giving error as FM does not exists. I tried to change the xls in below code to caps but still getting error. please suggest.

 

  LOOP AT zcl_vcvp_logger=>i_singleton INTO lwa_objs.

 

*   Get data into Excel format

    lwa_objs-obj->get_xls(

      IMPORTING

        ei_xls_data = li_xls

        ev_size     = lv_size ).

 

 

*   Add attachment

    TRY.

        lv_subject = lwa_objs-file.

        document->add_attachment(

          i_attachment_type    = 'xls'                     

          i_attachment_subject = lv_subject

          i_attachment_size    = lv_size

          i_att_content_hex    = li_xls ).

 

 

      CATCH cx_document_bcs INTO lo_exc.

        lv_string = lo_exc->get_text( ).

        MESSAGE 'Error while adding attachment'(m03) TYPE 'S'.

        MESSAGE lv_string TYPE 'S'.

    ENDTRY.

 

 

    CLEAR: li_xls.

  ENDLOOP.

 

Thanks

Shilpa


Compressed Binary from XML occupies more space in DB.

$
0
0

Hello,

 

we store XML in DB as broken strings of 1024 length.

As XML occupies notorious space in DB as string, we now decided to

compress it into binary using gzip and store,

When I concatenate and do compression for each XML string as observed in debug that the byte sequence received is compressed upto 10 times.

But When I save it to DB I see the compression gets reduced to 2-3 times,

But the storm is, When I go and increase number of records of XML strings f.eg. 100 , In debug still the compression upto 10 times can be observed for each XML, but in DB it occupies almost 6 times more than the XML which is painful and opposite of what we want to achieve

And as the records increase the occupied size of byte sequence in DB increases at a massive speed as compared to XML.

 

We are using RAWSTRING to save the Byte sequence, and using MAXDB.

Any help will be greatly appreciated.

 

 

 

Best Regards,

Rajeev


how to create an attachment to FB03 (accounting doc) thourgh abap program.

$
0
0

Hi,

 

Kindly suggest me how can I create an attachment to the FB03 (Accounting document) by using an ABAP program.

 

thanks in advance.

 

Regards,

Vijay.

2 print forms in 1 customized program

$
0
0

Hi All,

 

Appreciate your inputs.

 

Is it possible to make a 2 customized print form in 1 program ?

example

1. Finance Invoice Print form

2. Billing-Finance Print form (more likely a sales invoice form but for domestic only) (required by business)

 

 

Is this achievable? so that user can have an option to print and select the invoice form they want to print.

 

thanks everyone on your inputs..

Lazy initialization in ABAP

$
0
0

"In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed." (Wikipedia)

 

A very unused yet extremely simple software design technique is the lazy initialization (sometimes referred to as lazy instantiation or lazy loading). This is exceedingly helpful in large applications where a massive amount of data must be loaded and/or calculated at runtime.

 

For a better understanding, the following ABAP scenario is taken into consideration:

A company/client needs an application to display all the information related to a single entity model. Because the amount of that cannot fit into a single database table or a single screen, a decision has been taken to implement the display in the form of a tab strip, where each of the tabs will encapsulate information in different forms with the possibility to integrate different data sources (E.g. entry/entries from the underlying or external database, calculations, aggregates, RFC calls, Web Services, etc.).

 

In this example, several database tables will be used, each will correspond to one of the tabs:

tabs and data sources.png

The database objects will be uniquely identified by a key value structure, which will be referred to as the "common key". When the application is started and the tab strip is instantiated, the only known data is:

  1. The common key
  2. ID of the first displayed tab

(For clarity purposes, each data source will be named according to the corresponding tab: D1, D2 and so on.)

 

Because the business logic must be UI-independent, the application will be structured in two packages:

  1. Business object (BO) layer – encapsulates the data model and functionality
  2. User interface (UI) layer

 

Using a bottom-up approach, the BO layer will be designed first. For each data sources (in this case: ZD1, ZD2, etc.) a corresponding business class must be created.

bo architecture.png

ZCL_FACTORY will act as a bottleneck for the creation of the subordinate objects, which can only be instantiated by the factory method.

As the factory class contains a list of already instantiated BOs, it should also be a Singleton. The factory's constructor method is optional, but it can be used for example to either enqueue existing data in Change-mode or generated the common key in Create-mode.

 

A snippet of the ZCL_FACTORY class with some explanations:


CLASS zcl_factory DEFINITION
                 
PUBLIC

                                       FINAL

                  CREATE PRIVATE.

PUBLIC SECTION.
CLASS-METHODS get_instance
  
IMPORTING
    
value(iv_common_key) TYPE guid OPTIONAL
   RETURNING
    
value(ro_factory) TYPE REF TO zcl_factory.

METHODS constructor
  
IMPORTING
    
value(iv_common_key) TYPE guid OPTIONAL.

METHODS factory
  
IMPORTING
    
value(iv_type) TYPE string
   RETURNING
    
value(ro_bo) TYPE REF TO zcl_abstract_bo.

PRIVATE SECTION.
TYPES:
  
BEGIN OF ts_list,
     classname
TYPE classname,
     bo 
TYPE REF TO zcl_abstract_bo,
  
END OF ts_list,
   tt_list
TYPE STANDARD TABLE OF ts_list.

CLASS-DATA :
   mo_factory
TYPE REF TO zcl_factory.

DATA :
   mt_list      
TYPE tt_list,
   mv_common_key
TYPE guid.
ENDCLASS.


CLASS zcl_factory IMPLEMENTATION.
METHOD constructor.
   mv_common_key
= iv_common_key.
ENDMETHOD.

METHOD factory.
  
DATA :
     lv_classname
TYPE classname.

FIELD-SYMBOLS :
   <fs_list>
TYPE ts_list.

*   Obviously these hard-coded values are not optimal
CASE iv_type.
  
WHEN 'D1'
    
OR 'D2'
    
OR 'Dx'.
       lv_classname
= |ZCL_BO_{ iv_type }|.
  
WHEN OTHERS.
*      RAISE EXCEPTION TYPE ...
ENDCASE.

*   Check if the list already contains an instance
READ TABLE mt_list ASSIGNING <fs_list>
                   
WITH KEY classname = lv_classname.

*   If not, create
IF NOT sy-subrc IS INITIAL.
  
APPEND INITIAL LINE TO mt_list ASSIGNING <fs_list>.
   <fs_list>
-classname = lv_classname.
  
CREATE OBJECT <fs_list>-bo TYPE (lv_classname)
    
EXPORTING
       iv_common_key
= mv_common_key.
ENDIF.

*   Return BO instance
   ro_bo
= <fs_list>-bo.
ENDMETHOD.

METHOD get_instance.
*   Singleton method to retrieve factory instance
IF mo_factory IS INITIAL.
*    Just as an example for Create/Display
  
IF iv_common_key IS SUPPLIED.
    
CREATE OBJECT mo_factory
      
EXPORTING
         iv_common_key
= iv_common_key.
  
ELSE.
    
TRY.
      
CREATE OBJECT mo_factory
        
EXPORTING
           iv_common_key
= cl_uuid_factory=>create_system_uuid( )->create_uuid_x16( ).
    
CATCH cx_uuid_error.
*        ...
    
ENDTRY.
  
ENDIF.
ENDIF.

   ro_factory
= mo_factory.
ENDMETHOD.
ENDCLASS.

 

Note: Attribute MT_LIST can also be used as a mechanism to control methods like: SAVE, CHECK_BEFORE_SAVE, HAS_CHANGES, and so on; but this depends on particular scenarios.

 

At this point, each specific BO can be implemented to match the particular use case.

  1. E.g. ZCL_BO_D1 reads a single entry from the database and displays it as a form. Therefore each field will have corresponding getter and setter methods. Alternatively, ZCL_BO_D2 will select a number of rows from the database and output them as a table. In which case, CRUD functionalities might be more adequate.

The constructor of each BO is responsible to load the data buffer using the given common key.

 

Note: As all the business objects have the property CREATE PRIVATE, each one must declare ZCL_FACTORY as friend.

 

The following statement can be used to create a BO instance for D1:


DATA:
lo_bo
TYPE REF TOzcl_bo_d1.

lo_bo ?= zcl_factory
=>get_instance( )->factory( 'D1' ).


After the business logic is active and secured, it is time to move up towards the UI layer. For this example, the user interface has been implemented both as an ABAP report and a Web Dynpro application. Nevertheless any other UI technology can be used.


1. ABAP Report

The most elementary implementation requires a main screen (100) and two sub screens (101, 102). The latter are embedded into a tab strip control belonging to the main screen. The trick here consists of adding the BO instantiation in the PBO module of each sub screen. As the PAI module of screen 100 controls the tab strip actions, the corresponding PBO modules are only called upon when necessary. This means that data is only loaded when displayed.

 

2. Web Dynpro Application

The application consists of a main WD component with a start view and an embedded TabStrip UI element. Based on the complexity of the application, it is a matter of choice how each tab is implemented:

     2.1. Directly in the same view

     2.2. As a different view inside the same application

     2.3. As a separate WD component

 

Either way, the component controller (from the main component 2.1., 2.2., or the each used component, 2.3.) must implement initialization method(s) – for 2.3., these methods must be defined as interface.

The catch in this situation is that TabStrip UI element has an event called ON_SELECT. For this event, an associated event handler is implemented in the start view of the main component. Similar to the PAI module, this method is used to determine the navigation and therefore control the BO instantiation.

 

METHOD onactionon_select.
 
CASE wdevent->get_string( 'TAB' ).
   
WHEN 'D1'.
   
WHEN 'D2'.
*     2.1., 2.2.
      wd_comp_controller
->init_d2( ).
*     OR

*     2.3.
      wd_this
->wd_cpifc_d2( )->init( ).
   
WHEN 'Dx'.
 
ENDCASE.
ENDMETHOD.

 

Note: This can also be implemented using Floorplan Manager (FPM) as an OIF component by checking the navigated tab in method PROCESS_BEFORE_OUTPUT.

 

Evidently, it is important to set the most used tab as initial or give the possibility for the user to choose.

 

In the end, this is the most rudimentary example I could think of, but it can nevertheless be scaled tremendously.

 

 

Thank you and please feel free to contribute. My only hope is that I didn't compress the content to the extent that it is not understandable.

 

Tudor

Menu exit for Sales order (VA01/VA02/VA03)...

$
0
0

Hi,

I have created a new tab in the sales order(VA01/VA02/VA03) header and item using the BADI , BADI_SLS_HEAD_SCR_CUS and BADI_SLS_ITEM_SCR_CUS.

Now I want the name of my new tab to be displayed in the menu under GoTo ->Header.

 

Could someone guide me on achieving this?..

 

Thanks in advance,

Agastya...

Creating Ctrl-A Delimited File in ABAP

$
0
0

I want to create a flat file out of ABAP that is either Ctrl-A or Tab delimited.

I'm reading the VBAK table and want to output the entire structure to the dataset.

In addition to the delimiters, I also need the packed/decimal/integer fields to be written out in a readable format to be read in to Hadoop.

I want to avoid reading thru each field of VBAK, converting the packed/decimals fields, concatenating, etc.

All suggestions will be most welcome.

Thanks.

Soyab

Viewing all 8332 articles
Browse latest View live