You are on page 1of 90

4/13/23, 12:38 PM SAPTech: 2016

SAPTech search

Classic Home

21st December 2016 How To Upload a excel / txt File Usin ABAP OOPs?

1. Goto SE38 .
2. Give Program name zdemo_class_upload And click on create.
3. Give description and make it as executable 
4. Now make a structure for student detail .
5. make internal table for this structure.
6. Now write this code:

 *&---------------------------------------------------------------------*
*& Report  ZDEMO_CLASS_UPLOAD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZDEMO_CLASS_UPLOAD.

types: begin of type_stud,
         id TYPE char3,
         name TYPE char20,
         marks type char4,
      END OF type_stud.         "making Structure for file upload
DATA: t_stud TYPE STANDARD TABLE OF type_stud,  "Internal table for that "Structure
      w_stud TYPE type_stud.

*We are using the class cl_gui_fronted_services .


*First we need to give file path for that i have used file_open_dialog of
class cl_gui_fronted_services
*For Calling This Class and method 

*Click on Pattern-> ABAP Opjects ->Call method 


  * On class field give cl_gui_fronted_services and on Method tab press "F4 and  choose
required *method.

DATA: lv_file TYPE FILETABLE,
      rc type i.
DATA: file_path TYPE string.
 DATA: lr_columns    TYPE REF TO cl_salv_columns_table,
       lr_column     TYPE REF TO cl_salv_column_table.
DATA: r_salv TYPE REF TO cl_salv_table.
PARAMETERS: p_file TYPE string DEFAULT 'C:/'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.  "For F4 Help Event

*  Give file path
CALL METHOD cl_gui_frontend_services=>file_open_dialog
  CHANGING
    file_table              = lv_file   " This will capture File path but it's a table "format
    rc                      = rc              "row count
*    user_action             =
*    file_encoding           =
  EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error              = 2
    error_no_gui            = 3
    not_supported_by_gui    = 4
    others                  = 5
        .
IF sy-subrc <> 0.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 1/90
4/13/23, 12:38 PM SAPTech: 2016
* Implement suitable error handling here

SAPTechENDIF.
START-OF-SELECTION.
Classic Home

*  Upload the data in internal table.
REad TABLE lv_file INdex 1 INTO file_path. 
 "Here weare reading the lv_file which includes file path using Index 1 and "passing to
file_path : Now this file path has only path of the file

CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename                = file_path
    filetype                = 'ASC'
    has_field_separator     = 'X'   "This is indicating Text file
  CHANGING
    data_tab                = t_stud      "This Table Include txt file data
  EXCEPTIONS
    file_open_error         = 1
    file_read_error         = 2
    no_batch                = 3
    gui_refuse_filetransfer = 4
    invalid_type            = 5
        .
IF sy-subrc ne 0.
ENDIF.

* Displaying The data in internal Table using class cl_salv_table 

*TRY.
CALL METHOD cl_salv_table=>factory
  EXPORTING
    list_display   = IF_SALV_C_BOOL_SAP=>FALSE    "For Grid Display
*    r_container    =
*    container_name =
  IMPORTING
    r_salv_table   = r_salv
  CHANGING
    t_table        = t_stud
    .
* CATCH cx_salv_msg .
*ENDTRY.

* r_salv is the type of class cl_salv_table, after importing this we are getting all
information about data like column and all.

  lr_columns = r_salv->get_columns( ).   " Getting the columns

    TRY.
      lr_column ?= lr_columns->get_column( 'ID' ).   " Making header of all column
      lr_column->set_short_text( 'ID').
      lr_column->set_medium_text( 'id').
      lr_column->set_long_text( 'ID').
    CATCH cx_salv_not_found.
  ENDTRY.

    TRY.
      lr_column ?= lr_columns->get_column( 'NAME' ).
      lr_column->set_short_text( 'NAME').
      lr_column->set_medium_text( 'NAME').
      lr_column->set_long_text( 'NAME').
    CATCH cx_salv_not_found.
  ENDTRY.

    TRY.
      lr_column ?= lr_columns->get_column( 'MARKS' ).
      lr_column->set_short_text( 'MARKS').
      lr_column->set_medium_text( 'MARKS').
      lr_column->set_long_text( 'MARKS').
    CATCH cx_salv_not_found.
  ENDTRY.
CALL METHOD r_salv->display    " Displaying the Data
    .

Now save and Execute Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 2/90
4/13/23, 12:38 PM SAPTech: 2016
File will be like this :

SAPTech
Classic Home

[https://1.bp.blogspot.com/-
z3DpZGZBTFc/WFqc1p10JrI/AAAAAAAAOQY/Nn9WvMBgwSMKuZNHvaDD8KI7Gi12X4vvQCLcB/s1600/1.png]

After uplaoding Output will be like this :

[https://2.bp.blogspot.com/-
cw0wxjRXIdM/WFqdNUEFXxI/AAAAAAAAOQc/S9D-YEAqWagqu5cq96rr-v37TgI3Tu6TgCLcB/s1600/2.png]

Thanks
Facebook Page [https://www.facebook.com/mySAPTech/]  
:)

Posted 21st December 2016 by Blogger

2 View comments

17th December 2016 How To make Fields Mandatory in Web Dynpro ?


Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 3/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
 1. Refer my previous blogs : Web Dynpro [http://mysapnuts.blogspot.in/]
 2. In that i have created 2 input fields , and i have made those as mandatory.
Classic Home
 3. For this select your Input fields - > properties tab -> STATE - > Required 

[https://1.bp.blogspot.com/-
F3AlgDqg3jQ/WFU_5zch4JI/AAAAAAAAOPs/A22gtbZvXXInmV70A0O3d_nuzIqlpqM3wCLcB/s1600/1.png]

 4. Now display error massage Like fill required input field, we need to write logic for that in Hook method  select
WDOBEFOREACTION

[https://1.bp.blogspot.com/-
CuOB7PkEE7A/WFVAHTpwonI/AAAAAAAAOPw/zBRY9eiu8XU4DxH3vtCysR24VED23PjcACLcB/s1600/2.png]

5. Double click on that method some commented code was there just un-comment it . In this method we are getting UI
element action name . so after click on doing some event what will happen , write that logic inside it . here we are
triggering error massage for mandatory field . I am writing this code here because this Hook method will trigger before
Handler method. 

  data lo_api_controller type ref to if_wd_view_controller.
  data lo_action         type ref to if_wd_action.

  lo_api_controller = wd_this->wd_get_api( ).
  lo_action = lo_api_controller->get_current_action( ).

  if lo_action is bound.
    case lo_action->name.
      when 'BUTTON'.
        CALL METHOD cl_wd_dynamic_tool=>check_mandatory_attr_on_view
          EXPORTING
            view_controller  =  lo_api_controller
            .

    endcase.
  endif.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 4/90
4/13/23, 12:38 PM SAPTech: 2016
Save , activate and test:
SAPTechClick on Fetch Button without entering Value .
Output will be :

Classic Home

[https://1.bp.blogspot.com/-sAz_Gs-
7kls/WFVCu35s1uI/AAAAAAAAOP8/S74IbZe32kAlzbTnQbfIMOHLBwgL21x9QCLcB/s1600/3.png]

Thanks 
FaceBook Page [https://www.facebook.com/mySAPTech/]

Posted 17th December 2016 by Blogger

1 View comments

How To create Select-Option without using Seelect-option


17th December 2016
Controller?

  

1. As we have created Parameter :refer previous Blog Parameter [https://mysapnuts.blogspot.in/2016/12/how-to-make-


parameter-and-table-in-web.html]
2. Continue with previous blog and now create one more Label and Input side by side  Like this 
  

[https://3.bp.blogspot.com/-
o4iAhq6jRT0/WFUllBSa5iI/AAAAAAAAOPQ/POUbLcPAfTYh03eeNDqfdtYFLLKTRKkXACLcB/s1600/1.png]
3. Will tell You next Blog How red star mark is coming .
4. On action Event Fetch will write the logic to fetch using to input fields .
       First will read second input field as we did in previous blog
   * get single attribute
  lo_el_context->get_attribute(
    EXPORTING
      name =  `MATNR1`
    IMPORTING
      value = lv_matnr1 ).   

Now will write the SELECT QUERY: 

 SELECT MATNR
           ERSDA
           ERNAM
           LAEDA
           AENAM
           VPSTA from   mara INTO CORRESPONDING FIELDS OF TABLE lt_mara_node where matnr BETWEEN lv_
matnr and lv_matnr1.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 5/90
4/13/23, 12:38 PM SAPTech: 2016
lv_matnr i have read in previous blog. Please Follow the previous Blog.

SAPTechso now This will treat as select option.


Classic Home
5. One Problem is there with this , If we will fill only first input field this select query
will fail. So better will check first Input field than will go ahead like this :

IF lv_matnr1 is INITIAL .
  SELECT MATNR
         ERSDA
         ERNAM
         LAEDA
         AENAM
         VPSTA  from  mara INTO CORRESPONDING FIELDS OF TABLE lt_mara_node where matnr eq lv_matnr .
  else.
    SELECT MATNR
           ERSDA
           ERNAM
           LAEDA
           AENAM
           VPSTA from   mara INTO CORRESPONDING FIELDS OF TABLE lt_mara_node where matnr BETWEEN lv_
matnr and lv_matnr1.
  ENDIF.

Note:  Here I have made Both input field mandatory so it will through error to fill both

input field But if mandatory is not there for Input field Pleaase follow the write select

query like above .

Save , Activate and test 

[https://4.bp.blogspot.com/-okb2tvUQDEk/WFUoNDfZVmI/AAAAAAAAOPc/E_JdGdzKIZUKm4ksI35Hhj17o-
5VX3sYACLcB/s1600/2.png]

Thanks 
Facebook Page [https://www.facebook.com/mySAPTech]

Posted 17th December 2016 by Blogger

0 Add a comment

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 6/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

8th December 2016 How to make parameter and table in Web dynpro?

 1. Goto SE80 and select Web Dynpro Cop. / Int.

[https://4.bp.blogspot.com/-akKDbEUh7KQ/WEg-
T8x5kLI/AAAAAAAAOMY/WnSs9uT3UQ4LRxcxiM4SXLANbt2Y74BDACLcB/s1600/1.png]
2. Give name as zdemo_param_tab.
3. Click on display . One pop up will come and Click on Yes.
4. Now Give description and save it as Local Object.
5. Goto View -> Context 
      Create  Node and attribute .
  follow these steps to create this.
To create node : right click on context -> create -> node

[https://3.bp.blogspot.com/-
JsYTLkYhkUU/WEhBeHSCukI/AAAAAAAAOMk/MG6RMtQa3IIMZ8DK2_87W7I4CLWgPSZFQCLcB/s1600/2.png]

6. Select Fields which one you want .


   

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 7/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-
eZQqu6TX3Lg/WEhB7AJ6vbI/AAAAAAAAOMs/orqg9bgXhpc4lLlhDzTTXCJcxItMsgUvQCLcB/s1600/3.png]

7. Create a attribute , it will treat as variable .


       Right click on context -> create -> Attribute 

[https://4.bp.blogspot.com/-9tmJImLyRNw/WEhChyvp6RI/AAAAAAAAOM0/wYJ50zUaL68L5c0xDH5VRqpyJfXkpgVsQCLcB/s1600/4.
png]

8. Now we have done with data part , will design our screen .
     In view will design our view.
9. Goto View -> Layout 
       Right Click on ROOTUIELEMENTCONTAINER -> Insert Element -> give id Label and type as Label.

[https://1.bp.blogspot.com/-
m8DV2gmmQJA/WEj5qVxgCWI/AAAAAAAAONE/IjpyfbIUzZwA1HY3f5fTfeSGdzZQcSa7wCLcB/s1600/5.png]

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 8/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTechLabel will Create .


 Same do for input field id you can give any name and type will be input Field .

Classic Home
Now again click on Label and Give two things there 

[https://2.bp.blogspot.com/--
_3MiwUJLw0/WEj73qohbVI/AAAAAAAAONM/M3F6DI51HjEOuoN-vmh0lB6mpnUvcSpbACLcB/s1600/6.png]
In LabelFor select Input field name which one you want to assign for this.
And text whatever you want as per requirement. 

10. Right Click on ROOTUIELEMENTCONTAINER -> Insert Element -> id table and type is table.
    It will create a table . To bind this table , right click on table and -> create binding
One pop up will come -> click on context and select your node which one you have created .

[https://3.bp.blogspot.com/-M0K-
USzB9g0/WEkD4rgSiCI/AAAAAAAAONg/llwFP4RyItIUcyJ_ovaMDlUMJSG_Zt8AACLcB/s1600/7.png]

If you want to give some caption for this table . while generating table one caption will generate , click on caption and ->
Text give your own Caption for this table .

11. Now Create Button .


  
 Right Click on ROOTUIELEMENTCONTAINER -> Insert Element -> id Button and Type BUTTON
In this we need to pass 2 properties one is text and other is onAction event. For this go to 
Property tab and click near on Action on highlighted part . One pop up will come Give action name and description . 

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 9/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech [https://2.bp.blogspot.com/-oZTvhmyJPQg/WEkF3EBi-

Classic Home

vI/AAAAAAAAONs/gFp4305B-UE2ZB6WLh51I0StbqS_CWtCQCLcB/s1600/8.png]

this action will create a method in method tab .

[https://1.bp.blogspot.com/-r_qMJlhF93Q/WEkKOJTBt-

I/AAAAAAAAOOE/RStfPGEpLZQHawHiFwRXb2DYbnCn5fojQCLcB/s1600/10.png]

Now designing part has done.  If you want to test it Right click on your program and create Web dynpro Application .
Save it and  Activate whole program using Right click on program -> Activate 

Now click on Application -> Right Click -> test


One Browser will open and there is you Layout like this .

[https://4.bp.blogspot.com/-7kABxR7GcXc/WEkI3oxVSnI/AAAAAAAAON4/drMZQcqD6yAU7k5wKCg89gyzVv66oFCvQCLcB/s1600/9.
png]

Now coding part will start

For this will go to View-> Method


12. As we can see we are taking input as a material no . So This input filed will read in Web dynpro program Using Code
wizard .

Double click on  ONACTIONBUTTON Method .


And write whole Logic there .

We are reading our parameter Means Attribute which one we have defined 
for this Click On code wizard -> One popup will come 

[https://1.bp.blogspot.com/-r9uuaSKn0cM/WEkK7-rSA-

I/AAAAAAAAOOI/PMlamhSfnKIIA_lqj3Mlc_YgUuxWRFzcQCLcB/s1600/11.png]

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 10/90
4/13/23, 12:38 PM SAPTech: 2016
Highlighted part Looking like activation key is the code wizard .

SAPTechWhen you click on Context popup will come 


[https://3.bp.blogspot.com/-
Classic Home

h2NpLgfBFfA/WEkLZbiCCNI/AAAAAAAAOOQ/jmrTjBvgJm0GxObXz53Cn3saP7Mb29pBACLcB/s1600/12.png]
Select Your attribute here is MATNR.

Auto generated Code will come like this :

[https://4.bp.blogspot.com/-

REh0icInIYI/WEkLq6oLKtI/AAAAAAAAOOU/y74YPpUWgFUx6g8CArOhxhLVtaqla2e2wCLcB/s1600/13.png]

Now Pass this value to your select query and set your Node means Table.
for this again goto code wizard -> set -> Check as table operation -> Context and select your node 

[https://2.bp.blogspot.com/-
Ni2KkN7ccwI/WEkMZM5HI7I/AAAAAAAAOOc/_olcO05YePMTmzcRuPcJXw9gQy_mv4SCgCLcB/s1600/14.png]

Auto code will generate.

After Data declaration write select query like this  and pass your attribute to your select query in where clause .

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 11/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-
CWvO5G1JsII/WEkMu67Lu3I/AAAAAAAAOOg/HgjLr0ZXofgVM4H2za7pDlrb38roHLsFQCLcB/s1600/15.png]

Now we have done with coding part .


For execution Right click on Application -> test
Giva any Material no and click on Button 
Output will be like this 

[https://4.bp.blogspot.com/-
MwidGh1M3L4/WEkNRhmoCxI/AAAAAAAAOOs/wZAidECyE2owMrly7Z5A75dfQZFpJCLXQCLcB/s1600/16.png]

Thank You :)
In next Blog will learn how to create Select option in WD 
FAcebook Page FaceBook Page [https://www.facebook.com/mySAPTech]

  

Posted 8th December 2016 by Blogger

0 Add a comment

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 12/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

10th November 2016 How to give multiple Conditions / Complex Condition in


Smartforms ?

1. Create a smartform using TCODE smartforms.


2. Right click on window and create ALTERNATIVE.
3. In ALTERNATIVE you  can give so many conditions what ever you want.
 

[https://3.bp.blogspot.com/-aK7hfLEYTbc/WCQgF6Zb-
xI/AAAAAAAAOLs/10Ch6PV-utsPNaRavUC_jHna7iBkPSSiQCLcB/s1600/mm.png]

By default AND is there so no need to defind. here it's like


if ( w_vbrk-vborg = 'FR01' AND W_VBRK-VTWEG = 30 
      AND W_VBRK-SPART 01 AND (V_INVOICE = 'X' OR V_CREDIT = 'X' ) ).

       YOUR STATMENT OR YOUR TEXT.


ENDIF.

Thanks :)
Facebook Page [https://www.facebook.com/mySAPTech]
Posted 10th November 2016 by Blogger

0 Add a comment

28th October 2016 How To Call SSF_FUNCTION_MODULE_NAME using


class?

Step 1.  Goto Tcode SE24 and give class name and click on create.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 13/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-
RoqPnXiOvok/WBLwwaZIBAI/AAAAAAAAOK4/HRnoo9oYDjgEJZAZ2INy35CK2kNH5v72ACLcB/s1600/se24.png]

Step 2. Give method name and click on parameter

[https://4.bp.blogspot.com/-
PvsiONiIfSE/WBLxGaK47LI/AAAAAAAAOK8/sqWiD0rZ0QI7q62JLUdXTJarHkzyXmFDQCLcB/s1600/para.png]

Step 3. Give parameters and click on code.

[https://1.bp.blogspot.com/-
OMwYpn8yvOY/WBLxaFd5ZOI/AAAAAAAAOLA/JPWUIVWjJmwbo_LITxwWrlXAtORdRLyqgCLcB/s1600/meth.png]

Step 4. Under code call your FM.


   method CALL_SSF_FM.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 14/90
4/13/23, 12:38 PM SAPTech: 2016
      formname                 = formname
SAPTech*     VARIANT                  = ' '
*     DIRECT_CALL              = ' '
   IMPORTING
Classic Home
     FM_NAME                  = fmname
   EXCEPTIONS
     NO_FORM                  = 1
     NO_FUNCTION_MODULE       = 2
     OTHERS                   = 3
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

endmethod.

Step 5. Now Goto SE38 and create your Program and call this class.

REPORT ZDEMO_CLASS_SSF.
data: cl_ssf type REF TO ZCL_DEMO_SSF.
data: v_fmname type RS38L_FNAM,
      v_formname type TDSFNAME.
create object cl_ssf.
CALL METHOD cl_ssf->call_ssf_fm
  EXPORTING
    formname = 'ZDEMO_SSF_CLASS'
  IMPORTING
    fmname   = v_fmname
    .
CALL FUNCTION v_fmname
* EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
 EXCEPTIONS
   FORMATTING_ERROR           = 1
   INTERNAL_ERROR             = 2
   SEND_ERROR                 = 3
   USER_CANCELED              = 4
   OTHERS                     = 5
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Step 6. Save ,activate and execute .
:)
Facebook Page [https://www.facebook.com/mySAPTech]

Posted 28th October 2016 by Blogger

0 Add a comment

25th October 2016 Different Select Statements in SAP ABAP

   

Different types of select statements used in SAP ABAP programming to read data from database
table.The select command is the most fundamental function of writing ABAP programs allowing the
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 15/90
4/13/23, 12:38 PM SAPTech: 2016
retrieval of data from SAP database tables. Below are a few examples of the various ways of selecting

SAPTechdata.
Step1: Using Select * in SAP ABAP Important

Classic Home
Select * is a statement which is used to read whole data from a database table.The below is the example code
for reading data from  ZDEMO_SELEC table.(Customise table).

  SELECT *

   from ZDEMO_SELEC
  into TABLE t_name.

The below example code is used to get data based on a condition with all fields(columns) from MARA table.

**Declare internal table

DATA : t_name TYPE TABLE OF ZDEMO_SELEC.

* read data

SELECT * FROM ZDEMO_SELEC INTO TABLE t_name WHERE name = 'RAM' .

Step2: Using Select Single in SAP ABAP  Normal

Select Single is a statement which is used to read single data from a database table.The below is the example
code for reading single record from ZSEMO_SELEC table.

Note: When ever we use select single, we must pass key field in where condition.

**Declare internal table


DATA : W_NAME TYPE TABLE OF ZDEMO_SELEC.

*use select * to read data


SELECT SINGLE * FROM ZDEMO_SELEC INTO W_NAME WHERE NAME = 'RAM'.

Step3: Using Select Max in SAP ABAP  Important  

By using this query we can get highest numeric value of a column in SAP Database tables.

Syntax: SELECT MAX( <COLUMNNAME> ) INTO (<VARIABLE>) FROM <TABLE> .

Get Maximum value of a column using Select Max


The below statement will get the maximum value of column MARKS from ZDEMO_SELEC table.

DATA LV_MAX TYPE ZDEMO_SELEC-MARKS.


SELECT MAX( MARKS )
INTO (LV_MAX)
FROM ZDEMO_SELEC .
WRITE:/ LV_MAX.

Note: Some time in Interview ,interviewer will ask find second max value .

DATA LV_MAX TYPE ZDEMO_SELEC-MARKS.


SELECT MAX( MARKS )
INTO (LV_MAX)
FROM ZDEMO_SELEC .

Get Minimum value of a column using Select MIN

The below statement will get the minimum value of column MARKS from ZDEMO_SELEC table.
    SELECT MIN( marks )
    INTO (LV_Min)
    FROM ZDEMO_SELEC.

Find 2nd min value.


      SELECT MIN( MARKS )
      INTO LV_Min
      FROM ZDEMO_SELEC WHERE marks > LV_min.
      WRITE:/ 'MIn' , LV_min.

Step4: Using Select UP TO in SAP ABAP  Normal

    BY using Select Up To query we will get the specific no of records from a data base table, it will        get
records from starting(beginning). Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 16/90
4/13/23, 12:38 PM SAPTech: 2016
    Syntax:select * FROM <TABLE> INTO TABLE <ITAB> UP TO <NUMBEROFROWS> rows.
SAPTech     data : it_mara type TABLE OF mara.

    *Get 50 rows form starting


Classic Home
     select * FROM mara INTO TABLE it_mara UP TO 50 rows.

Step5:Using Select Distinct in SAP ABAP  Norma

     Select Distinct is used to get distinct (unique) values of a particular column in SAP ABAP.
Syntax: SELECT DISTINCT <COULMN> FROM <TABLE> INTO TABLE <ITAB>.

Step6:Using Select Order by in SAP ABAP  Important

SELECT ORDERBY is used to fetch data from database table with sorted result set, by default the result will be
sorted in ascending order, to sort in descending order you have to specify

Syntax: SELECT * FROM <TABLE> INTO TABLE <ITAB> ORDER BY <COLUMN>


ASCENDING/DESCENDING.

By default oreder by will be in ASCENDING order.

The above statement is educational purpose only, in your real-time projects don`t use SELECT ORDERBY, it
decreases performance of a program, instead use SORT after fetching
data. SORT <ITAB> ASCENDING/DESCENDING.

Step7: Using Wildcards in Selects  Normal  

SQL Wildcards are used to search for data in a database table, below are the
examples of using wildcards in SAP ABAP.

The below example will get all records from zdemo_selec where NAME contains 'AM'.
 SELECT NAME
  into TABLE t_name
  from ZDEMO_SELEC
    where name LIKE '%AM%'

The below example will get all records from zdemo_selec where NAME starting with  'AM'.
 SELECT NAME
  into TABLE t_name
  from ZDEMO_SELEC
    where name LIKE 'AM%'

The below example will get all records from zdemo_selec where NAME ending with  'AM'.
 SELECT NAME
  into TABLE t_name
  from ZDEMO_SELEC
    where name LIKE '%AM'

Thanks 
Facebook Page [https://www.facebook.com/mySAPTech]

Posted 25th October 2016 by Blogger

3 View comments

13th October 2016 TABSTRIP in Module pool .

                              

 1. Goto SE38 and create a module pool program .


 2.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 17/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-wx4CcKYibqQ/V_-
eR0Vb9SI/AAAAAAAAOIE/uJW8HGdjQJs5zBxUf_dLzJs9gNbrOKF5QCLcB/s1600/ts.png]
3. Click on tab strip icon like 2. Drag and drop on layout.
4.  First only 2 tab will come ,so for more tab give tab line. Mine is 3
    

[https://4.bp.blogspot.com/-5uS4tmHLA5Y/V_-
fdgDymhI/AAAAAAAAOIY/g8H3iYWRMFIrqnrCv_f5sl2orFtpsaG4wCEw/s1600/tab_no.png]
5. Click on TAB1 and drop one subscreen and give name SUB1
6. Give TAB1 description like this

[https://4.bp.blogspot.com/-UL9f3kwFLY8/V_-
htZeXjYI/AAAAAAAAOIc/WLmrC3SsPRsFkMsgOCDfgbb2qOqzoT2FwCLcB/s1600/tab1.png]
7. Ref Field auto will come whatever you gave subscreen area name.
8. Do for all tab like this and give different name for subscreen are.
10. Design your screen 100 like this.(This is normal screen)

[https://3.bp.blogspot.com/-p8oH_NIwdO0/V_-
iYPpvI0I/AAAAAAAAOIk/5V2EXNFRxkkxiD5vFvFZVZZBInSarJD3wCLcB/s1600/main_100.png]

11.Now Create 3 subscreen and design like this.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 18/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-HUt5woaBbpA/V_-
jUywGFQI/AAAAAAAAOI4/sfI1bqdPYB4i2da5t8Rc_QGLe5rPdyy6ACLcB/s1600/subscreen_110.png]

12. Give same name as whatever you gave on tab strips.


13. Get Data from dictionary from MARA table on SUB1

[https://4.bp.blogspot.com/-iTsUYwX-APU/V_-
jUtfJJAI/AAAAAAAAOIs/fiQrM0pvCbgiSAfKTi1GOrzRezxENJyBQCEw/s1600/sub1.png]

14. Get Data from dictionary from MAKT table on SUB2

[https://4.bp.blogspot.com/-X-LpBqlKRjU/V_-
jUlRwdpI/AAAAAAAAOI0/K69ln52yHOEtMk5aUtVMsRzEWbnQB2SigCEw/s1600/sub2.png]

15.Get Data from dictionary from MARM table on SUB3

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 19/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://1.bp.blogspot.com/-1bFwI4pU2ss/V_-jUu-
VDXI/AAAAAAAAOIw/Jfw9Gy8EkuAt0BOBSyQGbKltmLicjML2ACEw/s1600/sub3.png]

16. Now write code on screen 100 like this 


         PROCESS BEFORE OUTPUT.
        MODULE STATUS_0100.
        call SUBSCREEN sub1 INCLUDING sy-repid '0110'.
        call SUBSCREEN sub2 INCLUDING sy-repid '0120'.
       call SUBSCREEN sub3 INCLUDING sy-repid '0130'.
*
     PROCESS AFTER INPUT.
     MODULE USER_COMMAND_0100.
     call SUBSCREEN sub1.
     call SUBSCREEN sub2.
     call SUBSCREEN sub3.
17. Now write whole code like this in proper module and subroutine.
*&---------------------------------------------------------------------*
*& Module Pool       ZDEMO_TABS_CON
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

PROGRAM zdemo_tabs_con.
TABLES: mara,marm,makt.
DATA: ok_code TYPE sy-ucomm.
TYPES: BEGIN OF type_mara,
        matnr TYPE mara-matnr,
        ersda TYPE mara-ersda,
        ernam TYPE mara-ernam,
        laeda TYPE mara-laeda,
      END OF type_mara,
      BEGIN OF type_makt,
        matnr TYPE makt-matnr,
        spras TYPE makt-spras,
        maktx TYPE makt-maktx,
      END OF type_makt,
      BEGIN OF type_marm,
        matnr TYPE marm-matnr,
        meinh TYPE marm-meinh,
        umrez TYPE marm-umrez,
      END OF type_marm.
DATA: w_mara TYPE type_mara,
      w_makt TYPE type_makt,
      w_marm TYPE type_marm.
CONTROLS: ts TYPE TABSTRIP.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 20/90
4/13/23, 12:38 PM SAPTech: 2016
MODULE status_0100 OUTPUT.

SAPTech  SET PF-STATUS 'MENU'.
  SET TITLEBAR 'TITLE'.

Classic Home
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE ok_code.
    WHEN 'TAB1'.
      PERFORM f_tab1.
    WHEN 'TAB2'.
      PERFORM f_tab2.
    WHEN 'TAB3'.
      PERFORM f_tab3.
    WHEN 'ZDIS'.
      PERFORM get_material_detail.
      PERFORM GET_MATERIAL_Desc.
      PERFORM GET_MATERIAL_UNIT.
    WHEN 'ZEXIT'.
      LEAVE PROGRAM.
    WHEN 'ZCLR'.
      CLEAR: w_makt,W_MARA,W_MARM.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0110  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0110 INPUT.
  CASE ok_code.
        WHEN 'ZEXIT'.
      LEAVE PROGRAM.
     WHEN 'TAB1'.
       MARA-matnr = W_MARA-matnr.
       MARA-ersda = W_MARA-ersda.
       MARA-ernam = W_MARA-ernam.
       MARA-laeda = W_MARA-laeda.
     WHEN 'TAB2'.
       MAKT-matnr = W_MAKT-matnr.
       MAKT-spras = W_MAKT-spras.
       MAKT-maktx = W_MAKT-maktx.
     WHEN 'TAB3'.
       MARM-matnr = W_MARM-matnr.
       MARM-meinh = W_MARM-meinh.
       MARM-umrez = W_MARM-umrez.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0110  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0120  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0120 INPUT.
  CASE ok_code.
    WHEN 'ZEXIT'.
      LEAVE PROGRAM.
*  WHEN .
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0120  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0130  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0130 INPUT.
  CASE ok_code.
    WHEN 'ZEXIT'.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 21/90
4/13/23, 12:38 PM SAPTech: 2016
      LEAVE PROGRAM.

SAPTech*  WHEN .
    WHEN OTHERS.
  ENDCASE.
Classic Home
ENDMODULE.                 " USER_COMMAND_0130  INPUT
*&---------------------------------------------------------------------*
*&      Form  F_TAB1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_tab1 .
  ts-activetab = 'TAB1'.
ENDFORM.                    " F_TAB1
*&---------------------------------------------------------------------*
*&      Form  F_TAB2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_tab2 .
  ts-activetab = 'TAB2'.
ENDFORM.                    " F_TAB2
*&---------------------------------------------------------------------*
*&      Form  F_TAB3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_tab3 .
  ts-activetab = 'TAB3'.
ENDFORM.                    " F_TAB3
*&---------------------------------------------------------------------*
*&      Form  GET_MATERIAL_DETAIL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_material_detail .
  SELECT SINGLE
         matnr
         ersda
         ernam
         laeda
   FROM  mara
  INTO w_mara
  WHERE matnr = mara-matnr.
ENDFORM.                    " GET_MATERIAL_DETAIL
*&---------------------------------------------------------------------*
*&      Form  GET_MATERIAL_UNIT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_material_unit .
  SELECT SINGLE matnr
                meinh
                umrez
 FROM marm
 INTO w_marm
 WHERE matnr = mara-matnr.
ENDFORM.                    " GET_MATERIAL_UNIT
*&---------------------------------------------------------------------*
*&      Form  GET_MATERIAL_DESC
*&---------------------------------------------------------------------*
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 22/90
4/13/23, 12:38 PM SAPTech: 2016
*       text

SAPTech*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
Classic Home
*----------------------------------------------------------------------*
FORM get_material_desc .
  SELECT SINGLE
              matnr
              spras
              maktx
  from makt
  INTO w_MAKT
  WHERE matnr = mara-matnr.
ENDFORM.                    " GET_MATERIAL_DESC

17. Save and activate


18. Cretae one tcode
19. excecute.
O/P:  

[https://2.bp.blogspot.com/-DR6B5z86YBQ/V_-
lLzbjvrI/AAAAAAAAOJE/SSUaqtI5BUwAYhHW4JCEJFTLLMEB3_fKgCLcB/s1600/op.png]

Thank You :)

Facebook Page [https://www.facebook.com/mySAPTech]


Posted 13th October 2016 by Blogger

0 Add a comment

12th October 2016 Interactive ALV.


    
             Use of Grid and List display
             Make fieldcatalog 
            Set PF Status
            Make user command and enable field to call the other screen
            Build Layout 
            Display Logo in header
            Make header                
 1. Goto se38 Create a program.
 2. Write these code

*&---------------------------------------------------------------------*
*& Report  ZDEMO_ALV_HEAD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zdemo_alv_head.
TYPE-POOLS: slis.
TABLES: kna1.
TYPES: BEGIN OF type_kna1,
        kunnr TYPE kna1-kunnr,
        land1 TYPE kna1-land1,
        name1 TYPE kna1-name1,
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 23/90
4/13/23, 12:38 PM SAPTech: 2016
        name2 TYPE kna1-name2,

SAPTech        ort01  TYPE kna1-ort01,
      END OF type_kna1,
      BEGIN OF type_bsid,
Classic Home
        kunnr TYPE bsid-kunnr,
        shkzg TYPE bsid-shkzg,
        wrbtr TYPE bsid-wrbtr,
      END OF type_bsid,
      BEGIN OF type_final,
        icon TYPE c,
        kunnr TYPE kna1-kunnr,
        shkzg TYPE bsid-shkzg,
        amt TYPE char17,
*        cre_amt TYPE char17,
        land1 TYPE kna1-land1,
        name1 TYPE kna1-name1,
        name2 TYPE kna1-name2,
        ort01 TYPE kna1-ort01,
*        total TYPE char17,
     END OF type_final.
DATA: t_kna1 TYPE STANDARD TABLE OF type_kna1,
      w_kna1 TYPE type_kna1,
      t_bsid TYPE STANDARD TABLE OF type_bsid,
      w_bsid TYPE type_bsid,
      w_final TYPE type_final,
      t_final TYPE STANDARD TABLE OF type_final.
DATA: deb_sum TYPE wrbtr,
      cre_sum TYPE wrbtr.
* For header making
DATA: t_list TYPE slis_t_listheader,
      w_list TYPE slis_listheader.

* for fieldcatlog
DATA: t_build TYPE  slis_t_fieldcat_alv,
      w_build TYPE slis_fieldcat_alv.

* Layout alv
DATA: w_layout TYPE slis_layout_alv.

* for exculuding icon
DATA: it_excluding TYPE  slis_t_extab,
      wa_excluding TYPE  slis_extab.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: r_btn1 RADIOBUTTON GROUP g1 DEFAULT 'X',
            r_btn2 RADIOBUTTON GROUP g1.
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.
SELECTION-SCREEN: END OF BLOCK b1.

START-OF-SELECTION.
  SELECT kunnr
         shkzg
         wrbtr
  FROM bsid
  INTO TABLE t_bsid
  WHERE kunnr IN s_kunnr.
  IF t_bsid IS NOT INITIAL.
    SORT t_bsid BY kunnr.
    SELECT
       kunnr
       land1
       name1
       name2
       ort01
     FROM kna1
     INTO TABLE t_kna1
     FOR ALL ENTRIES IN t_bsid
     WHERE kunnr EQ t_bsid-kunnr.
    IF sy-subrc EQ 0.
      SORT t_kna1 BY kunnr.
    ENDIF.
  ENDIF.
* Build final table
  CLEAR: deb_sum,cre_sum.
  LOOP AT t_bsid INTO w_bsid.
    w_final-kunnr = w_bsid-kunnr.
    w_final-shkzg = w_bsid-shkzg.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 24/90
4/13/23, 12:38 PM SAPTech: 2016
    IF w_bsid-shkzg = 'H'.
SAPTech      cre_sum  = cre_sum + w_bsid-wrbtr.
      w_final-amt = w_bsid-wrbtr.
      WRITE w_final-amt LEFT-JUSTIFIED DECIMALS 2.
Classic Home
      CONDENSE w_final-amt NO-GAPS.
      CONCATENATE '-' w_final-amt INTO w_final-amt SEPARATED BY ''.
    ENDIF.
    IF w_bsid-shkzg = 'S'.
      deb_sum = deb_sum + w_bsid-wrbtr.
      w_final-amt = w_bsid-wrbtr.
      CONDENSE w_final-amt NO-GAPS.
      WRITE w_final-amt LEFT-JUSTIFIED DECIMALS 2.
    ENDIF.
*    Traffic signal coding
    IF w_bsid-wrbtr LE 0.
      w_final-icon = 1.  "red signal
    ENDIF.
    IF w_bsid-wrbtr GE 0 AND w_bsid-wrbtr LE 1000.
      w_final-icon = 2.  "yellow signal
    ENDIF.
    IF w_bsid-wrbtr GT 1000.
      w_final-icon = 3. "green signal
    ENDIF.

    READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
      w_final-land1 = w_kna1-land1.
      w_final-name1 = w_kna1-name1.
      w_final-name2 = w_kna1-name2.
      w_final-ort01 = w_kna1-ort01.
    ENDIF.
    APPEND w_final TO t_final.
    CLEAR w_final.
  ENDLOOP.
  SORT t_final BY kunnr.

*  Build fieldcat
  PERFORM build_field_cat.

*  Build Layout
  PERFORM build_layout.

*  Exclude icon
  PERFORM f_exclude_icon.  

*  Buile Header
  PERFORM build_header.

*  Display data
  IF r_btn1 EQ 'X'.
    PERFORM f_display_list.
  ENDIF.
  IF r_btn2 EQ 'X'.
    PERFORM f_display_grid.
  ENDIF.

*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELD_CAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM build_field_cat .

  w_build-fieldname = 'KUNNR'.
  w_build-key = 'X'.
  w_build-seltext_m = 'Customer Number'.
  APPEND w_build TO t_build.
  CLEAR w_build.

  w_build-fieldname = 'SHKZG'.
  w_build-seltext_m = 'Indicator'.
  APPEND w_build TO t_build. Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 25/90
4/13/23, 12:38 PM SAPTech: 2016
  CLEAR w_build.
SAPTech  w_build-fieldname = 'AMT'.
  w_build-seltext_m = 'Amount'.
Classic Home
*   w_build-do_sum = 'X'.
  APPEND w_build TO t_build.
  CLEAR w_build.

  w_build-fieldname = 'LAND1'.
  w_build-seltext_m = 'Country Key'.
  APPEND w_build TO t_build.
  CLEAR w_build.

  w_build-fieldname = 'NAME1'.
  w_build-seltext_m = 'First Name'.
  APPEND w_build TO t_build.
  CLEAR w_build.

  w_build-fieldname = 'NAME2'.
  w_build-seltext_m = 'Last name'.
  APPEND w_build TO t_build.
  CLEAR w_build.

  w_build-fieldname = 'ORT01'.
  w_build-seltext_m = 'City'.
  APPEND w_build TO t_build.
  CLEAR w_build.

ENDFORM.                    " BUILD_FIELD_CAT
*&---------------------------------------------------------------------*
*&      Form  F_DISPLAY_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_display_list .
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = w_layout
      it_fieldcat        = t_build
    TABLES
      t_outtab           = t_final
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

ENDFORM.                    " F_DISPLAY_LIST
*&---------------------------------------------------------------------*
*&      Form  F_DISPLAY_GRID
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_display_grid .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'ZSTATUS'
      i_callback_user_command  = 'USER_COMM'
      i_callback_top_of_page   = 'TOP_OF_PAGE'
      is_layout                = w_layout
      it_fieldcat              = t_build
      it_excluding             = it_excluding
    TABLES
      t_outtab                 = t_final
    EXCEPTIONS
      program_error            = 1 Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 26/90
4/13/23, 12:38 PM SAPTech: 2016
      OTHERS                   = 2.

SAPTech  * Implement suitable error handling here
IF sy-subrc <> 0.

  ENDIF.
Classic Home

ENDFORM.                    " F_DISPLAY_GRID
*&---------------------------------------------------------------------*
*&      Form  zstatus
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->EXTAB      text
*----------------------------------------------------------------------*
FORM zstatus USING extab TYPE slis_t_extab.
   set PF-STATUS 'MENU'.
*   at USER-COMMAND.

   REFRESH extab.

ENDFORM.                    "zstatus

*&---------------------------------------------------------------------*
*&      Form  USER_COMM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM       text
*      -->RS_SLISFIELD  text
*----------------------------------------------------------------------*
FORM user_comm USING r_ucomm TYPE sy-ucomm
                     rs_slisfield TYPE slis_selfield.
  CASE r_ucomm.
    WHEN '&IC1'.
      READ TABLE t_final INDEX rs_slisfield-tabindex INTO w_final.
      IF sy-subrc EQ 0.
        IF rs_slisfield-fieldname = 'KUNNR'.
          CALL TRANSACTION 'SE11'.
        ENDIF.
      ENDIF.
    WHEN OTHERS.
  ENDCASE.
    CASE sy-ucomm.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
    WHEN OTHERS.
  ENDCASE.
ENDFORM.                    "USER_COMM
*&---------------------------------------------------------------------*
*&      Form  BUILD_HEADER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM build_header .
  w_list-typ = 'H'.
  w_list-info = 'Customer Detail'.
  APPEND w_list TO t_list.
  CLEAR w_list.

  w_list-typ = 'S'.
  w_list-key = 'Date:'.
  CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum+0(4) INTO w_list-info SEPARATED BY '.'.
  APPEND w_list TO t_list.
  CLEAR w_list.

  w_list-typ = 'A'.
  CONCATENATE 'Owner:' text-002 INTO w_list-info SEPARATED BY ' '.
  APPEND w_list TO t_list.
  CLEAR w_list.
ENDFORM.                    " BUILD_HEADER
*&---------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&---------------------------------------------------------------------*
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 27/90
4/13/23, 12:38 PM SAPTech: 2016
*       text

SAPTech*----------------------------------------------------------------------*
FORM top_of_page.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
Classic Home
    EXPORTING
      it_list_commentary = t_list
      i_logo             = 'ZDEMO'
*     I_END_OF_LIST_GRID =
*     I_ALV_FORM         =
    .

ENDFORM.                    "TOP_OF_PAGE
*&---------------------------------------------------------------------*
*&      Form  F_EXCLUDE_ICON
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_exclude_icon .
  wa_excluding-fcode = '&ILT'.  " Function code for filter icon
  APPEND wa_excluding TO it_excluding.
ENDFORM.                    " F_EXCLUDE_ICON
*&---------------------------------------------------------------------*
*&      Form  BUILD_LAYOUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM build_layout .
  w_layout-item_text = 'Status'.
  w_layout-zebra = 'X'.
  w_layout-lights_fieldname = 'ICON'.
ENDFORM.                    " BUILD_LAYOUT

     
  PERFORM f_exclude_icon.
        This sub routine is made for exclude icon from application tool bar.
         this is the function code for filter icon '&ILT'.
         after passing it into it_exculding under REUSE_ALV_GRID_DISPLAY .it will be disable.

*    Traffic signal coding
    IF w_bsid-wrbtr LE 0.
      w_final-icon = 1.  "red signal
    ENDIF.
    IF w_bsid-wrbtr GE 0 AND w_bsid-wrbtr LE 1000.
      w_final-icon = 2.  "yellow signal
    ENDIF.
    IF w_bsid-wrbtr GT 1000.
      w_final-icon = 3. "green signal
    ENDIF.
            This code is for traffic signal . if amount is -ve red, if in betwen 100 to 1000
yellow and more             than that green.
            For  This i have made layout and passed the light_fieldname in subroutine 
*  Build Layout
  PERFORM build_layout.

 I have made TOP_OF_PAGE


 under this we are makeing header of the ALV.
for this i have made one subroutine and i have passed whole values whatever i want on header 
PERFORM build_header

 i_callback_top_of_page   = 'TOP_OF_PAGE'
FOR this make one subroutine using same name TOP_OF_PAGE
and call the function module REUSE_ALV_COMMENTARY_WRITE

In this FM i have passed LOGO


To achive this we need to upload logo to ALV ABAP.

1. Go to Transaction OAER,
2. Give Class Name as PICTURES
3. Class type as OT
4. Object Key as the name of the Object u want to specify (ZDEMO mine)
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 28/90
4/13/23, 12:38 PM SAPTech: 2016
5. Upon execution you would be prompted to give the file path details. Just upload which ever logo u want to display

SAPTech 6. Now you can use the same name in your ALV FM

Classic Home

[https://4.bp.blogspot.com/-
oHx0cHRLPj0/V_46X46GHCI/AAAAAAAAOHg/kG7CWoaa0wYipNXhcUq5xZsdkZ3QDXsrwCEw/s1600/up_logo.png]

[https://2.bp.blogspot.com/-
FlSoxfOrlq0/V_46YBPx9kI/AAAAAAAAOHk/njCt46NaVagR98UVq6ibSpUSqX1yNBnvwCEw/s1600/after_logo.png]

   i_callback_user_command  = 'USER_COMM'
         To achive this i_callback_user_command. make one subroutine with same name which one
you passed 'USER_COMM'.  Write your whole logic to the subroutine.

 i_callback_pf_status_set = 'ZSTATUS' 
        To achive this make one subroutine with name  'ZSTATUS' and under this subroutine set PF
status and give GUI status name 'MENU'.
   1. double click on that and make your own gui status . After double clicking it will redirect you to           screen painter
SE41.

Now Save above code and execute it.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 29/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-peS14kc-
Aic/V_46VJQj1WI/AAAAAAAAOHY/UEhz_wZ0l_sO9y5wGdj_AwvECwzX5RQSwCLcB/s1600/screen.png]

 With Enable filte Button (Not called *  PERFORM f_exclude_icon.)

[https://1.bp.blogspot.com/-jwlTkmjk1EY/V_4763a1tsI/AAAAAAAAOHw/EEFEXg76q8gdqA-
o1GGUM6OVhXiUdv8dQCLcB/s1600/e_f.png]

 With disable filter Button (Called this :PERFORM f_exclude_icon.)


Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 30/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://2.bp.blogspot.com/-
tVmQH8Suncw/V_48DzRwjBI/AAAAAAAAOH0/OcNgMoW6I3w4Vf6f0gNAPxC2d5tTTznjACLcB/s1600/d_f.png]

Thank you
Facebook Page [https://www.facebook.com/mySAPTech]

Posted 12th October 2016 by Blogger

0 Add a comment

30th September 2016 Send Adobe form as email attachment

                

[https://3.bp.blogspot.com/-uNtWxcWpqqc/V-
6iZc5DpzI/AAAAAAAAOHE/naqtRjL5EW82DpsVJGQsmxO7JkZjEV6sQCLcB/s1600/do_form.jpg]

1. Execute the TCODE SFP.


2. Create form Interface name it as ZDEMO_PDF_MAIL.
3. Declare your internal table and Global data here like this.
      

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 31/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-idjFcLI0iDI/V-
6f1Lz3HqI/AAAAAAAAOGk/ZLGPwrKi_rM5qBwOQ7kWM24NtWSCGvaggCLcB/s1600/interface.png]

      4. If any quantity and currency field is there declare it under Currency and quant field.
      5. For this first declare a variable under global data like this.

[https://1.bp.blogspot.com/-We8KpnP6ctw/V-6ggpSH-
2I/AAAAAAAAOGo/4UvdGjrmH6wm0zDRwwpVWyWlKP0j8dTyQCLcB/s1600/global.png]

     6. Than declare Currency/Quant using these variable , Like this.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 32/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-eDg4jN3RuCw/V-6g3W0vHTI/AAAAAAAAOGs/-
k_MiSAgmHgkq80Lc0wwkf9koKy2YgHiACLcB/s1600/curr.png]

   7. Save and activate it.


   8. Now Create Form ,while creating give  same interface name ZDEMO_PDF_MAIL.
   9. Save 
   10. Now under context tab -> under Import Drag and drop whole internal table.
   11. 

[https://3.bp.blogspot.com/-39mRu0Y2f30/V-6hnAXLUpI/AAAAAAAAOG4/aeAL9ncO-KUR99xk_2-
0G6alEHR3F4hbQCLcB/s1600/tab.png]

    12. I have created Table type for the structure. Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 33/90
4/13/23, 12:38 PM SAPTech: 2016
    13.Now design your Layout.
SAPTech      14.
15.
On master page all window will be constant , it will go in all pages.

Classic Home

[https://1.bp.blogspot.com/-E_Mup2h1hnM/V-6ilJOpChI/AAAAAAAAOHI/w9Hvfx4DrGkZ-
wt_MJgOfYaFwQU1mmyUQCLcB/s1600/Master.png]

    16. Now for table which will display line item . Go to on design view of Bodypage.
          design your table.
17. go to table-> insert table. Pop up will come .
      Choose Create table using Assistance. than Body rows vary depending on data
18. now wrap it in subform

19. select sub form and under subform ->content make it as flowed
20. slect that table and check the check box page break 
21. Don't forgot to Bind the data.
22. For this select one cell of that table and go to object->Binding->data binding->use zdemo_pdf_mail ->data -> than
your respective field name.
23 Even for Master page where i have taken text field , don't forgot to bind it as respective field.
24.  save and activate it.
25.  Now Goto SE38 and cretae one program.
         *&---------------------------------------------------------------------*
*& Report  ZDEMO_PDF_MAIL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zdemo_pdf_mail.
TABLES: vbrk.
DATA: t_vbrk TYPE  zTvbrk,
*      w_vbrk TYPE zsvbrk,
      t_kna1 TYPE STANDARD TABLE OF zsskna1,
*      w_kna1 TYPE zsskna1,
      t_vbrp TYPE zTvbrp.
*      w_vbrp TYPE zsvbrp.
DATA: lv_out TYPE sfpoutputparams,
      lv_fm_name TYPE funcname,
      w_otf TYPE fpformoutput,
      t_otf TYPE STANDARD TABLE OF fpformoutput.
TYPES: BEGIN OF ty_binary,
        line TYPE x LENGTH 255,         "Binary Data
      END OF ty_binary.
DATA : lv_sf_fm TYPE rs38l_fnam,
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 34/90
4/13/23, 12:38 PM SAPTech: 2016
       g_objcont       TYPE STANDARD TABLE OF ty_binary,

SAPTech      w_bin_size       TYPE i,
      w_pdf_xstring   TYPE xstring,
      send_request    TYPE REF TO cl_bcs ,
Classic Home
      document        TYPE REF TO cl_document_bcs,
      sender          TYPE REF TO if_sender_bcs  ,
      recipient       TYPE REF TO if_recipient_bcs ,
      message_body    TYPE bcsy_text ,
      gv_send         TYPE ad_smtpadr ,
      gv_sent_to_all  TYPE os_boolean,
      binary_content  TYPE solix_tab,
      t_line          TYPE STANDARD TABLE OF tline,
      size            TYPE so_obj_len,
      w_subject(50)   TYPE c,
      w_xsf       TYPE ssfcrescl.

DATA: lv_sent_to_all  TYPE os_boolean.
SELECT-OPTIONS: s_vbeln FOR vbrk-vbeln.

START-OF-SELECTION.
  SELECT  vbeln
          vkorg
          vtweg
          spart
          fkdat
          kunrg
  FROM vbrk
  INTO TABLE t_vbrk
  WHERE vbeln IN s_vbeln.
  IF sy-subrc EQ 0.
    SORT t_vbrk BY vbeln.
    SELECT
        kunnr
        name1
        ort01
        land1
        pstlz
   FROM kna1
   INTO TABLE t_kna1
   FOR ALL ENTRIES IN t_vbrk
   WHERE kunnr = t_vbrk-kunrg.

    SELECT
       vbeln
       posnr
       matnr
       arktx
       fkimg
       netwr
   FROM vbrp
   INTO TABLE t_vbrp
   FOR ALL ENTRIES IN t_vbrk
    WHERE vbeln = t_vbrk-vbeln.
  ENDIF.
END-OF-SELECTION.
*  lv_out-PDLTYPE = 'E'.

  CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
    EXPORTING
      i_name              = 'ZDEMO_PDF_MAIL'
    IMPORTING
      e_funcname          = lv_fm_name
*     E_INTERFACE_TYPE    =
*     EV_FUNCNAME_INBOUND =
    .
  lv_out-device = 'PRINTER'.
  lv_out-dest = 'LP01'.
*  lv_out-nodialog = 'X'.
  lv_out-connection = 'ADS'.
  lv_out-GETPDF = 'X'.
  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = lv_out
    EXCEPTIONS
      cancel          = 1
      usage_error     = 2
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 35/90
4/13/23, 12:38 PM SAPTech: 2016
      system_error    = 3

SAPTech      internal_error   = 4
      OTHERS          = 5.
  IF sy-subrc <> 0.
Classic Home
* Implement suitable error handling here
  ENDIF.
  DATA: doc_param TYPE sfpdocparams.
  doc_param-langu = 'E'.
  doc_param-country = 'US'.
CALL FUNCTION lv_fm_name"'/1BCDWB/SM00000236'
  EXPORTING
   /1BCDWB/DOCPARAMS        = doc_param
    tab_vbrk                 = t_vbrk
    tab_vbrp                 = t_vbrp
    tab_kna1                 = t_kna1
 IMPORTING
   /1BCDWB/FORMOUTPUT       = w_otf
 EXCEPTIONS
   USAGE_ERROR              = 1
   SYSTEM_ERROR             = 2
   INTERNAL_ERROR           = 3
   OTHERS                   = 4
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*move w_otf-pdf to t_otf-pdf.
PERFORM F_SEND_MAIL.

  CALL FUNCTION 'FP_JOB_CLOSE'
*  IMPORTING
*    E_RESULT             =
  EXCEPTIONS
    USAGE_ERROR          = 1
    SYSTEM_ERROR         = 2
    INTERNAL_ERROR       = 3
    OTHERS               = 4
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  F_SEND_MAIL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_send_mail .

  DATA:   lv_adrnr   TYPE kna1-adrnr,
          lv_name1   TYPE kna1-name1,
          l_sub      TYPE so_obj_des,
          l_invoice  TYPE vbeln_vf,
          p_receiver TYPE so_recname.

  CALL METHOD cl_document_bcs=>xstring_to_solix
EXPORTING
ip_xstring = w_otf-pdf
RECEIVING
rt_solix = g_objcont.

  CLASS cl_bcs DEFINITION LOAD.
  send_request = cl_bcs=>create_persistent( ).
  CONCATENATE 'Dear Business Partner,' lv_name1  INTO lv_name1.
*    * Create message body and name of the attachment

  APPEND lv_name1 TO message_body.
  APPEND INITIAL LINE TO message_body.
  APPEND 'Adobe Customer Deatil.' TO message_body.
  APPEND INITIAL LINE TO message_body.
  APPEND 'Best regards,' TO message_body.
  APPEND 'MySAPnuts' TO message_body.
  CONCATENATE 'Mondelez Account Statement' ''  INTO  l_sub
Dynamic Views theme. .
Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 36/90
4/13/23, 12:38 PM SAPTech: 2016
*    * Email Body

SAPTech  document  = cl_document_bcs=>create_document(
                                i_type = 'RAW'
                                i_text = message_body
Classic Home
                                i_subject = l_sub ).
  TRY.
      w_subject = 'Adobe form Output'.
      CALL METHOD document->add_attachment
        EXPORTING
          i_attachment_type    = 'PDF'
          i_attachment_subject = w_subject
          i_att_content_hex    = g_objcont.
    CATCH cx_document_bcs .
  ENDTRY.
*    * Pass the document to send request

  CALL METHOD send_request->set_document( document ).

*    * Create recipient
  gv_send = 'sapabaptech16@gmail.com'.
  recipient = cl_cam_address_bcs=>create_internet_address( gv_send ).

*    *Set recipient

  CALL METHOD send_request->add_recipient
    EXPORTING
      i_recipient = recipient
      i_express   = 'X'.
  TRY.
      CALL METHOD send_request->set_send_immediately
        EXPORTING
          i_send_immediately = 'X'.
      .
    CATCH cx_send_req_bcs .
  ENDTRY.

  TRY.
      CALL METHOD send_request->send
        EXPORTING
          i_with_error_screen = 'X'"SPACE
        RECEIVING
          result              = lv_sent_to_all.
    CATCH cx_send_req_bcs .
  ENDTRY.

  IF lv_sent_to_all = 'X'.
    MESSAGE 'Email sent succesfully'TYPE 'S'.
  ELSEIF lv_sent_to_all IS INITIAL.
    MESSAGE i000(8i) WITH 'Email not send'.
  ENDIF.
  COMMIT WORK.
ENDFORM.                    " F_SEND_MAIL

         Save , Activate and execute.


      Check your mail or use tcode SOST. Attachment will be there.

Thank you. 
Facebook Page [https://www.facebook.com/mySAPTech]
Posted 30th September 2016 by Blogger

0 Add a comment

19th September 2016 How to make calculator Using Module Pool?

       
 Crete a module pool program using tcode se80
ZDEMO_MOD
*&---------------------------------------------------------------------*
*& Module Pool       ZDEMO_MOD
*&
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 37/90
4/13/23, 12:38 PM SAPTech: 2016
*&---------------------------------------------------------------------*

SAPTech *&
*&
*&---------------------------------------------------------------------*
Classic Home

INCLUDE zdemo_mod_top                           .    " global Data

INCLUDE zdemo_mod_pbo                           .  " PBO-Modules
INCLUDE zdemo_mod_pbi                          .  " PAI-Modules
* INCLUDE ZDEMO_MOD_F01                           .  " FORM-Routines
Create A screen 100.
PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.
*&---------------------------------------------------------------------*
*&  Include           ZDEMO_MOD_PBI
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
   DATA op TYPE i VALUE 0.
save_code = ok_code.
CASE save_code.
    WHEN 'Z1'.
      IF op = 0.
        var1 = ( res * 10 ) + 1.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 1.
        res = var2.
      ENDIF.
    WHEN 'Z2'.
      IF op = 0.
        var1 = ( res * 10 ) + 2.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 2.
        res = var2.
      ENDIF.
    WHEN 'Z3'.
      IF op = 0.
        var1 = ( res * 10 ) + 3.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 3.
        res = var2.
      ENDIF.
    WHEN 'Z4'.
      IF op = 0.
        var1 = ( res * 10 ) + 4.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 4.
        res = var2.
      ENDIF.
    WHEN 'Z5'.
      IF op = 0.
        var1 = ( res * 10 ) + 5.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 5.
        res = var2.
      ENDIF.
    WHEN 'Z6'.
      IF op = 0.
        var1 = ( res * 10 ) + 6.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 6.
        res = var2. Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 38/90
4/13/23, 12:38 PM SAPTech: 2016
      ENDIF.

SAPTech    WHEN 'Z7'.
      IF op = 0.
        var1 = ( res * 10 ) + 7.
Classic Home
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 7.
        res = var2.
      ENDIF.
   WHEN 'Z8'.
      IF op = 0.
        var1 = ( res * 10 ) + 8.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 8.
        res = var2.
      ENDIF.
   WHEN 'Z9'.
      IF op = 0.
        var1 = ( res * 10 ) + 9.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 9.
        res = var2.
      ENDIF.
   WHEN 'Z0'.
      IF op = 0.
        var1 = ( res * 10 ) + 0.
        res = var1.
      ELSE.
        var2 = ( res * 10 ) + 0.
        res = var2.
      ENDIF.

      WHEN 'ZP'.
      op = op + 1.
      res = 0.
      oper = '+'.
      IF op ge 1.
         var1 = var1 + var2.
      ENDIF.
    WHEN 'ZMI'.
      op = op + 1.
      res = 0.
      oper = '-'.
      IF op ge 1.
        IF var1 gt var2.
          var1 = var1 - var2.
        ELSE.
          var1 = var2 - var1.
        ENDIF.
      ENDIF.
    WHEN 'ZMU'.
      op = op + 1.
      res = 0.
      oper = '*'.
      TRY.
              var1 = var1 * var2.
            CATCH cx_sy_arithmetic_overflow INTO r_exc.
              text = r_exc->get_text( ).
              MESSAGE text  TYPE 'I'.
       ENDTRY.
    WHEN 'ZDIV'.
      op = 1.
      res = 0.
      oper = '/'.
      IF var1 ne 0.
        var1 = var1 / var2.
      else.
        MESSAGE 'Divide by Zero ' TYPE 'E'.
      ENDIF.
    WHEN 'ZEQ'.
      CASE oper.
        WHEN '+'.
          CLEAR: res, oper.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 39/90
4/13/23, 12:38 PM SAPTech: 2016
          res = var1 + var2.

SAPTech         WHEN '-'.
          CLEAR: res, oper.
          IF var1 GE var2.
Classic Home
            res = var1 - var2.
          ELSE.
            res = var2 - var1.
            res = res * -1.
          ENDIF.
        WHEN '*'.
          CLEAR: res, oper.
          TRY.
              res = var1 * var2.
            CATCH cx_sy_arithmetic_overflow INTO r_exc.
              text = r_exc->get_text( ).
              MESSAGE text  TYPE 'I'.
          ENDTRY.
        WHEN '/'.
          CLEAR: res, oper.
          IF var1 NE 0.
            res = var1 / var2.
          ELSE.
            MESSAGE 'Divide by Zero Error' TYPE 'E'.
          ENDIF.
      ENDCASE.
    WHEN 'ZC'.
      var1 = 0.
      var2 = 0.
      res = 0.
      op = 0.
   WHEN 'EXIT'.
     LEAVE PROGRAM.
   WHEN 'ZTHANK'.
     LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&  Include           ZDEMO_MOD_PBO
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'EXIT'.
  SET TITLEBAR 'TITLE'.
  IF on = 0.
    LOOP AT SCREEN.
      IF screen-group1 = 'G1'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
Create GUI Status 

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 40/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-CFsfzYlSZ9M/V-
ACWGICvYI/AAAAAAAAOGA/pJNZwnEO_8Q1dNGlx8psYUWRvb14LgNoQCEw/s1600/gui.jpg]

Crate Tcode for execution .

[https://3.bp.blogspot.com/-AVYqkvB0ljk/V-
ACn8VNXZI/AAAAAAAAOGE/qtnygwMnul0hc-Cta0Y_XTTGrYPBgWDYQCEw/s1600/tcode.jpg]

Execute The Tcode 

[https://3.bp.blogspot.com/-mqgjiMia_Kg/V-
ADn3LsMVI/AAAAAAAAOGM/zVtGZmD33xoTqiQ3F6w_T5Ugndsgfl58QCLcB/s1600/calc.jpg]

Thank you :) 


Facebook Page [https://www.facebook.com/mySAPTech]

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 41/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Posted 19th September 2016 by Blogger
Classic Home
2 View comments

19th September 2016 How to Call Smart Form Using Module Pool Program ?
  Step 1.   Go to SE80 and create a program (here it is ZDEMO_MOD_FORM).

Step 2.   Create top include with naming convention.

             Here the names are:


                   PROGRAM zdemo_mod_form.
                       INCLUDE zdemo_mod_top.
                       INCLUDE zdemo_sel_screen.
                       INCLUDE zdemo_pbo.
                       INCLUDE zdemo_pbi.
                       INCLUDE zdemo_form.
         
Step 3.  Create a screen that contains a number (here 0100).
Step 4.  Inside the screen create a sub screen by using the sub screen tool bar. There is no                   need to
create that sub screen separately.
Step 5.  In the Top Include mention the data  like below:
                TABLES mara,makt,mard.
          DATA: ok_code TYPE sy-ucomm.
           TYPES: BEGIN OF type_mara,
                    matnr TYPE matnr,
                   ersda TYPE ersda,
                  ernam TYPE ernam,
                  END OF type_mara,
        BEGIN OF type_makt,
          matnr TYPE matnr,
          spras TYPE spras,
          maktx TYPE maktx,
        END OF type_makt,
        BEGIN OF TYPE_MARD,
          MATNR TYPE MATNR,
          WERKS TYPE WERKS_D,
          LGORT TYPE LGORT_D,
        END OF TYPE_MARD.
 DATA: t_mara TYPE STANDARD TABLE OF type_mara,
       w_mara TYPE type_mara,
       t_makt TYPE STANDARD TABLE OF type_makt,
       w_makt TYPE type_makt,
       T_MARD TYPE STANDARD TABLE OF TYPE_MARD,
       W_MARD TYPE TYPE_MARD,
       t_final   TYPE  ztmara,
       w_final   TYPE  zmara,
       v_fname  TYPE tdsfname VALUE 'ZDEMO_MOD_FORM',
       v_fmname TYPE rs38l_fnam.
Step 6. In the sel_screen include mention select option like below:
                  SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.
                      SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
                      SELECT-OPTIONS   s_matnr FOR mara-matnr.
                      SELECTION-SCREEN END OF BLOCK b1.
                      SELECTION-SCREEN END OF SCREEN 101.

Step 6: Now write the code in the flow logic of the screen 100. In PBO we are calling sub screen 'SUB' which is
including the program name with the sub screen number '101'. After that we have to call sub screen 'SUB' at first
in the PAI block. If here it is not declared then the Select Option will remain blank.
PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
   CALL SUBSCREEN sub INCLUDING sy-repid '0101'.
*
PROCESS AFTER INPUT.
CALL SUBSCREEN sub.
 MODULE USER_COMMAND_0100

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SELECT'.
  SET TITLEBAR 'TITLE'.

ENDMODULE.                 " STATUS_0100  OUTPUT
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 42/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTechMODULE user_command_0100 INPUT.
 CASE ok_code.
Classic Home
    WHEN 'EXIT'.
      PERFORM leave.
    WHEN 'ZDIS'.
      PERFORM f_select_data.
      perform f_dis_form.
    when 'EMAIL'.
      PERFORM f_select_data.
      PERFORM F_SEND_MAIL_INVOICE.
  ENDCASE.
ENDMODULE.    

*&---------------------------------------------------------------------*
*&  Include           ZDEMO_FORM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  LEAVE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM leave .
*LEAVE TO SCREEN 0.
*LEAVE LIST-PROCESSING.
  LEAVE PROGRAM.
ENDFORM.                    " LEAVE
*&---------------------------------------------------------------------*
*&      Form  F_DIS_FORM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_dis_form .
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = v_fname
    IMPORTING
      fm_name            = v_fmname
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
  CALL FUNCTION v_fmname"'/1BCDWB/SF00000889'
* EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
    TABLES
      t_mara                     = t_final
   EXCEPTIONS
     formatting_error           = 1
     internal_error             = 2
     send_error                 = 3
     user_canceled              = 4
     OTHERS                     = 5
            .
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 43/90
4/13/23, 12:38 PM SAPTech: 2016
  IF sy-subrc <> 0.

SAPTech* Implement suitable error handling here
  ENDIF.

Classic Home
ENDFORM.                    " F_DIS_FORM
*&---------------------------------------------------------------------*
*&      Form  F_SELECT_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_select_data .
  SELECT  matnr
          ersda
          ernam
  FROM mara
  INTO TABLE t_mara
  WHERE matnr IN s_matnr.
  IF sy-subrc EQ 0.
    SORT t_mara BY matnr.
  ENDIF.
  IF t_mara IS NOT INITIAL.
    SELECT
        matnr
        spras
        maktx
     FROM makt
     INTO TABLE t_makt
     FOR ALL ENTRIES IN t_mara
     WHERE matnr = t_mara-matnr.
      IF sy-subrc EQ 0.
        SORT t_makt BY matnr.
      ENDIF.
      SELECT
          MATNR
          WERKS
          LGORT
      FROM MARD
      INTO TABLE T_MARD
      FOR ALL ENTRIES IN T_MARA
      WHERE MATNR = t_mara-MATNR.
        IF SY-SUBRC EQ 0.
           SORT T_MARD BY MATNR.
        ENDIF.
  ENDIF.

  PERFORM f_populate_final_data.
ENDFORM.                    " F_SELECT_DATA
*&---------------------------------------------------------------------*
*&      Form  F_POPULATE_FINAL_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_populate_final_data .
LOOP AT t_mara INTO w_mara.
        w_final-MATNR = W_MARA-MATNR.
        W_FINAL-ersda = W_MARA-ersda.
        W_FINAL-ernam = W_MARA-ernam.

    CLEAR W_MAKT.
    READ TABLE T_MAKT INTO W_MAKT WITH KEY MATNR = w_mara-MATNR BINARY SEARCH.
    IF SY-SUBRC EQ 0.
        W_FINAL-spras = W_MAKT-spras.
        W_FINAL-maktx = W_MAKT-maktx.
    ENDIF.

    CLEAR W_mard.
    READ TABLE t_mard INTO w_mard with key MATNR = w_mara-MATNR BINARY SEARCH.
    IF sy-subrc eq 0.
        w_final-WERKS = w_mard-WERKS.
        w_final-LGORT = w_mard-LGORT.
    ENDIF.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 44/90
4/13/23, 12:38 PM SAPTech: 2016
    append w_final to t_final.

SAPTechENDLOOP.
    SORT t_final by MATNR.
ENDFORM.                    " F_POPULATE_FINAL_DATA
Classic Home
*&---------------------------------------------------------------------*
*&      Form  F_SEND_MAIL_INVOICE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_send_mail_invoice .
    w_cparam-no_dialog = 'X'.
  w_cparam-getotf = 'X'.
  w_outoptions-tddest = 'LP01'.
  w_outoptions-tdnoprint = 'X'.
  w_outoptions-tdnewid   = 'X'.
  w_outoptions-tdimmed   = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = v_fname
    IMPORTING
      fm_name            = v_fmname
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
  CALL FUNCTION v_fmname"'/1BCDWB/SF00000889'
 EXPORTING
   CONTROL_PARAMETERS         = W_CPARAM
   OUTPUT_OPTIONS             = w_outoptions
   USER_SETTINGS              = 'X'
 IMPORTING
   JOB_OUTPUT_INFO            = W_OTF
    TABLES
      t_mara                     = t_final
   EXCEPTIONS
     formatting_error           = 1
     internal_error             = 2
     send_error                 = 3
     user_canceled              = 4
     OTHERS                     = 5
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
PERFORM f_convert_otf.
ENDFORM.                    " F_SEND_MAIL_INVOICE
*&---------------------------------------------------------------------*
*&      Form  F_CONVERT_OTF
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_convert_otf .
 CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = w_bin_size
      bin_file              = w_pdf_xstring
    TABLES
      otf                   = w_otf-otfdata[]
      lines                 = t_line[]
    EXCEPTIONS
      err_max_linewidth     = 1
      err_format            = 2
      err_conv_not_possible = 3
      err_bad_otf           = 4
      OTHERS                = 5.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 45/90
4/13/23, 12:38 PM SAPTech: 2016
  IF sy-subrc <> 0.

SAPTech    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
Classic Home
  PERFORM f_send_mail_to_sender.
ENDFORM.                    " F_CONVERT_OTF
*&---------------------------------------------------------------------*
*&      Form  F_SEND_MAIL_TO_SENDER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_send_mail_to_sender .
  data: l_sub       TYPE so_obj_des.
* XSTRING format is then converted to Binary Format (SOLIX_TAB) to
* use in the attachment mail
  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer     = w_pdf_xstring
    TABLES
      binary_tab = g_objcont.
  CLASS cl_bcs DEFINITION LOAD.
  APPEND 'Ruchi shah' TO message_body.
  APPEND INITIAL LINE TO message_body.
  APPEND 'Attached please find your Account Statement, ' TO message_body.
  APPEND INITIAL LINE TO message_body.
  APPEND 'Best regards,' TO message_body.
  APPEND 'Ruchi Shah' TO message_body.

  CONCATENATE 'Your Invoice' ''  INTO l_sub.
*    * Email Body

  document = cl_document_bcs=>create_document(

                                i_type = 'RAW'

                                i_text = message_body

                                i_subject = l_sub ).

  TRY.
      w_subject = text-017.
      CALL METHOD document->add_attachment
        EXPORTING
          i_attachment_type    = 'PDF'
          i_attachment_subject = w_subject
          i_att_content_hex    = g_objcont.
    CATCH cx_document_bcs .
  ENDTRY.

*    * Pass the document to send request
CALL METHOD send_request->set_document( document ).
  gv_send = 'abc@gmail.com'.
  recipient = cl_cam_address_bcs=>create_internet_address( gv_send ).

  TRY.
*     Set recipient
      CALL METHOD send_request->add_recipient
        EXPORTING
          i_recipient  = recipient .
    CATCH cx_send_req_bcs .
  ENDTRY.

  TRY.
      CALL METHOD send_request->set_send_immediately
        EXPORTING
          i_send_immediately = 'X'.
      .
    CATCH cx_send_req_bcs .
  ENDTRY.

  TRY.
      CALL METHOD send_request->send
        EXPORTING
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 46/90
4/13/23, 12:38 PM SAPTech: 2016
          i_with_error_screen = 'X'

SAPTech        RECEIVING
          result              = gv_sent_to_all.
    CATCH cx_send_req_bcs .
Classic Home
  ENDTRY.

  IF gv_sent_to_all = 'X'.
    MESSAGE text-006 TYPE 'S'.
  ELSEIF gv_sent_to_all IS INITIAL.
    MESSAGE i000(8i) WITH text-007.
  ENDIF.

  COMMIT WORK.

ENDFORM.                    " F_SEND_MAIL_TO_SENDER

In main Program:
*&---------------------------------------------------------------------*
*& Module Pool       ZDEMO_MOD_FORM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

PROGRAM zdemo_mod_form.
INCLUDE zdemo_mod_top.
INCLUDE zdemo_sel_screen.
INCLUDE zdemo_pbo.
INCLUDE zdemo_pbi.
INCLUDE zdemo_form.

in top Include *&---------------------------------------------------------------------*
*&  Include           ZDEMO_MOD_TOP
*&---------------------------------------------------------------------*

 TABLES mara.
 DATA: ok_code  TYPE sy-ucomm.
 TYPES: BEGIN OF type_mara,
          matnr TYPE matnr,
          ersda TYPE ersda,
          ernam TYPE ernam,
        END OF type_mara,
        BEGIN OF type_makt,
          matnr TYPE matnr,
          spras TYPE spras,
          maktx TYPE maktx,
        END OF type_makt,
        BEGIN OF TYPE_MARD,
          MATNR TYPE MATNR,
          WERKS TYPE WERKS_D,
          LGORT TYPE LGORT_D,
        END OF TYPE_MARD,
        BEGIN OF ty_binary,
         line TYPE x LENGTH 255,         "Binary Data
       END OF ty_binary.
 DATA: t_mara TYPE STANDARD TABLE OF type_mara,
       w_mara TYPE type_mara,
       t_makt TYPE STANDARD TABLE OF type_makt,
       w_makt TYPE type_makt,
       T_MARD TYPE STANDARD TABLE OF TYPE_MARD,
       W_MARD TYPE TYPE_MARD,
       t_final   TYPE  ztmara,
       w_final   TYPE  zmara,
       v_fname  TYPE tdsfname VALUE 'ZDEMO_MOD_FORM',
       v_fmname TYPE rs38l_fnam,
       w_cparam    TYPE ssfctrlop,
       w_outoptions TYPE ssfcompop,
       w_otf       TYPE ssfcrescl,
       w_bin_size      TYPE i,
       w_pdf_xstring   TYPE xstring,
       g_objcont       TYPE STANDARD TABLE OF ty_binary,
       send_request    TYPE REF TO cl_bcs ,
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 47/90
4/13/23, 12:38 PM SAPTech: 2016
      document        TYPE REF TO cl_document_bcs,

SAPTech      sender           TYPE REF TO if_sender_bcs  ,
      recipient       TYPE REF TO if_recipient_bcs ,
      message_body    TYPE bcsy_text ,
Classic Home
      gv_send         TYPE ad_smtpadr ,
      gv_sent_to_all  TYPE os_boolean,
      binary_content  TYPE solix_tab,
      size            TYPE so_obj_len,
      w_subject(50)   TYPE c,
       t_line          TYPE STANDARD TABLE OF tline.

Create TCOde

[https://2.bp.blogspot.com/-Cii1_E9Ifcc/V9_81Fk9RcI/AAAAAAAAOFs/a3xTXkyqY0YFCl8Z6Bwkj-z1lEHoge0rgCLcB/s1600/tcode.jpg]

Execute using Tcode :

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 48/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-ZFilXAgTHrc/V9_9VyzlzpI/AAAAAAAAOFw/3N-
2QrracYY96wxS_ZyVcWwjHR41ZW7qgCLcB/s1600/sel.jpg]

After clicking on email mail will send to respective mail id.

Thank you :)

Posted 19th September 2016 by Blogger

0 Add a comment

29th June 2016 How to send your smart form (otf) via mail and how to send
multiple attachment in Single mail.
*&---------------------------------------------------------------------*

*& Report  ZTEST_SMART_PDF
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZTEST_SMART_PDF.

TYPES: BEGIN OF TYPE_TOT,
         TOTAL TYPE C,
         G_TOTA TYPE CHAR17,
       END OF TYPE_TOT.
       DATA: N TYPE I.
DATA: T_TOT TYPE STANDARD TABLE OF TYPE_TOT,
      W_TOT TYPE TYPE_TOT.

DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 49/90
4/13/23, 12:38 PM SAPTech: 2016
      i_tline TYPE TABLE OF tline WITH HEADER LINE,
SAPTech      i_receivers  TYPE TABLE OF somlreci1 WITH HEADER LINE,
      i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
*      *     Objects to send mail.
Classic Home
      i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
      i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
*      *     Work Area declarations
      wa_objhead TYPE soli_tab,
      w_ctrlop TYPE ssfctrlop,
      w_compop TYPE ssfcompop,
      w_return TYPE ssfcrescl,
      wa_doc_chng TYPE sodocchgi1,
      w_data TYPE sodocchgi1,
      wa_buffer TYPE string, "To convert from 132 to 255
*     Variables declarations
      v_form_name TYPE rs38l_fnam,
      v_len_in LIKE sood-objlen,
      v_len_out LIKE sood-objlen,
      v_len_outn TYPE i,
      v_lines_txt TYPE i,
      v_lines_bin TYPE i.
DATA: w_cparam  TYPE ssfctrlop,
       w_outoptions TYPE SSFCOMPOP,
       c_x(1) TYPE c.
TABLES: bkorm,
        rf140,
        KNB1,
        bkpf.
TYPES: BEGIN OF type_bsid,
         bukrs TYPE bukrs,"company code
         kunnr TYPE kunnr,"customer no
         belnr TYPE belnr_d,"accounting doc no
         budat TYPE budat," posting date
         bldat TYPE bldat, " doc date
         waers TYPE waers,"currency
         wrbtr TYPE wrbtr, "amount
         xblnr TYPE xblnr1,"ref doc no
         blart TYPE blart, "doc type
         vbeln TYPE vbeln_vf,"billing doc

        END OF type_bsid,

        BEGIN OF type_vbkd,
          vbeln TYPE vbeln_vf,
          bstkd TYPE bstkd,"cust po no
       END OF type_vbkd,

       BEGIN OF type_T003T,
         blart TYPE  blart,
         ltext  TYPE ltext_003t, "doc type desc
       END OF type_T003T,

       BEGIN OF type_vbfa,
               vbelv TYPE vbfa-vbelv,
               vbeln TYPE vbfa-VBELN,
               vbtyp_v TYPE vbfa-vbtyp_v,
       END OF type_vbfa,

       BEGIN OF type_mhnd,
         bukrs TYPE bukrs,
         kunnr TYPE kunnr,
         belnr TYPE belnr_d,
         faedt TYPE netdt,
      END OF type_mhnd.

DATA: t_bsid TYPE STANDARD TABLE OF type_bsid,
      t_vbkd TYPE STANDARD TABLE OF type_vbkd,
      t_t003T TYPE STANDARD TABLE OF type_T003T,
       t_final TYPE TABLE OF zmop,
       t_mhnd TYPE STANDARD TABLE OF type_mhnd,
       t_vbfa TYPE STANDARD TABLE OF type_vbfa,
       w_vbfa TYPE type_vbfa, Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 50/90
4/13/23, 12:38 PM SAPTech: 2016
      w_bsid TYPE type_bsid,
SAPTech      w_vbkd  TYPE type_vbkd,
      w_t003T TYPE type_T003T,
      w_final TYPE zmop,
Classic Home
      w_mhnd TYPE type_mhnd.
DATA:t_vbfa1 TYPE STANDARD TABLE OF type_vbfa,
      t_vbfa2 TYPE STANDARD TABLE OF type_vbfa,
      w_vbfa1 TYPE type_vbfa,
      w_vbfa2 TYPE type_vbfa,
      t_vbfa11 TYPE STANDARD TABLE OF type_vbfa,
      t_vbfa22 TYPE STANDARD TABLE OF type_vbfa,
       w_vbfa11 TYPE type_vbfa,
      w_vbfa22 TYPE type_vbfa,
      gv_vbeln TYPE char12.

*&---------------------------------------------------------------------*
SELECTION-SCREEN  BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
* PARAMETERS: P_BUKRS TYPE T001-BUKRS.
SELECT-OPTIONS: s_bukrs   FOR  bkorm-bukrs OBLIGATORY,
                s_koart   FOR  rf140-koart_f140,     "DEFAULT 'D',
                s_konto   FOR  bkorm-konto OBLIGATORY,
                s_belnr   FOR  bkorm-belnr NO-DISPLAY,
                s_gjahr   FOR  bkorm-gjahr NO-DISPLAY.
PARAMETERS:     p_auszg   LIKE knb1-xausz.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) text-100 FOR FIELD p_budat1.
SELECTION-SCREEN POSITION POS_LOW.
PARAMETERS p_budat1    LIKE bkpf-budat." OBLIGATORY.
SELECTION-SCREEN POSITION POS_HIGH.
PARAMETERS p_budat2    LIKE bkpf-budat.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS: s_busab FOR knb1-busab.
*END_OF_BLOCK 0.
SELECTION-SCREEN END OF BLOCK b1.
*BEGIN_OF_BLOCK 2.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:     p_event   LIKE bkorm-event ."OBLIGATORY.
PARAMETERS:     p_xbukr   LIKE rf022-xbukr.
*END_OF_BLOCK 2.
SELECTION-SCREEN END OF BLOCK b2.
*BEGIN_OF_BLOCK 5.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS:     p_dedays      LIKE rfpdo-f140deld DEFAULT '08'.
*END_OF_BLOCK 5.
SELECTION-SCREEN END OF BLOCK b3.
*BEGIN_OF_BLOCK 8.
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) FOR FIELD prdest.
SELECTION-SCREEN POSITION POS_LOW.
PARAMETERS     prdest   LIKE tsp01-rqdest VISIBLE LENGTH 11.
SELECTION-SCREEN POSITION POS_HIGH.
PARAMETERS      rimmd    LIKE rfpdo2-f140immd DEFAULT ' '.
SELECTION-SCREEN COMMENT 61(40) text-206 FOR FIELD rimmd .
SELECTION-SCREEN END OF LINE.
*END_OF_BLOCK 8.
SELECTION-SCREEN END OF BLOCK b4.
START-OF-SELECTION.
PERFORM select_data.

*Get function module form smart form
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = 'YOTCF_STATEMENT_FORM'
  IMPORTING
    fm_name            = v_form_name
  EXCEPTIONS
    no_form            = 1
    no_function_module = 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.
ENDIF.
*Set control parameters and output options Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 51/90
4/13/23, 12:38 PM SAPTech: 2016
w_ctrlop-getotf = 'X'.
SAPTechw_ctrlop -no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
 w_cparam-no_dialog = 'X'.
Classic Home
  w_cparam-getotf = 'X'.
 w_cparam-device = 'PRINTER'.
  c_x              = ' '.
  w_outoptions-tddest = 'LOCAL'.
  w_outoptions-tdnoprint = 'X'.
  w_outoptions-tdnewid   = 'X'.
  w_outoptions-tdimmed   = 'X'.
  w_outoptions-tddest = 'LP01'.
  CALL FUNCTION v_form_name
    EXPORTING
*     ARCHIVE_INDEX              =
*     ARCHIVE_INDEX_TAB          =
*     ARCHIVE_PARAMETERS         =
     CONTROL_PARAMETERS         = w_cparam
*     MAIL_APPL_OBJ              =
*     MAIL_RECIPIENT             =
*     MAIL_SENDER                =
     OUTPUT_OPTIONS             = w_outoptions
     USER_SETTINGS              = 'X'
      p_bukrs                    = s_bukrs-LOW
      p_konto                    = s_konto-LOW
      p_budat                    = p_budat1
   IMPORTING
*     DOCUMENT_OUTPUT_INFO       =
     JOB_OUTPUT_INFO            = w_return
*     JOB_OUTPUT_OPTIONS         =
    TABLES
      t_final                    = T_FINAL
   EXCEPTIONS
     FORMATTING_ERROR           = 1
     INTERNAL_ERROR             = 2
     SEND_ERROR                 = 3
     USER_CANCELED              = 4
     OTHERS                     = 5
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
*Covert the OTF data returned to PDF format
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format                = 'PDF'
    max_linewidth         = 132
  IMPORTING
    bin_filesize          = v_len_in
  TABLES
    otf                   = i_otf
    lines                 = i_tline
  EXCEPTIONS
    err_max_linewidth     = 1
    err_format            = 2
    err_conv_not_possible = 3
    OTHERS                = 4.
IF sy-subrc <> 0.
ENDIF.
LOOP AT i_tline.
  TRANSLATE i_tline USING '~'.
  CONCATENATE wa_buffer i_tline INTO wa_buffer.
ENDLOOP.TRANSLATE wa_buffer USING '~'.
DO.
  i_record = wa_buffer.
  APPEND i_record.
  SHIFT wa_buffer LEFT BY 255 PLACES.
  IF wa_buffer IS INITIAL.
    EXIT.
  ENDIF.
ENDDO.
* Attachment
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 52/90
4/13/23, 12:38 PM SAPTech: 2016
REFRESH:  i_reclist,

SAPTech          i_objtxt
          i_objbin,
,

          i_objpack.CLEAR     wa_objhead.
Classic Home
i_objbin[] = i_record[].
* Create Message Body Title and Description
*i_objtxt = 'test with pdf-Attachment!'.
*APPEND i_objtxt.

i_objpack-obj_name = 'Mail_Excel_File'.
  i_objpack-obj_descr = ' Account Statement'.
  CONCATENATE  'Dear Business Partner' ','  INTO I_objtxt.
*  OBJTXT = 'Dear Business Partner,Attached please find your Account Statement, if you have a
ny disputes you can find the  contact details inside the attached document'.
  APPEND I_objtxt. CLEAR I_objtxt.

  CONCATENATE  ' ' '' INTO I_objtxt.
  APPEND I_objtxt. CLEAR I_objtxt.

  CONCATENATE  'Attached please find your Account Statement, if you have any disputes you can 
find the  contact details inside the attached document' '.'
    INTO I_objtxt.
  APPEND I_objtxt. CLEAR I_objtxt.

  CONCATENATE  ' ' '' INTO I_objtxt.
  APPEND I_objtxt. CLEAR I_objtxt.

  CONCATENATE  'Best regards' ',' INTO I_objtxt.
  APPEND I_objtxt. CLEAR I_objtxt.

  CONCATENATE  'Collections team' '.' INTO I_objtxt.
  APPEND I_objtxt. CLEAR I_objtxt.

*N = 1.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
* Main Text
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.APPEND i_objpack.
* Attachment (pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.

N = 1.
DESCRIBE TABLE i_objbin LINES v_lines_bin.READ TABLE i_objbin INDEX v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'List of Open item'.
i_objpack-obj_descr = 'Invoice Summary'.
APPEND i_objpack.CLEAR i_reclist.
i_reclist-receiver = 'ABC@GMAIL.COM'.
i_reclist-rec_type = 'U'.
APPEND i_reclist.

PERFORM build_xls_data_table.
 N = N + v_lines_bin.
 DESCRIBE TABLE  i_objbin LINES v_lines_bin.
 READ TABLE i_objbin INDEX v_lines_bin.
  I_objpack-doc_size = v_lines_bin * 255.
  I_objpack-transf_bin = 'X'.
  I_objpack-head_start = 1.
  I_objpack-head_num = 1.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 53/90
4/13/23, 12:38 PM SAPTech: 2016
  I_objpack-body_start = n.

SAPTech  I_objpack -body_num = v_lines_bin.
  I_objpack-doc_type = 'XLS'.
  i_objpack-obj_name = 'List of Open item'.
Classic Home
  I_objpack-obj_descr = 'Invoice Summary'.
*  APPEND objpack.
  APPEND i_objpack.CLEAR i_reclist.
*
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
  EXPORTING
    document_data              = wa_doc_chng
    put_in_outbox              = 'X'
    commit_work                = 'X'
  TABLES
    packing_list               = i_objpack
    object_header              = wa_objhead
    contents_bin               = i_objbin
    contents_txt               = i_objtxt
    receivers                  = i_reclist
  EXCEPTIONS
    too_many_receivers         = 1
    document_not_sent          = 2
    document_type_not_exist    = 3
    operation_no_authorization = 4
    parameter_error            = 5
    x_error                    = 6
    enqueue_error              = 7
    OTHERS                     = 8.
IF sy-subrc <> 0.
  WRITE:/ 'Error When Sending the File', sy-subrc.
ELSE.
  WRITE:/ 'Mail sent'.
ENDIF.
*&---------------------------------------------------------------------*
*&      Form  SELECT_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM select_data .
 SELECT bukrs
         kunnr
         belnr
         budat
         bldat
         waers
         wrbtr
         xblnr
         blart
         vbeln
    FROM bsid
    INTO TABLE t_bsid
    WHERE bukrs = s_bukrs-low
    AND kunnr = s_konto-low.
*    AND budat  EQ   p_budat1.

  IF sy-subrc EQ 0.
    SORT t_bsid BY bukrs kunnr.
  ENDIF.
  IF t_bsid IS NOT INITIAL.
*      PERFORM select_reference_no.

    DATA: tmp1 TYPE vbeln,
      tmp2 TYPE vbeln,
      tab LIKE sy-tabix,
      star TYPE char1 VALUE '*'.

    DATA: t_tmp1 TYPE STANDARD TABLE OF type_vbfa,
          w_tmp1 TYPE type_vbfa.
    TYPES: BEGIN OF type_bstkd,
            bstkd TYPE bstkd,
           END OF type_bstkd.
    DATA: t_bstkd TYPE STANDARD TABLE OF type_bstkd,
          w_bstkd TYPE type_bstkd.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 54/90
4/13/23, 12:38 PM SAPTech: 2016
    SELECT vbelv

SAPTech           vbeln
           vbtyp_v
      FROM vbfa
Classic Home
      INTO TABLE t_vbfa
      FOR ALL ENTRIES IN t_bsid
      WHERE vbeln = t_bsid-vbeln.
*       and vbtyp_v = 'C'
*       AND vbtyp_v = 'J'.
    IF sy-subrc EQ 0.
      SORT t_vbfa BY vbelv vbeln.
    ENDIF.
*       IF t_vbfa is not INITIAL.
*           SELECT
*      vbeln
*      bstkd
*    FROM vbkd
*    INTO TABLE t_vbkd
*    FOR ALL ENTRIES IN t_vbfa
*    WHERE
*       vbeln EQ t_vbfa-vbeln.
*    IF sy-subrc EQ 0.
*      SORT  t_vbkd BY vbeln.
*    ENDIF.
*       ENDIF.
*       endif.
*refresh: t_vbfa1,t_vbfa2.
    LOOP AT t_vbfa INTO w_vbfa.
      IF t_vbfa IS NOT INITIAL AND w_vbfa-vbtyp_v = 'C'.
        COLLECT w_vbfa INTO t_vbfa1.
      ENDIF.
      IF t_vbfa IS NOT INITIAL AND w_vbfa-vbtyp_v = 'J'.
        COLLECT w_vbfa INTO t_vbfa2.
      ENDIF.
    ENDLOOP.
    t_vbfa11[] = t_vbfa1.
    SORT t_vbfa11 BY vbeln.
*      DELETE ADJACENT DUPLICATES FROM t_vbfa11 comparing vbeln.
    tab = 1.
    LOOP AT t_vbfa1 INTO w_vbfa1.
      READ TABLE t_vbfa11 INDEX tab INTO w_vbfa11.
      IF sy-subrc EQ 0.
*         tmp1 = w_vbfa11-vbeln.
        tmp1 = w_vbfa11-vbelv.
        tab = tab + 1.
        READ TABLE t_vbfa11 INDEX tab INTO w_vbfa11 .
        IF sy-subrc EQ 0.
*            tmp2 = w_vbfa11-vbeln.
          tmp2 = w_vbfa11-vbelv.
        ENDIF.
      ENDIF.
      IF tmp1 = tmp2.
        CONCATENATE w_vbfa11-vbelv star INTO w_bstkd-bstkd ."SEPARATED BY ''.

        COLLECT w_bstkd INTO t_bstkd.
      ELSE.
*           CONCATENATE w_vbfa11-vbelv  INTO w_bstkd-bstkd ."SEPARATED BY ''.
*            COLLECT w_vbfa11 INTO t_bstkd.
      ENDIF.
    ENDLOOP.
    tab = 1.
    SORT t_vbfa1 BY vbeln.

    SELECT
      blart
      ltext
    FROM t003t
    INTO TABLE t_t003t
    FOR ALL ENTRIES IN t_bsid
    WHERE blart EQ t_bsid-blart.
    IF sy-subrc EQ 0.
      SORT t_t003t BY blart.
    ENDIF.

    SELECT Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 55/90
4/13/23, 12:38 PM SAPTech: 2016
     bukrs
SAPTech     kunnr
     belnr
     faedt
Classic Home
    FROM mhnd
    INTO TABLE t_mhnd
    FOR ALL ENTRIES IN t_bsid
    WHERE  bukrs  = t_bsid-bukrs
    AND belnr = t_bsid-belnr
    AND kunnr IN s_konto.
  ENDIF.
  LOOP AT t_bsid INTO w_bsid.
    w_final-bldat = w_bsid-bldat.
    w_final-belnr = w_bsid-belnr.
    w_final-xblnr = w_bsid-xblnr.
    w_final-blart = w_bsid-blart.
    w_final-waers = w_bsid-waers.
    w_final-wrbtr = w_bsid-wrbtr.
    CLEAR w_t003t.
    READ TABLE t_t003t INTO w_t003t WITH KEY blart = w_bsid-blart.
    IF sy-subrc EQ 0.
      w_final-ltext = w_t003t-ltext.
    ENDIF.
    CLEAR w_mhnd.
    READ TABLE t_mhnd INTO w_mhnd
       WITH  KEY
       bukrs = w_bsid-bukrs
       kunnr = w_bsid-kunnr
       belnr = w_bsid-belnr.
    IF sy-subrc EQ 0.
      w_final-faedt = w_mhnd-faedt.
    ENDIF.
    w_final-key = 0.
    APPEND w_final TO t_final.
    CLEAR w_final.
  ENDLOOP.

ENDFORM.                    " SELECT_DATA
*&---------------------------------------------------------------------*
*&      Form  BUILD_XLS_DATA_TABLE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM build_xls_data_table .

*  CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
*             con_tab TYPE x VALUE '09'.   "OK for non Unicode

*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
  CLASS cl_abap_char_utilities DEFINITION LOAD.
  CONSTANTS:
      con_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
      con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.

  CONCATENATE
'Document date' 'DT'  'Document description'  'Our reference' 'Your reference' 'Delivery ref'
 'Amount' 'CUR' '*' 'Due date'
      INTO i_objbin SEPARATED BY con_tab.
  CONCATENATE  i_objbin con_cret INTO i_objbin.
  APPEND i_objbin.
  CLEAR w_tot.
  LOOP AT t_final INTO w_final.
    w_tot-g_tota = w_tot-g_tota + w_final-wrbtr.
    CONCATENATE w_final-bldat w_final-blart w_final-ltext
                w_final-belnr w_final-bstnk_vf w_final-xblnr
                w_final-wrbtr w_final-waers w_final-key
                w_final-faedt
           INTO i_objbin SEPARATED BY con_tab.
    CONCATENATE i_objbin con_cret INTO i_objbin.
    APPEND  i_objbin.
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 56/90
4/13/23, 12:38 PM SAPTech: 2016
  ENDLOOP.

SAPTech  CONCATENATE ' '  ' ' 'TOTAL' ' ' ' ' ' ' w_tot-g_tota INTO i_objbin SEPARATED BY con_tab.
  CONCATENATE i_objbin con_cret INTO i_objbin.
Classic Home
  APPEND  i_objbin.
ENDFORM.                    " BUILD_XLS_DATA_TABLE

Posted 29th June 2016 by Blogger

0 Add a comment

2nd June 2016 How to Create Global Class?

 Steps :
Step 1 : GOTO Tcode SE24 .Give class name start with ZCL_ click on create and keep it as public, give proper
description. ->save 
      

[https://4.bp.blogspot.com/-5RsPUagUT4c/V1A-
4GcbxEI/AAAAAAAAL5Y/Gk75yH_4kDYunLAqS4MgeHoUFXy_Ln1lwCLcB/s1600/create.jpg]
Step 2:  GOTO method tab and give method name.
     

[https://4.bp.blogspot.com/-
oTK9t620ThI/V1A_OLwHfAI/AAAAAAAAL5c/wnuKHmtxnFUSvMYjKGkf8PBDuDhHlOtwwCLcB/s1600/method.jpg]
Step 3: Select any one of method and click on parameters type. Do same in both Method .
      

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 57/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-2tQDC-
XEvpw/V1A_oa4mu6I/AAAAAAAAL5k/_H-7jQX_AlsAKL3DTnujSNKO2Aj6PaJLQCLcB/s1600/para.jpg]
   
Step 4:  Now go in attributes type and declare internal table and work area as well as your parameters also.  Here i have
given table type and structure for internal table and work area respectively .
      for reference you can view this link. Table Type and Structure [http://mysapnuts.blogspot.in/2016/05/to-create-structure-and-
table-type.html] .

        

[https://2.bp.blogspot.com/-
q6FggyQOCr8/V1BAliNL6gI/AAAAAAAAL50/_dFZUI1ABJcde4rcVv6Ryi8J2MrfvXauQCLcB/s1600/attri.jpg]
Step 4.i.: Double click on select method and write your code for select method. also for display method ,do same.
for Select method:

    SELECT
    MATNR
ERSDA
ERNAM
    from mara INTO TABLE t_mara
    where MATNR BETWEEN p_matnr_low and p_matnr_high.

For Display method : 

LOOP AT t_mara INTO w_mara.
     write: / w_mara-matnr,
           w_mara-ernam,
           w_mara-ERSDA.
  ENDLOOP.

Step 5: Save and Activate it.


Step 6 : Now GOTO Tcode se38 and create a customize program .
 Step 7:  Write this code 

       *&---------------------------------------------------------------------*
*& Report  ZDEMO_INTERFACE
*&
*&---------------------------------------------------------------------*
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 58/90
4/13/23, 12:38 PM SAPTech: 2016
*&

SAPTech*&
*&---------------------------------------------------------------------*

Classic Home
REPORT ZDEMO_INTERFACE.
TABLES: MARA.
DATA: OBJ TYPE REF TO ZCL_INTERFACE_DEMO.

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.

START-OF-SELECTION.

Step 8 : After start of selection call your created class.


click on pattern -> Abap object ->Create object give name like this.

[https://4.bp.blogspot.com/-xKEHvgwNi8E/V1BCF-
GoehI/AAAAAAAAL6A/0iff53QCuSImMF8kaXt8onGQeSfZuwj6ACLcB/s1600/obj.jpg]

Step 9: This code will come : 


       CREATE OBJECT OBJ.
  Now again goto pattern -> Abap object -> call method give attributs like this, Same do for all method.

[https://1.bp.blogspot.com/-4LhYqx4cfqQ/V1BClCwEuII/AAAAAAAAL6E/yZ9M7mew-
TURmA_2i7KtwWeGHnpgk2hNACLcB/s1600/obj1.jpg]

Step 10: Code will generate like this .

CALL METHOD OBJ->SELECT_METHOD
  EXPORTING
    P_MATNR_LOW  = S_MATNR-low
    P_MATNR_HIGH = S_MATNR-high
    .

CALL METHOD OBJ->DISPLAY_METHOD
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 59/90
4/13/23, 12:38 PM SAPTech: 2016
  EXPORTING

SAPTech    P_MATNR_LOW  = s_matnr-low
Classic Home
Whole code will be like this : 
*&---------------------------------------------------------------------*
*& Report  ZDEMO_INTERFACE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZDEMO_INTERFACE.
TABLES: MARA.
DATA: OBJ TYPE REF TO ZCL_INTERFACE_DEMO.

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.

START-OF-SELECTION.
* CREATE OBJECT OBJ.
CREATE OBJECT OBJ.

CALL METHOD OBJ->SELECT_METHOD
  EXPORTING
    P_MATNR_LOW  = S_MATNR-low
    P_MATNR_HIGH = S_MATNR-high
    .

CALL METHOD OBJ->DISPLAY_METHOD
  EXPORTING
    P_MATNR_LOW  = s_matnr-low
    P_MATNR_HIGH = S_MATNR-high
    .
Step 11: Save it,active and execute.
output will come like this :

[https://4.bp.blogspot.com/-
HhoswlDYM4Y/V1BEDZj50FI/AAAAAAAAL6U/4GKGesPvRI0QPIr8pg_QZrkK7J5J4JgHwCLcB/s1600/op.jpg]

Posted 2nd June 2016 by Blogger

0 Add a comment

24th May 2016 How to make Copy Window in Smart Form?


 Here i want copy window in which main window will be same in every window only copy window
will change according to page.Already i have done with driver program you can refer it (Click
Here [http://mysapnuts.blogspot.in/2016/05/how-to-call-smart-form-using-driver.html]  ). In that only i am using concept
of copy window.

Steps:
step 1. Now Go to your Page1 and right Click -> Create window
Give description like this .
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 60/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-
ivvG2sTbvhg/V0RrjHRs1hI/AAAAAAAAL4U/nIFAlSxpkt49eqRKlCbcNY8pNrhu9qh7QCKgB/s1600/copy_desc.jpg]

Step 2. Right click on window->Create -> Flow logic->program line


under flow logic write some code like this.

[https://2.bp.blogspot.com/-wKypS8HJ8Ak/V0RshgVgzQI/AAAAAAAAL4g/Mcyhw38sF0gHU9kP64AYIyEA2a-PG70-
QCLcB/s1600/code.jpg]

Before this in global data Declare a variable :

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 61/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://2.bp.blogspot.com/-
TiBu5dgpUto/V0Rsgw9avGI/AAAAAAAAL4c/PU9QH66vuss21qzPATuQPNKqRjeicvkKwCLcB/s1600/vari.jpg]

Step 3. Right Click on Copy window -> create -> text


under that write  &TEXT&.

Step 4. Save and Activate . Execute your driver program.

[https://3.bp.blogspot.com/-tPNO1DsB21M/V0Rt-
Eu1O8I/AAAAAAAAL4s/bv-BeNjwGAkYgqmgUjzRV-alJ6af77mNwCLcB/s1600/print.jpg]

Number of copies will be 3.


After execution output will be.

[https://4.bp.blogspot.com/-
FltUlGdi2eo/V0RuUxtUXtI/AAAAAAAAL40/ec20_vf5l2Mxfb15HjurSJJU0au_aRs8wCLcB/s1600/2nd.jpg]

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 62/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://1.bp.blogspot.com/-
PS23Klx_zRI/V0RuU6Y6RSI/AAAAAAAAL4w/YS9QSbcwVJ4B9ENNP9QVzt7kFhABhnYUwCLcB/s1600/first.jpg]

Thanks :)

Posted 24th May 2016 by Blogger

0 Add a comment

24th May 2016 Modal Dialog Box In Module Pool Program

 Steps :
Step 1. Goto SE38 and create one program . Attributes will be like this.

[https://3.bp.blogspot.com/-
YdknG5xBAvM/V0QqFP2Hy2I/AAAAAAAAL2I/o8VIWoRqz_8iHSvXohWzIeOy-RoRpj4yQCLcB/s1600/desc.jpg]
Step 2. After Entering in program Click on Display object List (Ctrl+Shift+F7).

Step 3. Right click on your program name and create one screen.Give screen name what ever you want .1000 is the
default screen number.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 63/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-3DOSTRNaPB8/V0Qq2e1ZI7I/AAAAAAAAL2Q/WqEVbhfn-HU6kX3PI-
iWYNlSgtXEMzl1wCLcB/s1600/100.jpg]

Step 4. Give description like this . Screen type keep as normal Screen .

[https://3.bp.blogspot.com/-9Ynybfa7720/V0QrXoB7sCI/AAAAAAAAL2U/DjQAzyk_YtMdP5WmihUZAob4SrjedDyxgCLcB/s1600/scree
n100.jpg]

Step 5. Again right click on 100 screen and create one more screen .Screen Number 110 and give attributes like this .
Screen type should be Dialog screen .

[https://3.bp.blogspot.com/-
w4xP5iEvukI/V0QtdA3dngI/AAAAAAAAL2o/dqkEt4pIFXcGg1-j72kFOpb_6-tSHkOMwCLcB/s1600/screen110.jpg]
Step 6. Goto Your program and create one Structure , for that structure Create one work area.like this:
             TYPES: BEGIN OF TYPE_MARA,
                           MATNR TYPE MARA-MATNR,
                           ERSDA TYPE MARA-ERSDA,
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 64/90
4/13/23, 12:38 PM SAPTech: 2016
                           ERNAM TYPE MARA-ERNAM,

SAPTech                                        MTART  TYPE MARA-MTART,


 MATKL TYPE MARA-MATKL,
                      END OF TYPE_MARA.
Classic Home
            DATA: w_mara TYPE TYPE_MARA.

Step 7. Now go to screen 100 ,click on layout and design screen. Layout screen will come . There 
            click on Dictionary / Program Field (F6) .
             One more pop up will come like this , there Give in table name MARA and hit on Get from Dictionary . From there
select only MATNR.

[https://2.bp.blogspot.com/-
cx934qDVGY8/V0Qv0syjm0I/AAAAAAAAL24/VNfOF6SOuAA6XllCvc1NKr7H9cLKDg_GgCLcB/s1600/getdata.jpg]

Step 8.  Hit Enter and Goto your Layout screen and drop there. Create one push up button .
Name it Display . In FctCode pass any value. Using this value you can interact with your screen.It will be like This .

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 65/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-7jHA30uDsI0/V0Qw4jRf0_I/AAAAAAAAL3E/9fBzjTv3bTENw7AhUicGO8lh4Ov0zOpqwCLcB/s1600/dis.jpg]

Step 9. Save and activate this layout .


Step 10. Goto screen 110 -> layout->Dictionary / Program Field (F6) .
          There you give your work area name W_MARA and click on Get from program
Like this ->

[https://1.bp.blogspot.com/-xj2TdvWzecc/V0Qxz-
FmOyI/AAAAAAAAL3Q/BEAWl8fQSzMBkt1WD2ZiZZBMDVFiUE56QCLcB/s1600/wmara.jpg]

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 66/90
4/13/23, 12:38 PM SAPTech: 2016
Step 11. Select all field and Drop on your layout . Make one pushup Button for EXIT. same as display pass Fctcode
SAPTechZEXIT for interaction of screens.  Here you need to create Text for all field .
like for material text Create and give Text as Material, for ERSDA  Created on and so on .

Classic Home

[https://2.bp.blogspot.com/-
eUK48aafUjA/V0QyTkcAe6I/AAAAAAAAL3U/prCHkEFN3-o5qlFR05xHTNCW-NmQ1G7uwCLcB/s1600/exit.jpg]

Step 12. Now go in all screen and under that go on flow logic-> Uncomment under Input and output module. double click
on that and create it in main program.

Step 13. Write code according to this code under corresponding module .

    *&---------------------------------------------------------------------*
*& Module Pool       ZDEMO_MODULE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

PROGRAM ZDEMO_MODULE.
TABLES: mara.
TYPES: BEGIN OF TYPE_MARA,
        MATNR TYPE MARA-MATNR,
        ERSDA TYPE MARA-ERSDA,
        ERNAM TYPE MARA-ERNAM,
        MTART TYPE MARA-MTART,
        MATKL TYPE MARA-MATKL,
      END OF TYPE_MARA.
DATA: w_mara TYPE TYPE_MARA.
START-OF-SELECTION.
call SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'STATUS'.
  SET TITLEBAR 'TITLE'.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE sy-ucomm.
  WHEN 'ZDIS'.
     CALL SCREEN 0110
     STARTING AT 4 10
     ENDING AT 50 20.
  WHEN 'EXIT'.
    LEAVE PROGRAM.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 67/90
4/13/23, 12:38 PM SAPTech: 2016
*&---------------------------------------------------------------------*

SAPTech*&      Module  STATUS_0110  OUTPUT
*&---------------------------------------------------------------------*
*       text
Classic Home
*----------------------------------------------------------------------*
MODULE STATUS_0110 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

  SELECT SINGLE
  MATNR
  ERSDA
  ERNAM
  MTART
  MATKL
  FROM MARA
  INTO w_mara WHERE MATNR = mara-MATNR.
ENDMODULE.                 " STATUS_0110  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0110  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0110 INPUT.
CASE SY-UCOMM.
  WHEN 'ZEXIT'.
     CALL SCREEN 100.
*    LEAVE SCREEN.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_0110  INPUT

Step 14. In screen 100 Create GUI Status . Go in module output -> Uncomment the GUI part Double click on that it will
transfer you in menu screen painter and create your User command. here i have created MENU->EXIT

like this: 

[https://2.bp.blogspot.com/-
QkH7O3ZhdgY/V0Qz0TCYXMI/AAAAAAAAL3k/j8aq7YebebILOBd4xBwpl2gsbaBHljm0gCLcB/s1600/gui.jpg]

For this Exit In input section of screen number 100 write code . when 'EXIT' leave program.
as per above given program.

Step 15. For every module pool , we need to create transaction code . so create one tcode for this .
right click on main program and create transaction code (or GOTO SE93 and create).
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 68/90
4/13/23, 12:38 PM SAPTech: 2016
 attributes will be like this .

SAPTech
Classic Home

[https://1.bp.blogspot.com/-7SPwVr9sagY/V0Q0aUkpbII/AAAAAAAAL3s/wu4K48EZoFQvJO2zTTJlSb_ofpQ7DoMVQCLcB/s1600/tde
sc.jpg]

[https://4.bp.blogspot.com/-
TNnIDaxDa1M/V0Q0eBGnI7I/AAAAAAAAL3w/q6VzTPlnFXwozonv0cb3X6llDveXI6QngCLcB/s1600/tfinal.jpg]

 Step 16 . Save it and activate whole program. Excute this Tcode .


               Screen will come like this :

[https://3.bp.blogspot.com/-Gm-
5oLTh86c/V0Q1B76tkqI/AAAAAAAAL34/TfJbwj16df4522IjaImd3M83tSpKMkS1gCLcB/s1600/out.jpg]

Step 17. Click on Display Button one dialog box will come like this .

  

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 69/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://1.bp.blogspot.com/-4BQg-
mO8H7s/V0Q1PUfx_dI/AAAAAAAAL4A/7j41FW1FQHcC7jbFAQo72bWJ-CergphTACLcB/s1600/out1.jpg]

Step 18 . you click on Exit it will transfer you on screen 100.

Thank you :)
For more query please contact me :)

Posted 24th May 2016 by Blogger

0 Add a comment

How to Create Table and how to maintain data through table


19th May 2016
maintenance generator ?
 Table: A table [https://en.wikipedia.org/wiki/Table_(information)]  is a collection of related data held in a structured
format within a database [https://en.wikipedia.org/wiki/Database] . It consists of fields
[https://en.wikipedia.org/wiki/Field_(computer_science)]  (columns [https://en.wikipedia.org/wiki/Column_(database)] ), and rows
[https://en.wikipedia.org/wiki/Row_(database)] .

Steps : 
Step 1. Goto Tcode SE11 and give your database table name . 
Step 2. After clicking on create button , give proper description.
Step 3. In delivery class You can select any one , first g in delivery class press F4,
   you will get whole delivery class suggestion 
  

[https://2.bp.blogspot.com/-
mAVPqzt2evo/VzyPlVc79QI/AAAAAAAALzU/fzrQRZVHGuwu-HuKw1YgGIpVNn2FF7vRgCLcB/s1600/delivery%2Bclass.jpg]

Delivery class : It describes the owner of the class.i.e the one who maintains the data in
the table in a elaborate manner.
So according to your requirement you can select any delivery class.
Here i am taking class A. In data browser you can select any one .

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 70/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-
NHfw71spEeU/VzyS5wIOL5I/AAAAAAAALzs/g1y5MC8CvEEaxvTvzyLd8D3_2zUbeAsfQCLcB/s1600/data.jpg]

Here i am taking maintenance allowed. So that we can maintain data using SM30.


Step 4. Go under fields , give fields name like this . I want to make an employee record .
so i am taking 3 fields , 
i>mandt
ii>  employee id
iii> employee name
iv> department 
here first field is mandt becuase, Mandt is the client field and is part of the key for all user defined 
tables. It ensures client independence as you transport your table through 
to your production environment.
So based on your requirement you can give mandt or not .

Step 5. now give second field name ZEMPID and in data element give name zmpid and double
click on that for creation of data element .Here i have checked key field means this
field is primary key for this table.

DATA ELEMENT  : A data element is an elementary type. It describes the type attributes (data type, field length and possibly
the number of decimal places) and screen information (explanatory text or field help) about unstructured data objects (table
fields and structure fields or variables).

After this one pop up will come press ok than give Domain name 

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 71/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-1trhRMIexGA/Vz1LgTbBbQI/AAAAAAAALz8/T6U4i2NHWqMwS1_FkDh1UNN5EKO6Hg09wCLcB/s1600/
DE.jpg]

DOMAIN :  A domain describes the technical attributes of a field, such as the data type or the number of positions in a field.
The domain defines primarily a value range describing the valid data values for the fields referring to this domain.

Step 5. Double click on domain name , and press ok , give data type and , number of character and save.

[https://3.bp.blogspot.com/--

FGkGHbHBys/Vz1L9DlAS3I/AAAAAAAAL0A/RWt03enxCocuqkJKt6tRQ-YpXfJdC7L9gCLcB/s1600/domain.jpg]
Step 6. Now like this create all fields as per your requirement. Final structure will look
like this .

[https://4.bp.blogspot.com/-dxyA5kBa5JI/Vz1NK4lWQmI/AAAAAAAAL0Q/NjoU6CtaDKU1HKRpVUeVvZhje1L-v1MRQCLcB/s1600/tab.jpg]
Step 7. Now click on technical setting
give data class and size category like this .

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 72/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-
SKmaDmba3bo/Vz1N9cNzqCI/AAAAAAAAL0c/qZxvfIqCMEASHyvDj2xABwm6QoFSoIPQQCLcB/s1600/tech.jpg]
Step 8 . Save and activate .
Step 9. For table maintenance generator goto  Utilities-> table maintenance generator 

[https://1.bp.blogspot.com/-
Uqbg3f2LxLg/Vz1PnbxxDPI/AAAAAAAAL0o/hmcy7ZvjaIkEk-pnXIsZiK_QSmCOqwjIwCLcB/s1600/tmg.jpg]

Step 10. After clicking on this one screen will come like this.

[https://1.bp.blogspot.com/-
Ua5aHnNvXaU/Vz1QVE6xjxI/AAAAAAAAL0w/u5bknRFLWvwjeGPHgV0Xkd72mdS8R6LIgCLcB/s1600/tmgs.jpg]
Step 11. Give default authorization Group as a &NC&(or you can change as per your requirement ) in Function Group give
Function group .(not required you can give your table name ). For Function group creation GOTO SE80 ->give FG name ->
save and activate 
You can use this FG here.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 73/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-3OApDX_rhks/Vz1Q1K0ixJI/AAAAAAAAL00/o7MhyusDAhUrR7LUQmAYyFQSNlvVpQnhgCLcB/s1600/tmg1.jpg]

Step 12. Now click on create button or press F6 , save and activate. One message will come like process completed without
errors .

Step 13. Now GOTO Tcode SM30 give your table name for creation of entries .Click on maintain .

[https://3.bp.blogspot.com/-
yoH8Yg51lhc/Vz1SvwyLWyI/AAAAAAAAL1E/dgYk5vzR7FgMkv0TOefC6OfLPOrY9DCpACLcB/s1600/sm30.jpg]
Step 14. Now click on new entry .

[https://1.bp.blogspot.com/-8IyoNJ1jbD0/Vz1TCTQDF8I/AAAAAAAAL1I/WHzIJUytRAgKlcFGUcoGZhESb7wNxBiSwCLcB/s1600/sm301.jpg]

Step 15. Give your data and click on save . Now you can see your data using Tcode SE16 or directly you can go in your table
and click on Contents , Execute . Your data will be there.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 74/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://2.bp.blogspot.com/-
PObReMnsQNk/Vz1T3SAfVHI/AAAAAAAAL1U/IEPa1LVh0-YEWYALA7cSwzok5wjqW7iTgCLcB/s1600/final.jpg]

Thanks :) 

Posted 19th May 2016 by Blogger

0 Add a comment

17th May 2016


     How to create Page break in smart form? 
: In some cases user wants specific number of records per
Page break
page . we can restrict it manually using user COMMAND. 

Steps:
 Step 1.  GOTO  Tcode SMARTFORMS and give your Smart form name .  

[https://4.bp.blogspot.com/-

jZb4W_PnIHQ/VzqkkiDFsHI/AAAAAAAALxA/1Kf6TWhVwmMHxv3Qm4o0l-xFgCj8ZR7GgCLcB/s1600/create.jpg]

Step 2. Give proper description and save it in Local object or any package .

[https://2.bp.blogspot.com/-

otYMaF40Dzs/VzqohWA8yiI/AAAAAAAALxM/fAizdhJtTNUbwabtXUjsVENbQLXGlvXUACLcB/s1600/des.jpg]

Step 3.  Go to Form Interface -> table give internal table name. in my previous blog ,i have explain 
how to create structure and Table Type. for your reference click on this .-> Structure and Table type 
[http://mysapnuts.blogspot.com/2016/05/to-create-structure-and-table-type.html]
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 75/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTechI am using same structure and Table type .


Classic Home

[https://3.bp.blogspot.com/-3FuP29yNwJg/VzqpaWckPpI/AAAAAAAALxY/0BOvfF8xQ-
Esv1aLeDUyBHUZdNS2b3U0gCLcB/s1600/t_mara.jpg]

Step 4. Under Global Definition  declare your variable and for command we are taking two extra variable . Like this ->

[https://4.bp.blogspot.com/-Vz4hOL4QbBs/Vzrb9e-
0e4I/AAAAAAAALxo/YcQnnPkWb8gvAxnCPdxzOXoMes9mPL_fgCLcB/s1600/global.jpg]

Step 5. Go on your window right click there and create table .

[https://2.bp.blogspot.com/-
QqrftLxlUtA/VzremebEDWI/AAAAAAAALx0/uciPlpLbHc0dzFekEAJSPM4dRjh-6Ab0QCLcB/s1600/tb.jpg]

Step 6. After creating table ,create line type . I have already discuss in my previous Blog . For more you can go ->  Basic
smart forms [http://mysapnuts.blogspot.in/2016/05/how-to-call-smart-form-using-driver.html]

Step 7. Create 4 column in your line type . In header every column create Text 
text1 ->  SL NO
text2-> material number
text3->Created on
text4-> Name of person

Step 7. Create 4 text in main Area also and give all field name.
      text5-> &gv_no&
      text6-> &matnr&
      text7->  &ersad&
      text8-> &ernam&
Step 8.  Right click on Main Window and copy and paste , to create new page ,page2
Step 9 . Right click on main area create->flow logic->loop
Step 10. Again right click on Loop-> create->flow logic ->command
Step 11.  On command go to General Attributes and give page name as page 2

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 76/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech [https://4.bp.blogspot.com/-D3FO8NniJD4/VzsH-

Classic Home

rNnp3I/AAAAAAAALyE/cLFYSOW48MMfX32j3CbfAaJ6Iu9PSaUnACLcB/s1600/page.jpg]

Step 12.  On condition Window give condition like GV_FLAG = 'X'.

[https://4.bp.blogspot.com/-

IQsG2jrPjfA/VzsIrnpjacI/AAAAAAAALyI/f6-O710EHE0GWjvVB3ivxQneYxA0bkZ_gCLcB/s1600/FLAG.jpg]
Step 13. Go on cell 5 in main area, right click and create command and right there code for page break.

[https://3.bp.blogspot.com/-e-

D23oTYF0U/VzsJVhDR86I/AAAAAAAALyU/Y95MVaLpo9gcIxiMOrTMptiGw2il0uG4wCLcB/s1600/code.jpg]

gv_no = gv_no + 1.
DATA: lv_no type i.
lv_no = gv_no mod 10.
IF lv_no = 0.
   gv_flaG = 'X'.
ELSE.
  gv_flaG = ''.
ENDIF.

Step 14. Save & activate , get function module name , environment-> function module name.

Step 15. Now Create Driver program Zdemo_pagebreak using tcode se38

*&---------------------------------------------------------------------*
*& Report  ZDEMO_PAGEBREAK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZDEMO_PAGEBREAK.
TABLES MARA.
DATA: T_MARA TYPE ZTDEMO_STRUCT_MARA.
DATA: LV_FNAME TYPE TDSFNAME VALUE 'ZDEMO_PAGEBREAK',
      LV_FMNAME TYPE RS38L_FNAM .

SELECT
  MATNR
ERSDA
ERNAM
   FROM MARA INTO TABLE T_MARA UP TO 40 ROWS.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME                 = LV_FNAME
*     VARIANT                  = ' '
*     DIRECT_CALL              = ' '
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 77/90
4/13/23, 12:38 PM SAPTech: 2016
   IMPORTING

SAPTech     FM_NAME                  = LV_FMNAME
*   EXCEPTIONS
*     NO_FORM                  = 1
Classic Home
*     NO_FUNCTION_MODULE       = 2
*     OTHERS                   = 3
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

 CALL FUNCTION LV_FMNAME
*  EXPORTING
*    ARCHIVE_INDEX              =
*    ARCHIVE_INDEX_TAB          =
*    ARCHIVE_PARAMETERS         =
*    CONTROL_PARAMETERS         =
*    MAIL_APPL_OBJ              =
*    MAIL_RECIPIENT             =
*    MAIL_SENDER                =
*    OUTPUT_OPTIONS             =
*    USER_SETTINGS              = 'X'
*  IMPORTING
*    DOCUMENT_OUTPUT_INFO       =
*    JOB_OUTPUT_INFO            =
*    JOB_OUTPUT_OPTIONS         =
   TABLES
     T_MARA                     = T_MARA
*  EXCEPTIONS
*    FORMATTING_ERROR           = 1
*    INTERNAL_ERROR             = 2
*    SEND_ERROR                 = 3
*    USER_CANCELED              = 4
*    OTHERS                     = 5
           .
 IF SY-SUBRC <> 0.
* Implement suitable error handling here
 ENDIF.

Step 16. For calling your function module go to pattern -> click on call function and give your function module name.
Step 17 . Save and activate and execute it.

Here i have added page number  also so for this we need to create extra window in page 1.
right click on page 1 and create new window .  For window size give length and width like this .

[https://4.bp.blogspot.com/-
HYuWcmhFfNk/Vzsqem6pvqI/AAAAAAAALys/UDD5JYryrx8aOCS1ltUKohYLx93FkSpjACLcB/s1600/wis.jpg]

Step 18. In that window create text and in text put value
pages &sfsy-page& of &sfsy-formpages& 

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 78/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://4.bp.blogspot.com/-
BCCGMHQVRzU/Vzspxd7HPGI/AAAAAAAALyk/s2IcVplNXcE6OTxqWYRnQtb27PsK1wJNACLcB/s1600/pagen.jpg]

Save and activate it .


Execute your driver program 
Output should be like this :
page 1:

[https://1.bp.blogspot.com/-

dHI4X9vL2yg/VzsrQc3ZdXI/AAAAAAAALy4/9ebHQAxGuwY5rp1cC5Xp9YDT1bzAnnYUACLcB/s1600/page1.jpg]
Page 2.

[https://3.bp.blogspot.com/-55GsF6yTPpQ/VzsrZicRUKI/AAAAAAAALy8/LDcTda4wHQEQv3nH2r1Mlq08izd-
RTq6wCLcB/s1600/page2.jpg]
In bottom of every pages page number will come ... like this.

[https://3.bp.blogspot.com/-NzUeEGQdSe0/VzsrlG-

EXSI/AAAAAAAALzA/IFMGqXe2iTkGC7PaIAMCelVx0c0nDIIlACLcB/s1600/page3.jpg]

Thank you
Please share your opinion :) 
Posted 17th May 2016 by Blogger

2Dynamic
View comments
Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 79/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

16th May 2016


       How to create Structure and Table Type?
 Structure : A structure is just a list of fields defined under a name.  Structures are useful for painting screen fields,
and for manipulating data that has a consistent format defined by a discrete number of fields.

STEPS:

Step 1. GOTO Tcode SE11 ,click on data type and Give your structure name click on create.

[https://3.bp.blogspot.com/-

w5vHi3hhOMs/VznMNqH4BrI/AAAAAAAALv8/AEKQpIKvnkwYdfYI3zo_kyCPWq2xkgN6QCLcB/s1600/create.jpg]

Step 2. After Creating One pop up will come , there select structure .

[https://1.bp.blogspot.com/-76TGT6bKFx8/VznM6HngQ1I/AAAAAAAALwI/In13DDt52e42Fe0AySf2Yhg1Q_UbdEc0QCLcB/s1600/crea
te.jpg]

Step 3. Give a proper description. Under components give all required fields .

[https://2.bp.blogspot.com/-

EaKYLRBgXSo/VznNmWTOFFI/AAAAAAAALwY/Q4DMB4prrJUeARxTTLqwBLZ1IomJGB29gCLcB/s1600/field.jpg]

  Step 4. Save and Activate . After that go BACK. and give Table type name and click on create .

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 80/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech [https://1.bp.blogspot.com/-rv-

Classic Home

znMu4NQo/VznOKtcu4DI/AAAAAAAALwc/a_C0dnX1FdElXoTZPYGiyz0V3Qh2ZoBWACLcB/s1600/tablecr.jpg]

Step 5. After clicking on create one pop up will come ,there select Table Type.

[https://3.bp.blogspot.com/-_-
iNy6n3Y78/VznOjSua1CI/AAAAAAAALwk/eaRR9woFX7grTcZqtbBAujXA8sRbO0HCACLcB/s1600/tablesel.jpg]

Step 6 . Give proper description ,under Line type give your Structure name . After that Save and activate .

[https://1.bp.blogspot.com/-

fw3cQlP9CRY/VznPJwPCMiI/AAAAAAAALws/Yp7I46tM7lEksvySJVG3kLDnIvFW6dkkQCLcB/s1600/create.jpg]

You can use it in Smart forms and whenever required .

now no need to declare internal table as like this .->


data : t_mara TYPE STANDARD TABLE OF ZDEMO_STRUCT_MARA.

declare like this .

data :  t_mara TYPE  ZTDEMO_STRUCT_MARA,
           w_mara TYPE  ZDEMO_STRUCT_MARA.

Thank you :) 

Posted 16th May 2016 by Blogger

0 Add a comment

13th May 2016


How to call Smart Form using Driver Program ?

Steps :
1.  First Create Smart form as per Your Requirement. Here is some snap shot which help you
                GOTO Tcode SMARTFORMS. 
                give name  and click on create.
       

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 81/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech [https://2.bp.blogspot.com/-qdI3ZJXPD2k/VzWBF-

Classic Home

0S1iI/AAAAAAAALtU/wGyoZd8Ea6gFCPQroC1Gaq9Td8F3ODjUQCLcB/s1600/create.jpg]
  2. Give Description and save : 

[https://4.bp.blogspot.com/-

h1VZmQ6ckM0/VzWBsBeILcI/AAAAAAAALtc/5csKXagfGWYm8ZB7I49gRyFbHEnnVUVdgCLcB/s1600/discri.jpg]

 3.  GO in Form interface and under import Give Parameters name .

[https://2.bp.blogspot.com/-3NW6ULhgMkE/VzWEeZAl5MI/AAAAAAAALto/R0eELwPa3rwENK4moPt6qrEMh0P3JbidgCLcB/s1600/pa
ra.jpg]

4. Now go under table declare your final table .

[https://1.bp.blogspot.com/-lbdbAdunxZE/VzWWq8cX-uI/AAAAAAAALt4/WEXo5mWZDZcFwsfWmMDFt2ycZ-
sLFHa8wCLcB/s1600/table.jpg]

5. Now go under Global Definition and declare your work area and global data.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 82/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://3.bp.blogspot.com/-jQiVAEvQjr4/VzWXVczmTBI/AAAAAAAALuA/JtFR5GrJ_bElkXWIfZoZm7QvqFYT-
_WJgCLcB/s1600/worka.jpg]

6. Now go on window , right click create -> table

[https://3.bp.blogspot.com/-3v9xNDlbJAU/VzWYZhYjeHI/AAAAAAAALuM/KMjQqoTqEXUgIkrq3fSlDuuAGFhmeb_fgCLcB/s1600/creat
etab.jpg]

7. Create Line type :

[https://1.bp.blogspot.com/-

fcNfMGu_9Ko/VzWZZEbpEGI/AAAAAAAALuY/OyaaE1knHfsJqgtYjMHfKqeVbOTuZBlSgCLcB/s1600/linet.jpg]

8. Right click on Header and main area and create Table line

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 83/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTech
Classic Home

[https://2.bp.blogspot.com/-
H4baOo3bjZw/VzWZ5seOpCI/AAAAAAAALuc/TmjIAbe9VMkkDLxRzPWmBi9YSwOS_xGFQCLcB/s1600/tableli.jpg]

9.Right click on every cell and create Text and put name as required in Header area.

[https://1.bp.blogspot.com/-8GfRuIs4OFU/VzWbTfOO2BI/AAAAAAAALus/jyGSJ9ZJ6yYGr9vGOqT1RDR-
toNurJfWQCLcB/s1600/text.jpg]
9. Go to Main area and create Text and put your work area value , like this :

[https://2.bp.blogspot.com/-
QYJX5hB3Re0/VzWcTCjGu5I/AAAAAAAALu4/eCbkf33f1YMXk3lS0KuD0jvQtw07oMS0gCLcB/s1600/text1.jpg]

After This for Loop , go in your TABLE -> DATA and give your internal table and work area.

[https://1.bp.blogspot.com/-jR88YZiZNMU/VzWiN-
7Y1iI/AAAAAAAALvc/4i8WlF28nkcBSiJwW07cgzjDPMhOO5IhQCLcB/s1600/loop.jpg]

10. Add all fields , save and activate . Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 84/90
4/13/23, 12:38 PM SAPTech: 2016
11. Create a driver program using Tcode SE38 , and write your code there.
SAPTechREPORT  ZDEMO_SMART_LINE.
data: lv_form TYPE TDSFNAME VALUE 'ZDEMO_SMART_LINE',
      LV_FMNAME TYPE RS38L_FNAM.
Classic Home
data: t_final TYPE  ztmara,
      w_final type zmara.
PARAMETERS: p_matnr TYPE mara-matnr.
TYPES: BEGIN OF TYPE_MARA,
        MATNR TYPE MARA-MATNR,
        ERSDA TYPE MARA-ERSDA,
        ERNAM TYPE MARA-ERNAM,
      END OF TYPE_MARA,
      BEGIN OF TYPE_MAKT,
              MATNR TYPE MAKT-MATNR,
              SPRAS TYPE MAKT-SPRAS,
              MAKTX TYPE MAKT-MAKTX,
      END OF TYPE_MAKT,
      BEGIN OF TYPE_MARD,
              MATNR TYPE MARD-MATNR,
              WERKS TYPE MARD-WERKS,
              LGORT TYPE MARD-LGORT,
      END OF TYPE_MARD.

DATA: t_mara TYPE TABLE OF type_mara,
      t_makt TYPE TABLE OF TYPE_MAkt,
      t_mard TYPE TABLE OF type_mard,
      w_mara TYPE type_mara,
      w_makt TYPE type_makt,
      w_mard TYPE type_mard.
SELECT
MATNR
ERSDA
ERNAM
  from mara
  into table t_mara
  WHERE matnr = p_matnr.
  IF sy-subrc eq 0.
       sort t_mara by matnr.
  ENDIF.
  IF t_mara is NOT INITIAL.
    SELECT
      MATNR
      SPRAS
      MAKTX
       from makt
       INTO TABLE t_makt
       FOR ALL ENTRIES IN t_mara
       where matnr = t_mara-matnr.
       IF sy-subrc eq 0.
          sort t_makt by matnr.
       ENDIF.
       SELECT
         MATNR
         WERKS
         LGORT
         from mard
         INTO TABLE t_mard
         FOR ALL ENTRIES IN t_mara
         where matnr = t_mara-matnr.
         IF sy-subrc eq 0.
            sort t_mard by matnr.
         ENDIF.

  ENDIF.
LOOP AT t_mara INTO w_mara.
  w_final-MATNR = w_mara-MATNR.
  w_final-ERSDA = w_mara-ERSDA.
  w_final-ERNAM = w_mara-ERNAM.

  clear w_makt.
  READ TABLE t_makt INTO w_makt with key matnr = w_mara-matnr BINARY SEARCH.
  IF sy-subrc eq 0.
      w_final-SPRAS = w_makt-SPRAS.
      w_final-MAKTX = w_makt-MAKTX.
  ENDIF.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 85/90
4/13/23, 12:38 PM SAPTech: 2016
  CLEAR w_mard.

SAPTech    READ TABLE  t_mard INTO w_mard WITH KEY matnr = w_mara-matnr BINARY SEARCH.
IF sy-subrc eq 0.
      w_final-WERKS = w_mard-WERKS.
Classic Home
      w_final-LGORT = w_mard-LGORT.
  ENDIF.
  APPEND w_final to t_final.
  CLEAR w_final.
ENDLOOP.

12. For my Program i have created table structure for final table using Tcode SE11.

[https://1.bp.blogspot.com/-
u6tx5bEe280/VzWdNkK1sUI/AAAAAAAALvE/BQW0YEQt7l4wkyk57XFzjMtgpXF8imQOwCLcB/s1600/zmara.jpg]

13. For Table type create ZTMARA using same transaction, use it for internal table in Smart form .
14. Call function  SSF_FUNCTION_MODULE_NAME  For catching The Function Module .
15. Again Call that function which you get from Samrt form . For this Go to your smart form 
      Environment -> Function Module .
16. Complete Your code.
     CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname                 = lv_form
*     VARIANT                  = ' '
*     DIRECT_CALL              = ' '
   IMPORTING
     FM_NAME                  = LV_FMNAME
*   EXCEPTIONS
*     NO_FORM                  = 1
*     NO_FUNCTION_MODULE       = 2
*     OTHERS                   = 3
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
  CALL FUNCTION LV_FMNAME"'/1BCDWB/SF00000799'
    EXPORTING
*     ARCHIVE_INDEX              =
*     ARCHIVE_INDEX_TAB          =
*     ARCHIVE_PARAMETERS         =
*     CONTROL_PARAMETERS         =
*     MAIL_APPL_OBJ              =
*     MAIL_RECIPIENT             =
*     MAIL_SENDER                =
*     OUTPUT_OPTIONS             =
*     USER_SETTINGS              = 'X'
      P_MATNR                    = p_matnr
*   IMPORTING
*     DOCUMENT_OUTPUT_INFO       =
*     JOB_OUTPUT_INFO            =
*     JOB_OUTPUT_OPTIONS         =
    TABLES
      T_FINAL                    = t_final
   EXCEPTIONS
     FORMATTING_ERROR           = 1
     INTERNAL_ERROR             = 2
     SEND_ERROR                 = 3
     USER_CANCELED              = 4
     OTHERS                     = 5
            .
  IF SY-SUBRC <> 0.

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 86/90
4/13/23, 12:38 PM SAPTech: 2016
* Implement suitable error handling here

SAPTech  ENDIF.
Classic Home
17. Save and activate and Run your program not Form it will redirect to form and output will come.

[https://4.bp.blogspot.com/-i-Gt-
G7puBY/VzWfTi03AAI/AAAAAAAALvQ/kfR7_tiZXIs9LGZ00dYcPJ31OF4lT5oOwCLcB/s1600/output.jpg]

Thank YOU :) 

Posted 13th May 2016 by Blogger

0 Add a comment

12th May 2016

How to remove Inner Join ?


Inner Join :
The data that can be selected with a view depends primarily on whether the view implements an          inner join or
anouter join. With an inner join, you only get the records of the cross-product for            which there is an entry in all
tables used in the view.

Structure of final table .

TYPES: BEGIN OF T_LIST,
          MARK,
          BLDAT  TYPE RBKP-BLDAT,   "Document type
          BUDAT  TYPE RBKP-BUDAT,   "Posting date
          BELNR  TYPE RBKP-BELNR,   "Document number
          XBLNR  TYPE RBKP-XBLNR,   "Invoice number
          LIFNR  TYPE RBKP-LIFNR,   "Vendor number
          SGTXT  TYPE RBKP-SGTXT,   "Header text LIV
          EBELN  TYPE EKKO-EBELN,   "Purchasing document
          EBELP  TYPE EKPO-EBELP,   "Purchasing item
*          LGOBE  TYPE T001L-LGOBE,  "Storage location
          MATNR  TYPE EKPO-MATNR,   "Material number
          TXZ01  TYPE EKPO-TXZ01,   "Material description
          MEINS  TYPE EKPO-MEINS,   "Oun
          NETPR  TYPE EKPO-NETPR,   "Unit price
          NETWR  TYPE EKPO-NETWR,   "Amount
          MENGE  TYPE EKBE-MENGE,   "Qty received
          DMBTR  TYPE EKBE-DMBTR,   "Amount in local
          WRBTR  TYPE EKBE-WRBTR,   "Amount in document
Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 87/90
4/13/23, 12:38 PM SAPTech: 2016
          SHKZG  TYPE EKBE-SHKZG,   "D/C indicate
SAPTech          WAERS  TYPE EKBE-WAERS,   "Currency
          MWSKZ  TYPE EKBE-MWSKZ,   "Tax code
Classic           TAXAM  TYPE EKBE-DMBTR,   "Tax amount
Home
       END OF T_LIST.
DATA: IT_LIST TYPE TABLE OF T_LIST WITH HEADER LINE.

SELECT R~BLDAT R~BELNR R~XBLNR R~LIFNR R~SGTXT


P~TXZ01 P~MEINS P~NETPR
E~EBELN E~MATNR E~MENGE E~EBELP E~DMBTR E~WRBTR E~WAERS E~SHKZG E~MWSKZ
INTO CORRESPONDING FIELDS OF TABLE IT_LIST
FROM RBKP AS R INNER JOIN EKBE AS E ON ( R~BELNR = E~BELNR
AND R~GJAHR = E~GJAHR
AND E~WERKS = S_BUKRS-LOW )
INNER JOIN EKPO AS P ON ( P~EBELN = E~EBELN
AND P~EBELP = E~EBELP
AND P~WERKS = S_BUKRS-LOW )
WHERE R~BELNR IN S_BELNR
*      AND r~gjahr IN s_gjahr
AND R~BUDAT IN S_BUDAT
AND R~BUKRS EQ S_BUKRS-LOW
AND R~LIFNR IN S_LIFNR
AND E~MATNR IN S_MATNR
AND E~EBELN IN S_EBELN.

Steps :

1. First Declare structure for all table which one we used .

TYPES:    BEGIN OF type_rbkp ,
belnr  TYPE rbkp-belnr,   "Document number
         gjahr TYPE gjahr,
         bldat  TYPE rbkp-bldat,   "Document type
         xblnr  TYPE rbkp-xblnr,   "Invoice number
         bukrs TYPE rbkp-bukrs,
         lifnr  TYPE rbkp-lifnr,   "Vendor number
         sgtxt  TYPE rbkp-sgtxt,   "Header text LIV
         END OF type_rbkp,

         BEGIN OF type_ekbe ,
         ebeln TYPE  ebeln,
         ebelp  TYPE ebelp,
         ZEKKN TYPE DZEKKN,
         VGABE TYPE VGABE,
         gjahr  TYPE mjahr,
         belnr TYPE mblnr,
         BUZEI TYPE MBLPO,
         menge TYPE  menge_d,
         dmbtr  TYPE dmbtr,
         wrbtr TYPE  wrbtr,
         waers  TYPE waers,
         shkzg TYPE  shkzg,
         mwskz  TYPE ekbe-mwskz,   "Tax code
         matnr TYPE matnr,
         werks TYPE WERKS_D,
         END OF type_ekbe,
       BEGIN OF type_ekpo,
         ebeln  TYPE ebeln,
         ebelp  TYPE ebelp,
                 txz01  TYPE txz01,
                 meins TYPE  bstme,
                netpr  TYPE bprei,
                END OF type_ekpo.
2. Make internal table and work area for all structure .
DATA: t_rbkp TYPE STANDARD TABLE OF type_rbkp,
              w_rbkp TYPE type_rbkp,
              t_ekbe TYPE STANDARD TABLE OF type_ekbe,
              w_ekbe TYPE type_ekbe,
              t_ekpo TYPE STANDARD TABLE OF type_ekpo,
              w_ekpo TYPE type_ekpo.
3. Select all fields using select query and merge them using For all Entries.

SELECT
    belnr
    gjahr Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 88/90
4/13/23, 12:38 PM SAPTech: 2016

    bldat
SAPTech    xblnr
    bukrs
Classic Home
    lifnr
    sgtxt
  FROM rbkp
  INTO TABLE  t_rbkp
  WHERE belnr IN s_belnr
  AND budat IN s_budat
  AND bukrs EQ s_bukrs-low
  AND lifnr IN s_lifnr.

  IF t_rbkp[] IS NOT INITIAL.
 

    SELECT
      ebeln
      ebelp
      ZEKKN
      VGABE
      gjahr
      belnr
      BUZEI
      menge
      dmbtr
      wrbtr
      waers
      shkzg
      mwskz
      matnr
      werks
    FROM ekbe
    INTO TABLE t_ekbe
    FOR ALL ENTRIES IN t_rbkp
    WHERE
     ebeln IN s_ebeln AND
     gjahr = t_rbkp-gjahr
     AND belnr = t_rbkp-belnr
     AND matnr IN s_matnr
      and werks = t_rbkp-bukrs.
    IF t_ekbe[] IS NOT INITIAL.
      SORT t_ekbe BY  gjahr belnr.
      SELECT
        ebeln
        ebelp
        txz01
        meins
        netpr
      FROM ekpo
      INTO TABLE t_ekpo
      FOR ALL ENTRIES IN t_ekbe
      WHERE ebeln = t_ekbe-ebeln
        AND ebelp =  t_ekbe-ebelp
        AND werks in s_bukrs.
    ENDIF.
    IF t_ekpo[]  IS NOT INITIAL.
      SORT t_ekpo BY ebeln ebelp.
    ENDIF.
  ENDIF.

4. After That Loop on Header or Item Table, based on requirement.


Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 89/90
4/13/23, 12:38 PM SAPTech: 2016

SAPTechLOOP AT t_ekbe INTO w_ekbe.
    w_list-ebeln = w_ekbe-ebeln.
Classic     w_list-ebelp = w_ekbe-ebelp.
Home

    w_list-menge = w_ekbe-menge.

    w_list-dmbtr = w_ekbe-dmbtr.
    w_list-wrbtr = w_ekbe-wrbtr.
    w_list-waers = w_ekbe-waers.
    w_list-shkzg = w_ekbe-shkzg.
    w_list-mwskz = w_ekbe-mwskz.
    w_list-matnr = w_ekbe-matnr.
    READ TABLE t_rbkp INTO w_rbkp WITH KEY
       gjahr = w_ekbe-gjahr
       belnr = w_ekbe-belnr BINARY SEARCH.
    IF sy-subrc EQ 0.
      w_list-bldat = w_rbkp-bldat.
      w_list-belnr = w_rbkp-belnr .
      w_list-xblnr = w_rbkp-xblnr .
      w_list-lifnr = w_rbkp-lifnr .
      w_list-sgtxt = w_rbkp-sgtxt .
    ENDIF.
    READ TABLE t_ekpo INTO w_ekpo WITH KEY ebeln = w_ekbe-ebeln
                                   ebelp = w_ekbe-ebelp   BINARY SEARCH.

    IF sy-subrc = 0.
      w_list-txz01 = w_ekpo-txz01.
      w_list-meins = w_ekpo-meins.
      w_list-netpr = w_ekpo-netpr.

      APPEND w_list TO t_list.
    ENDIF.
  ENDLOOP.

Output :

[https://4.bp.blogspot.com/-U3zwQG91d1U/VzRhhZEMxLI/AAAAAAAALtE/tIxGTkNaikAVE-
NfakkVxkA0FGPqAWZegCLcB/s1600/join.jpg]

Posted 12th May 2016 by Blogger

2 View comments

Dynamic Views theme. Powered by Blogger.

https://mysapnuts.blogspot.com/2016/ 90/90

You might also like