\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{tamararr11} \pdfinfo{ /Title (sac-data-actions.pdf) /Creator (Cheatography) /Author (tamararr11) /Subject (SAC - Data Actions Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{86C2B4} \definecolor{LightBackground}{HTML}{EFF7F5} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{SAC - Data Actions Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{tamararr11} via \textcolor{DarkBackground}{\uline{cheatography.com/169484/cs/35495/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}tamararr11 \\ \uline{cheatography.com/tamararr11} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 15th November, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Configuración general}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{CONFIG.HIERARCHY.INCLUDE\_MEMBERS\_NOT\_IN\_HIERARCHY}}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Se usa cuando se quiere que los cálculos posteriores también se realicen para miembros de la dimensión que no están en la jerarquía} \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{\seqsplit{`CONFIG.HIERARCHY.INCLUDE\_MEMBERS\_NOT\_IN\_HIERARCHY} = {[}d/t.S:SAP\_ALL\_TRADINGPARTNER{]}`} \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{{\bf{ CONFIG.GENERATE\_UNBOOKED\_DATA}}} \tn % Row Count 8 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Sirve para indicar si se tienen en cuenta o no los datos vacios. Se configura con ON/OFF, de manera predeterminada estará en OFF} \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{\seqsplit{`CONFIG.GENERATE\_UNBOOKED\_DATA} = ON`} \tn % Row Count 12 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Selección de miembros}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{MEMBERSET}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Se establecen qué valores de las dimensiones/métricas se utilizarán o excluirán en cálculos posteriores de manera general} \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`MEMBERSET {[}d/AUDIT\_TRAIL{]} ="SAC"`} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{En el siguiente ejemplo se excluyen de la dimensión Producto los hijos de la jerarquía = All\_Clothes} \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`MEMBERSET {[}d/PRODUCT{]} != BASEMEMBER( {[}d/PRODUCT{]}.{[}h/H1{]}, "All\_Clothes")`} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{{\bf{BASEMEMBER}}} \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Se utiliza en la segunda parte de MEMBERSET cuando se quiere indicar el padre en específico de una jerarquía} \tn % Row Count 14 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{`MEMBERSET {[}d/SAP\_FI\_S4HC\_GLACCOUNT{]} = (BASEMEMBER({[}d/ACCOUNT{]}.{[}h/Clase\_coste{]}, "Ingresos"))`} \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Agregación de miembros}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{AGGREGATE\_DIMENSIONS}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Sirve para definir qué dimensiones se van a agregar antes de realizar el cálculo} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`AGGREGATE\_DIMENSIONS = {[}d/t.S:SAP\_ALL\_COSTCENTER{]} `} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{{\bf{AGGREGATE\_WRITETO}}} \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Se indica qué valor de la dimensión agregada le asignamos a cada uno de los miembros} \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{`AGGREGATE\_WRITETO {[}d/t.S:SAP\_ALL\_COSTCENTER{]} = "\#"`} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Escribir datos}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{RESULTLOOKUP}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Devuelve los valores para los miembros establecidos previamente} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`RESULTLOOKUP()`} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{También se pueden indicar valores concretos dentro del propio RESULTLOOKUP} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`RESULTLOOKUP({[}d/Version{]} = "public.Actual")`} \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{{\bf{DATA}}} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Se usa para sobrescribir y guardar datos. Se pueden hacer cálculos con los RESULTLOOKUP y guardarlos en la cuenta que se quiera} \tn % Row Count 11 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{`DATA({[}d/Account{]} = "Tasa")) = RESULTLOOKUP({[}d/Account{]} = "Cuenta 1") / RESULTLOOKUP({[}d/Account{]} = "Cuenta 2")`} \tn % Row Count 14 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Dentro de DATA se pueden indicar en qué valores de la variable se van a guardar los datos} \tn % Row Count 16 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{`DATA({[}d/Account{]} = "Tasa",{[}d/Time{]}="202304", {[}d/SAP\_ALL\_COUNTRYDELIVERY{]} ="\#",{[}d/SAP\_CONTROLLINGOBJECTCLASS{]} = "\#", {[}d/SAP\_OPERATINGCONCERN{]} = "\#")= RESULTLOOKUP({[}d/Version{]} = "public.Actual")`} \tn % Row Count 20 (+ 4) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{DELETE}}} \tn % Row Count 21 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Permite borrar datos} \tn % Row Count 22 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`DELETE({[}d/SAP\_FI\_S4HC\_GLACCOUNT{]} = "Tasa")`} \tn % Row Count 23 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{También se pueden indicar valores concretos si no se ha hecho previamente} \tn % Row Count 25 (+ 2) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`DELETE({[}d/SAP\_FI\_S4HC\_GLACCOUNT{]} = "Tasa", {[}d/SAP\_ALL\_COUNTRYDELIVERY{]} ="\#")`} \tn % Row Count 27 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Selección de tiempo/periodo}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{PREVIOUS}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Selecciona un tiempo concreto o un periodo de la dimensión fecha.} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`DATA() = RESULTLOOKUP({[}d/Date{]} = PREVIOUS(1, "MONTH", "2020-04-21"))`} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{El primer argumento nos indica cuántas unidades, el segundo la granularidad y el tercero que fecha tomamos como referencia. Por tanto, nos devolvería como fecha el mes previo a abril: mayo.} \tn % Row Count 9 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Bucles}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{FOREACH }}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Repite la sentencia para cada miembro de la dimensión que se le indique. Con ENDFOR se cierra el bucle} \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`FOREACH {[}d/Date{]} \{\{nl\}\} DATA() = RESULTLOOKUP({[}d/DATE{]} = PREVIOUS(1)) * 1.1\{\{nl\}\} ENDFOR`} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{{\bf{FOR}}} \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Permite repetir una acción un número determinado de veces. A continuación se dice que repita la sentencia desde el elemento 1 al 10 tomados de 2 en 2} \tn % Row Count 11 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{`INTEGER @counter \{\{nl\}\} FOR @counter = 1 TO 10 STEP 2 \{\{nl\}\} DATA() = RESULTLOOKUP() * 0.5 \{\{nl\}\} ENDFOR`} \tn % Row Count 14 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{BREAK}}} \tn % Row Count 15 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Para el bucle FOR/FOREACH cuando se da cierta condición} \tn % Row Count 17 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`FOREACH {[}d/Date{]} \{\{nl\}\} IF RESULTLOOKUP({[}d/Account{]} = "Tasa") = 0 \{\{nl\}\} BREAK\{\{nl\}\} ENDIF \{\{nl\}\} DATA({[}d/Account{]} = "Proporcion") = RESULTLOOKUP({[}d/Account{]} = "Cantidad") / RESULTLOOKUP({[}d/Account{]} ="Tasa") \{\{nl\}\} ENDFOR`} \tn % Row Count 22 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Condicionales}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{IF}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Permite ejecutar la sentencia cuando se cumplan ciertas condiciones. Se cierra con ENDIF} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{`IF RESULTLOOKUP({[}d/Account{]} = "PRICE") \textgreater{} 0 THEN \{\{nl\}\} DATA({[}d/ENTITY{]}="AsiaPacific", {[}d/Product{]}="Product1")=100 \{\{nl\}\} ENDIF`} \tn % Row Count 7 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{{\bf{ELSE/ELSEIF }}} \tn % Row Count 8 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Podemos establecer también qué hacer en el caso en que no se dé la condición declarada en el IF} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{`IF {[}d/ACCOUNT{]}="PRICE" THEN \{\{nl\}\} ELSEIF RESULTLOOKUP({[}d/ACCOUNT{]}="PRICE")\textgreater{}0 THEN \{\{nl\}\} ELSE \{\{nl\}\} DATA({[}d/ENTITY{]}="AsiaPacific", {[}d/Product{]}="Product1")=100 \{\{nl\}\} ENDIF`} \tn % Row Count 14 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \end{document}