Friday, July 24, 2020

TOC Creation Step by Step in SAP

TOC Creation Step by Step in SAP ABAP.


Step 1 :

First Goto T-Code  SE09 – Create Request   – Select Transport of Copies



 


 


 

Step 2 : Put your Description  for TOC ,give the target system as RB2.100 / PS2.100 – after that click on Save button.


Step 3 : Right click on TOC created above , and click on “Include Objects”


Step 4 : Enter the “Task Number( remember it’s the task number that you need and not the main request ) from which you want to create TOC so that objects from this task are included in TOC



Step 5 :Right click on TOC and say “Release Directly “




Step 6 : Click Continue if any pop up appears and on the next screen click “Refresh” till release is complete . Once Release is complete then only the TOC would appear in RB2 queue ( in STMS)

 


Step 8 :Double click on “ RB2” for selecting  RB2 queue

 


Step 9 : Click on “Refresh” . Once Refresh is done , our TOC would appear in RB2 Queue




 

Step 10 :Click on TOC Request and then click on button “Adjust Import Queue” from Menu bar



Step 12 :Click on the TOC and click on “ Import Directly” button from menu bar


Step 14 :Click on Refresh till “truck” icon before TOC disappears and a “Tick” mark appears indicating transport successful


Thursday, July 23, 2020

MB_MIGO_BADI BADI USED TO POSTING DATA VALIDATION FOR MIGO

MB_MIGO_BADI BADI



method IF_EX_MB_MIGO_BADI~POST_DOCUMENT.

  BREAK-POINT.

  IF is_mkpf-budat < is_mkpf-BLDAT.

    sy-ucomm 'ENT1'.

    MESSAGE 'Posting Date Should Not Less Than Document Date'  TYPE 'E' .

    SET SCREEN syst-dynnr.

    LEAVE SCREEN.

  ENDIF.

endmethod.

POPUP Confirm Message for SAP ABAP.

SAP ABAP Program for POPUP Confirm Message.


Data : w_answer(01) type c.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = text-006

text_question = text-001

text_button_1 = text-002

text_button_2 = text-003

display_cancel_button = ' '

IMPORTING

answer = w_answer.

Note: text-001 - Are you sure do you want to continue?

text-002 - Yes

text-003 - No

text-006 - Delete ( Information that you would like to give for the titlebar )

Send Mail Excel attachment program in SAP ABAP

Send Mail Excel attachment program in SAP ABAP.




DATA: lt_mailrecipients  TYPE STANDARD TABLE OF somlrec90 WITH HEADER LINE,

      lt_mailtxt         TYPE STANDARD TABLE OF soli      WITH HEADER LINE,

      lt_attachment      TYPE STANDARD TABLE OF solisti1  WITH HEADER LINE,

      lt_mailsubject     TYPE sodocchgi1,

      lt_packing_list    TYPE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,

      gv_cnt             TYPE i.


Add Recipients


lt_mailrecipients-rec_type  = 'U'.

lt_mailrecipients-com_type  = 'INT'.

lt_mailrecipients-RECEIVER  = 'someone@erpdb.info'.

APPEND lt_mailrecipients .

CLEAR lt_mailrecipients .


Put in the Mail Contents


lt_mailtxt = 'Hi How are you'.      APPEND lt_mailtxt. CLEAR lt_mailtxt.

lt_mailtxt = 'Here is a test mail'. APPEND lt_mailtxt. CLEAR lt_mailtxt.

lt_mailtxt = 'Thanks'.              APPEND lt_mailtxt. CLEAR lt_mailtxt.


Create the attachment


  DATA: BEGIN OF lt_po_data_cons OCCURS 0,

         ebeln LIKE ekpo-ebeln,

         ebelp LIKE ekpo-ebelp,

        END OF lt_po_data_cons.


  SELECT ebeln ebelp INTO TABLE lt_po_data_cons

  UP TO 10 ROWS

  FROM ekpo. 


  CLASS cl_abap_char_utilities DEFINITION LOAD.

  CONCATENATE 'PO' 'PO Line'

              INTO lt_attachment SEPARATED BY

              cl_abap_char_utilities=&GT;horizontal_tab.

  APPEND lt_attachment. CLEAR lt_attachment.


  LOOP AT lt_po_data_cons.

  CONCATENATE lt_po_data_cons-ebeln lt_po_data_cons-ebelp

              INTO lt_attachment SEPARATED BY

              cl_abap_char_utilities=&GT;horizontal_tab.


  CONCATENATE cl_abap_char_utilities=&GT;newline lt_attachment

              INTO lt_attachment.


  APPEND lt_attachment. CLEAR lt_attachment.

 ENDLOOP.

Pack the mail contents and attachment

 lt_packing_list-transf_bin  = SPACE.

  lt_packing_list-head_start  = 1.

  lt_packing_list-head_num    = 0.

  lt_packing_list-body_start  = 1.

  lt_packing_list-body_num    = LINES( lt_mailtxt ).

  lt_packing_list-doc_type    = 'RAW'.

  APPEND lt_packing_list. CLEAR lt_packing_list.


  lt_packing_list-transf_bin  = 'X'.

  lt_packing_list-head_start  = 1.

  lt_packing_list-head_num    = 1.

  lt_packing_list-body_start  = 1.

  lt_packing_list-body_num    = LINES( lt_attachment ).

  lt_packing_list-doc_type    = 'XLS'. " You can give RAW incase if you want just a txt file.

  lt_packing_list-obj_name    = 'data.xls'.

  lt_packing_list-obj_descr   = 'data.xls'.

  lt_packing_list-doc_size    = lt_packing_list-body_num * 255.

  APPEND lt_packing_list. CLEAR lt_packing_list.


  lt_mailsubject-obj_name     = 'MAILATTCH'.

  lt_mailsubject-obj_langu    = sy-langu.

  lt_mailsubject-obj_descr    = 'You have got mail'.

  lt_mailsubject-sensitivty   = 'F'.

  gv_cnt = LINES( lt_attachment ).

  lt_mailsubject-doc_size     = ( gv_cnt - 1 ) * 255 + STRLEN(

  lt_attachment ).

Finally, send the mail out.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

      document_data              = lt_mailsubject

    TABLES

      packing_list               = lt_packing_list

      contents_bin               = lt_attachment

      contents_txt               = lt_mailtxt

      receivers                  = lt_mailrecipients

    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 EQ 0.

    COMMIT WORK.

    SUBMIT rsconn01 WITH MODE = 'INT' AND RETURN.

  ENDIF.

Read Long Text In SAP ABAP Programming Langauge

Read Long (READ_TEXT)Text In SAP ABAP Programming Langaug.

READ_TEXT function module call for long text.

**********************************
DATA:lv_output_text TYPE char222.
DATAtname TYPE thead-tdname."TYPE thead-tdname.
*----------------------------------------------------------------------*
* Data Declarations.
* Internal Tables.
  DATA:
    lt_lines TYPE STANDARD TABLE OF tline,
    pc_output_text(222TYPE c.

* Field Symbols.
  FIELD-SYMBOLS:
    <fs_lines> TYPE tline.

*Local Constants:
 CONSTANTS:
   lc_id                TYPE thead-tdid       VALUE '0001',
   lc_object            TYPE thead-tdobject   VALUE 'DOC_ITEM'.


  CONCATENATE gs_item-rbukrs gs_item-belnr gs_item-gjahr gs_item-buzei INTO tname.

                  CALL FUNCTION 'READ_TEXT'
                    EXPORTING
                      client                        sy-mandt
                      id                            lc_id
                      language                      sy-langu
                      name                          tname
                      object                        lc_object
*                     ARCHIVE_HANDLE                = 0
*                     LOCAL_CAT                     = ' '
*                   IMPORTING
*                     HEADER                        =
*                     OLD_LINE_COUNTER              =
                    TABLES
                      lines                         lt_lines
                   EXCEPTIONS
                     id                            1
                     language                      2
                     name                          3
                     not_found                     4
                     object                        5
                     reference_check               6
                     wrong_access_to_archive       7
                     OTHERS                        8
                            .

  IF sy-subrc EQ 0.
*  Fetch the text from the FM table.
    READ TABLE lt_lines
    ASSIGNING <fs_lines>
    INDEX 1.
    IF sy-subrc EQ 0.
      pc_output_text <fs_lines>-tdline.
    ENDIF.
  ENDIF.
ENDIF.

Tuesday, April 21, 2020

Search help in module pool programming in SAP ABAP.


Search help in module pool programming SAP ABAP.

Below Example with programming .

 PROCESS ON VALUE-REQUEST.
  FIELD vbak-ZZPORTLD MODULE f4_ZZORTLD.


MODULE f4_zzortld INPUT.

  
TYPESBEGIN OF ty_value,
       ZCODE   
TYPE  ZCODE,
       ZSDPORT 
TYPE  ZSDPORT1,
         
END OF ty_value.
  
DATA: lt_value TYPE STANDARD TABLE OF ty_value,
        lw_value 
TYPE ty_value.
  
SELECT ZCODE ZSDPORT INTO TABLE lt_value FROM ZSDPORT.
*    WHERE ebeln = rm08m-ebeln.
  
SORT lt_value BY ZCODE ZSDPORT.
  
DELETE ADJACENT DUPLICATES FROM lt_value COMPARING ZCODE ZSDPORT.
  
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    
EXPORTING
      retfield        = 
'ZCODE'
      dynpprog        = sy
-repid
      dynpnr          = sy
-dynnr
      dynprofield     = 
'VBAK-ZZPORTLD'
      value_org       = 
'S'
    
TABLES
      value_tab       = lt_value
    
EXCEPTIONS
      parameter_error = 
1
      no_values_found = 
2
      
OTHERS          3.
  
IF sy-subrc <> 0.
* Implement suitable error handling here
  
ENDIF.
ENDMODULE.


Vi01 validation for Userexit in J1IIN


Vi01 validation.



Userexit is J1IIN 
Create an Include in a billing program
At the time of SAVING the document
Find the reference delivery document number from Billing,
Enter shipment document in VFKP - REBEL and find VFKP-FKNUM
If number not exist, the display error message " SHIPMENT DOCUMENT NOT CREATED
user exit- J_1I7_USEREXIT_EXCISE_BEF_SAVE.

Monday, April 20, 2020

BAPI_PO_CHANGE delivery complete indicator in SAP ABAP.


BAPI_PO_CHANGE delivery complete indicator in SAP ABAP.

Some time we get required to change PO status .This time we can use below program it helps you to change the status of PO. 


Code :::
DATA: xreturn  like BAPIRET2      occurs 0 with header line,
           xpoitem  like BAPIMEPOITEM  occurs 0 with header line,
           xpoitemx like BAPIMEPOITEMX occurs 0 with header line.

xpoitem-po_item = p_ebelp.  " set position here
xpoitem-no_more_gr = 'X'.
append xpoitem.
xpoitemx-po_item = p_ebelp. " set position here
xpoitemx-no_more_gr = 'X'.
append xpoitemx.

CALL FUNCTION 'BAPI_PO_CHANGE'
     EXPORTING
              purchaseorder    = p_ebeln "set ebeln here
     TABLES
              return           = xreturn
              poitem           = xpoitem
              poitemx          = xpoitemx.
if sy-subrc = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING WAIT = 'X'.
endif.

Error Message in SAP .No more memory available to add rows to an internal table.


Error Message in SAP .No more memory available to add rows to an internal table.



Error message coming scenario.
An attempt was made to add rows to an internal table. There was no memory available for this, however.

What you can do?
Note proper actions and entries details caused the error to occur.

Go to SAP administrator.
T-code: ST22 Using transaction for analysis ABAP dump, you can identify, view, manage, and retain termination messages for longer periods. Try to find whether the transaction will run with less main memory. If the problem is due to a temporary bottleneck, run the transaction again. If the error persists, ask your system administrator to check the following profile parameters:
Ø  ztta/roll_area            (1.000.000 - 15.000.000) classic roll area per user and internal session.
Ø  ztta/roll_extension       (10.000.000 - 500.000.000) available memory/user in extended memory EM. 
Ø   ztta/max_memreq_MB maximum size of an individual memory request. (in MB).
Ø  abap/heap_area_total         (100.000.000 - 1.500.000.000).available memory (malloc) for all users of an application server. If several background processes are running on one server, temporary bottlenecks can occur. Of course, the amount of memory (in bytes) must also be available on the machine (main memory or file system swap).

Caution:
The operating system must be set up so that there is also enough memory for each process. Usually, the maximum address space is too small. Ask your hardware manufacturer or your competence centre about this.
§  abap/heap_area_dia: (10.000.000 - 1.000.000.000) restriction of the memory that can be allocated to the heap with malloc per dialog process.Parameter for background processes:
§  abap/heap_area_nondia: (10.000.000 - 1.000.000.000) restriction of the memory that can be allocated to the heap with malloc per background process.Other memory-relevant parameters are:
§  em/initial_size_MB: (35 - 1200) Extended memory area from which all users of an application server can meet their memory needs.

§  abap/shared_objects_size_MB:  Size of the shared memory area that can be used to save shared objects area instances. This memory area is global for all users of the application server.

Error analysis:

No more rows could be added to internal table "???". To make troubleshooting possible, the table had to be deleted before this log could be compiled. This means that the table will either be displayed further down or, if you call the ABAP Debugger from here, with 0 rows.

When the program was terminated, the internal table had the following.
     Characteristics:
     Memory location:   Session memory
     Row width:  4904
     No. of rows: 0
     Allocated rows: 419750
     Newly requested rows: 2 (in 209874 blocks)