Skip to content

Instantly share code, notes, and snippets.

View viniciustavanoferreira's full-sized avatar
🎯
Focusing

Vinicius Tavano Ferreira viniciustavanoferreira

🎯
Focusing
View GitHub Profile
@viniciustavanoferreira
viniciustavanoferreira / Z_RTTI_VTF.abap
Created May 21, 2013 17:42
Run Time Type Identification (example).
*&---------------------------------------------------------------------*
*& Report Z_RTTI_VTF
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_RTTI_VTF.
TYPES in_type TYPE i.
@viniciustavanoferreira
viniciustavanoferreira / SAPMZAVAL003.abap
Last active December 17, 2015 23:39
Aplicação para exibição de dados de uma cotação pré-selecionada e da tabela de itens em função das cotações.
*&---------------------------------------------------------------------*
*& Module Pool SAPMZAVAL003
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Include MZAVAL003TOP Module Pool SAPMZAVAL003
REPORT Z_JSON.
DATA it_aux TYPE TABLE OF c WITH EMPTY KEY.
it_aux = VALUE #( ( 'A' ) ( 'B' ) ( 'A' ) ( 'P' ) ).
DATA(lr_json) =
cl_sxml_string_writer=>create( type =
if_sxml=>co_xt_json ).
public User (String firstName, String lastName, int age, String phone, String address){
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.phone = phone;
this.address = address;
}
public User (String firstName, String lastName, int age, String phone){ ... }
public User (String firstName, String lastName, String phone, String address){ ... }
public User (String firstName, String lastName, int age){ ... }
public User (String firstName, String lastName){ ... }
public class User
{
//All final attributes
private final String firstName; // required
private final String lastName; // required
private final int age; // optional
private final String phone; // optional
private final String address; // optional
private User(UserBuilder builder) {
public static void main(String[] args) {
User user1 = new User.UserBuilder("Lokesh", "Gupta")
.age(30)
.phone("1234567")
.address("Fake address 1234")
.build();
System.out.println(user1);
User user2 = new User.UserBuilder("Jack", "Reacher")
*&---------------------------------------------------------------------*
*& Form yf_om_display_alv_org
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM yf_om_display_alv_org.
DATA: my_table TYPE REF TO cl_salv_table,
my_functions TYPE REF TO cl_salv_functions_list,
my_columns TYPE REF TO cl_salv_columns_table,
* ls_evento-arquivo_string is the XML that needs to be converted.
if ( ls_evento-arquivo_string is not initial ).
lv_len = strlen( ls_evento-arquivo_string ).
create data lo_cdata type c length lv_len.
clear lv_len.
assign lo_cdata->* to field-symbol(<fs_cdata>).
if ( <fs_cdata> is assigned ).
<fs_cdata> = ls_evento-arquivo_string.
assign <fs_cdata> to <ls_conv> casting.
if ( <ls_conv> is assigned ).
@viniciustavanoferreira
viniciustavanoferreira / displayOOALVWithSubtotals.abap
Last active August 12, 2024 08:16
Display totals and subtotals using factory methods, and aggregations in ALV.
DATA: lo_table TYPE REF TO cl_salv_table,
lo_event TYPE REF TO cl_salv_events_table,
lo_functions TYPE REF TO cl_salv_functions,
lo_aggrs TYPE REF TO cl_salv_aggregations,
lo_sort TYPE REF TO cl_salv_sorts,
lo_sort_column TYPE REF TO cl_salv_sort.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = lo_table