se19 BADI 생성

se20 BADI 조회/수정

'SAP Program > ABAP' 카테고리의 다른 글

XML을 Internal table로 보내기  (0) 2017.11.22
GUI Status 생성시 덤프 발생하는 경우  (0) 2017.11.20
BP Relation Table  (0) 2017.11.02
MCHBH LFGJA LFMON Max 값 select  (0) 2017.10.26
ABAP 7.40 Quick Reference  (0) 2017.10.24

설정

트랙백

댓글

s4/hana migration 관련

S4/HANA 2017. 11. 3. 09:23

/SHCM/RH_SYNC_BUPA_EMPL_SINGLE : S/4HANA BUPA 동기화

/SHCM/RH_SYNC_BUPA_FROM_EMPL  :  S/4HANA BUPA 동기화


SAP LT

'S4/HANA' 카테고리의 다른 글

S4H 1511 이후 자재문서 테이블에 커스텀 필드 추가방법 [레벨:2]공상우  (0) 2018.01.03
MCHB & MCHBH CDS View  (0) 2017.10.17
SAP site  (0) 2017.08.03
SAP UI5 Step 6: Modules  (0) 2017.03.27
SAP UI5 Step 5: Controllers  (0) 2017.03.24

설정

트랙백

댓글

BP Relation Table

SAP Program/ABAP 2017. 11. 2. 15:16

HR Pernr <-> BP Partner No Relation : BUT0ID


Vendor <-> BP Partner No Relation : CVI_VEND_LINK


Customer <-> BP Partner No Relation : CVI_CUST_LINK

'SAP Program > ABAP' 카테고리의 다른 글

GUI Status 생성시 덤프 발생하는 경우  (0) 2017.11.20
BADI 생성/조회 t-code  (0) 2017.11.03
MCHBH LFGJA LFMON Max 값 select  (0) 2017.10.26
ABAP 7.40 Quick Reference  (0) 2017.10.24
CTE Open sql  (0) 2017.10.12

설정

트랙백

댓글



HANA 에서 지정한 Data보다 큰 200000 개의 Data 읽어오기


3개의 필드를 비교하여 Max 값


select z.*'

  from ZFIT_AUDIT02 as z

where mandt = '100'

   and gjahr = i_gjahr

   and bukrs = i_bukrs

   and budat >= i_budat

   and ( belnr >= i_belnr or budat > i_budat )

   and ( buzei >= i_buzei or belnr > i_belnr or budat > i_budat )

order by bukrs, gjahr, budat, belnr, buzei' INTO sql_str

limit 200000



4개의 필드를 비교하여 Max 값


select *
    into CORRESPONDING FIELDS OF table lt_konv
    from konv
      up to 200000 rows
   where KDATU between '20120101' and '20151231'
     and KNUMV >= lv_knumv
     and KPOSN >= lv_kposn or KNUMV > lv_knumv )
     and STUNR >= lv_stunr or KPOSN > lv_kposn or KNUMV > lv_knumv )
     and ZAEHK >= lv_zaehk or STUNR > lv_stunr or KPOSN > lv_kposn or KNUMV > lv_knumv )
     ORDER BY PRIMARY KEY.

'SAP Program > ABAP' 카테고리의 다른 글

BADI 생성/조회 t-code  (0) 2017.11.03
BP Relation Table  (0) 2017.11.02
ABAP 7.40 Quick Reference  (0) 2017.10.24
CTE Open sql  (0) 2017.10.12
so_object_send를 이용한 mail 전송  (0) 2017.10.11

설정

트랙백

댓글

https://blogs.sap.com/2015/10/25/abap-740-quick-reference/




So you’re an experienced ABAP programmer wanting to leverage off the fantastic new functionality available to you in ABAP 7.40!

However, searching for information on this topic leads you to fragmented pages or blogs that refer to only a couple of the new features available to you.

What you need is a quick reference guide which gives you the essentials you need and shows you how the code you are familiar with can be improved with ABAP 7.40.

The below document contains exactly this!

It gives examples of “classic” ABAP and its 740 equivalent. It goes into more details on the more difficult topics normally via examples. This allows the reader to dive in to the level they desire. While this document does not contain everything pertaining to ABAP 740 it certainly covers the most useful parts in the experience of the author.

The document has been compiled by drawing on existing material available online as well as trial and error by the author. In particular the blogs by Horst Keller have been useful and are the best reference I have found (prior to this document ). He has a landing page of sorts for his various blogs on the topic here:

ABAP Language News for Release 7.40

Credit also goes to Naimesh Patel for his useful explanations and examples on ABAP 7.40. Here is his example of the “FOR iteration expression” which I leaned on (links to his other 740 articles can be found at the bottom of the link):

http://zevolving.com/2015/05/abap-740-for-iteration-expression/

I compiled the below document to make the transition to using ABAP 740 easier for myself and my project team. It has worked well for us and I hope it will do the same for you.

Regards,

Jeff Towell

ABAP 7.40 Quick Reference  

Author:

Jeffrey Towell

Created:

2015

  

Contents

1. Inline Declarations

2. Table Expressions

3. Conversion Operator CONV

     I.  Definition

     II. Example

4. Value Operator VALUE

     I.   Definition

     II.  Example for structures

     III. Examples for internal tables

5. FOR operator

     I.   Definition

     II.  Explanation

     III. Example 1

     IV. Example 2

     V. FOR with THEN and UNTIL|WHILE

6. Reduction operator REDUCE

     I.   Definition

     II.  Note

     III. Example 1

     IV. Example 2

     V.  Example 3

7. Conditional operators COND and SWITCH

     I.   Definition

     II.  Example for COND

     III. Example for SWITCH

8. CORRESPONDING operator

     I.   Definition

     II.  Example Code

     III. Output

     IV. Explanation

     V.  Additions MAPPING and EXCEPT

9.Strings

     I.   String Templates

     II.  Concatenation

     III. Width/Alignment/Padding.

     IV. Case

     V.  ALPHA conversion

     VI.  Date conversion

10. Loop at Group By

     I.   Definition

     II.  Explanation

     III. Example

     IV. Output

11. Classes/Methods

     I.   Referencing fields within returned structures

     II.  Methods that return a type BOOLEAN

     III. NEW operator

12. Meshes

     I.   Problem

     II.  Solution

     III. Output

13. Filter

     I.   Definition

     II.  Problem

     III. Solution

1. Inline Declarations

Description

Before 7.40

With 7.40

Datastatement

DATA text TYPE string.
text = `ABC`.

DATA(text) = `ABC`.

Loop at into work area

DATA wa like LINE OF itab.
LOOP AT itab 
INTO wa.   
  …
ENDLOOP.

LOOP AT itab INTO DATA(wa).   
  
ENDLOOP
.

Call method

DATA a1 TYPE …

DATA a2 TYPE …

oref->meth( IMPORTING p1 = a1

            IMPORTING p2 = a2

          ).

oref->meth(

        IMPORTING p1 = DATA(a1)

        IMPORTING p2 = DATA(a2) ).

Loop at assigning

FIELD-SYMBOLS: <line> type …

LOOP AT itab ASSIGNING <line>.

  …

ENDLOOP.

LOOP AT itab

   ASSIGNING FIELD-SYMBOL(<line>).
   …
ENDLOOP.

Read assigning

FIELD-SYMBOLS: <line> type …

READ TABLE itab

           ASSIGNING <line>.

READ TABLE itab

   ASSIGNING FIELD-SYMBOL(<line>).

Select into

table

DATA itab TYPE TABLE OF dbtab.

SELECT * FROM dbtab

   INTO TABLE itab

        WHERE fld1 = lv_fld1.

SELECT * FROM dbtab

   INTO TABLE DATA(itab) 

        WHERE fld1 = @lv_fld1.

Select single

into

SELECT SINGLE f1 f2 

  FROM dbtab

  INTO (lv_f1, lv_f2)

WHERE …

WRITE: / lv_f1, lv_f2.

SELECT SINGLE f1 AS my_f1,

              F2 AS abc  

         FROM dbtab

         INTO DATA(ls_structure)

        WHERE …

WRITE: / ls_structure-my_f1,              ls_structure-abc.

  

2. Table Expressions

If a table line is not found, the exception CX_SY_ITAB_LINE_NOT_FOUND is raised. No sy-subrc.


Description

Before 7.40

With 7.40

Read Table  index

READ TABLE itab INDEX idx

      INTO wa.

wa = itab[ idx ].

Read Table  using key

READ TABLE itab INDEX idx

     USING KEY key

      INTO wa.

wa = itab[ KEY key INDEX idx ].

Read Table  with key

READ TABLE itab

  WITH KEY col1 = 

           col2 = 

       INTO wa.

wa = itab[ col1 =  col2 =  ].

Read Table  with key components

READ TABLE itab

      WITH TABLE KEY key

COMPONENTS col1 = 

           col2 = 

      INTO wa.

wa = itab[ KEY key col1 = 

                    col2 =  ].

Does record exist?

READ TABLE itab …

    TRANSPORTING NO FIELDS.

IF sy-subrc = 0.

  …

ENDIF.

IF line_exists( itab[ … ] ).

ENDIF.

Get table index

DATA idx type sy-tabix.

READ TABLE …

  TRANSPORTING NO FIELDS.

  idx = sy-tabix.

DATA(idx) =

       line_index( itab[ … ] ).

NB: There will be a short dump if you use an inline expression that references a non-existent record.

        SAP says you should therefore assign a field symbol and check sy-subrc.

ASSIGN lt_tab[ to FIELDSYMBOL(<ls_tab>).
IF sysubrc 0.

ENDIF.


NB: Use itab [ table_line = … ] for untyped tables.


3. Conversion Operator CONV

I.  Definition

CONV dtype|#( … )

dtype = Type you want to convert to (explicit)

#     = compiler must use the context to decide the type to convert to (implicit)


II. Example

Method cl_abap_codepage=>convert_to expects a string

Before 7.40

DATA text   TYPE c LENGTH 255.

DATA helper TYPE string.

DATA xstr   TYPE xstring.

helper = text.

xstr = cl_abap_codepage=>convert_to( source = helper ).

With 7.40

DATA text TYPE c LENGTH 255.

DATA(xstr) = cl_abap_codepage=>convert_to( source = CONV string( text ) ).

OR

DATA(xstr) = cl_abap_codepage=>convert_to( source = CONV #( text ) ).

  

4. Value Operator VALUE

I. Definition

     Variables:    VALUE dtype|#( )

     Structures:  VALUE dtype|#( comp1 = a1 comp2 = a2 … )

     Tables:         VALUE dtype|#( ( … ) ( … ) … ) …

II. Example for structures

     TYPES:  BEGIN OF ty_columns1, “Simple structure
                     cols1 TYPE i, 
                     cols2 TYPE i, 
                   END OF ty_columns1.

      TYPES: BEGIN OF ty_columnns2,  “Nested structure
                     coln1 TYPE i, 
                     coln2 TYPE ty_columns1, 
                  END OF ty_columns2.

      DATA: struc_simple TYPE ty_columns1, 
                struc_nest    TYPE ty_columns2.

     struct_nest   = VALUE t_struct(coln1 = 1 
                                                  coln2-cols1 = 1 
                                                  coln2-cols2 = 2 ).


     OR


     struct_nest   = VALUE t_struct(coln1 = 1 
                                                   coln2 = VALUE #( cols1 = 1
 
                                                   cols2 = 2 ) ).


III. Examples for internal tables

Elementary line type:

TYPES t_itab TYPE TABLE OF i WITH EMPTY KEY.

DATA itab TYPE t_itab.

itab = VALUE #( ( ) ( 1 ) ( 2 ) ).

Structured line type (RANGES table):

DATA itab TYPE RANGE OF i.

itab = VALUE #( sign = ‘I’  option = ‘BT’ ( low = 1  high = 10 ) 
( low = 21 high = 30 ) 
( low = 41 high = 50 ) 
option = ‘GE’ ( low = 61 )  ).


5. FOR operator

I. Definition

     FOR wa|<fs> IN itab [INDEX INTO idx] [cond]

II. Explanation

This effectively causes a loop at itab. For each loop the row read is assigned to a work area (wa) or field-symbol(<fs>).

This wa or <fs> is local to the expression i.e. if declared in a subrourine the variable wa or <fs> is a local variable of

that subroutine. Index like SY-TABIX in loop.

Given: 

TYPESBEGIN OF ty_ship,
           tknum 
TYPE tknum,     “Shipment Number
           name  
TYPE ernam,     “Name of Person who Created the Object
           city  
TYPE ort01,     “Starting city
           route 
TYPE route,     “Shipment route
       
END OF ty_ship.
TYPESty_ships TYPE SORTED TABLE OF ty_ship WITH UNIQUE KEY tknum.
TYPESty_citys TYPE STANDARD TABLE OF ort01 WITH EMPTY KEY.

GT_SHIPS type ty_ships. -> has been populated as follows:

RowTKNUM[C(10)]Name[C(12)]City[C(25)]Route[C(6)]
1001JohnMelbourneR0001
2002GavinSydneyR0003
3003LucyAdelaideR0001
4004ElainePerthR0003

III. Example 1

Populate internal table GT_CITYS with the cities from GT_SHIPS.

Before 7.40

DATAgt_citys TYPE ty_citys,
       gs_ship  
TYPE ty_ship,
       gs_city  
TYPE ort01.

LOOP AT gt_ships INTO gs_ship.
  gs_city 
=  gs_shipcity.
  APPEND gs_city TO gt_citys.
ENDLOOP.

With 7.40

DATA(gt_citys) = VALUE ty_citysFOR ls_ship IN gt_ships ls_shipcity ) ).

IV. Example 2

Populate internal table GT_CITYS with the cities from GT_SHIPS where the route is R0001.


Before 7.40

DATAgt_citys TYPE ty_citys,
       gs_ship  
TYPE ty_ship,
       gs_city  
TYPE ort01.

LOOP AT gt_ships INTO gs_ship WHERE route ‘R0001’.
  gs_city 
=  gs_shipcity.
  APPEND gs_city TO gt_citys.
ENDLOOP.

With 7.40

DATA(gt_citys) = VALUE ty_citysFOR ls_ship IN gt_ships

                               WHERE route ‘R0001’ ls_shipcity ) ).

Note: ls_ship does not appear to have been declared but it is declared implicitly.


V. FOR with THEN and UNTIL|WHILE

FOR i = … [THEN expr] UNTIL|WHILE log_exp

Populate an internal table as follows:

TYPES:
  BEGIN OF ty_line,
    col1 TYPE i,
    col2 TYPE i,
    col3 TYPE i,
  END OF ty_line,
  ty_tab TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.

Before 7.40

DATAgt_itab TYPE ty_tab,
      j       
TYPE i.
FIELD-SYMBOLS <ls_tab> TYPE ty_line.

1.
DO.
j + 10.
IF j > 40EXITENDIF.
APPEND INITIAL LINE TO gt_itab ASSIGNING <ls_tab>.
<ls_tab>
col1 j.
<ls_tab>
col2 j + 1.
<ls_tab>
col3 j + 2.
ENDDO.

With 7.40

DATA(gt_itab) = VALUE ty_tabFOR 11 THEN j + 10 UNTIL j > 40
                            ( col1 j col2 j + col3 j + 2  ) ).

  

6. Reduction operator REDUCE

I. Definition

… REDUCE type(

INIT result = start_value

           …

FOR for_exp1

FOR for_exp2

NEXT …

           result = iterated_value

… )

II. Note

     While VALUE and NEW expressions can include FOR expressions, REDUCE must include at least one FOR expression. You can use all kinds      of FOR expressions in REDUCE:

  • with IN for iterating internal tables
  • with UNTIL or WHILE for conditional iterations

III. Example 1

Count lines of table that meet a condition (field F1 contains “XYZ”).

Before 7.40

DATAlv_lines TYPE i.

LOOP AT gt_itab INTO ls_itab where F1 = ‘XYZ’.
  lv_
lines lv_lines + 1.
ENDLOOP.

With 7.40

DATA(lv_lines) = REDUCE iINIT FOR wa IN gt_itab

                    WHERE( F1 = ‘XYZ’ ) NEXT x + 1 ).

IV. Example 2

Sum the values 1 to 10 stored in the column of a table defined as follows

DATA gt_itab TYPE STANDARD TABLE OF i WITH EMPTY KEY.
gt_itab 
VALUE #FOR WHILE j <= 10 ) ).

Before 7.40

DATAlv_line TYPE i,
      lv_sum  
TYPE i.

LOOP AT gt_itab INTO lv_line.
  lv_sum 
lv_sum + lv_line.
ENDLOOP.

With 7.40

DATA(lv_sum) = REDUCE iINIT FOR wa IN itab NEXT x + wa ).

V. Example 3

Using a class reference – works because “write” method returns reference to instance object

With 7.40

TYPES outref TYPE REF TO if_demo_output.

DATA(output) = REDUCE outrefINIT out  cl_demo_output=>new( )
                              text
 `Count up:`
                              FOR UNTIL n > 11
                              NEXT out out->writetext )
                              text
 |{ n }| ).

output->display( ).

7. Conditional operators COND and SWITCH

I. Definition

… COND dtype|#( WHEN log_exp1 THEN result1 
[ WHEN log_exp2 THEN result2 ] 
… 
[ ELSE resultn ] ) …

… SWITCH dtype|#( operand 
WHEN const1 THEN result1 
[ WHEN const2 THEN result2 ] 
… 
[ ELSE resultn ] ) …

II. Example for COND

DATA(time) =

  COND string(

    WHEN sy-timlo < ‘120000’ THEN

      |{ sy-timlo TIME = ISO } AM|

    WHEN sy-timlo > ‘120000’ THEN

      |{ CONV t( sy-timlo – 12 * 3600 )

TIME = ISO } PM|

    WHEN sy-timlo = ‘120000’ THEN

      |High Noon|

    ELSE

      THROW cx_cant_be( ) ).

III. Example for SWITCH

DATA(text) =
NEW class( )->meth(
                     SWITCH #( sy-langu
                              WHEN ‘D’ THEN `DE`
                              WHEN ‘E’ THEN `EN`
                               ELSE THROW cx_langu_not_supported( ) ) ).

  

8. Corresponding Operator

I. Definition

… CORRESPONDING type( [BASE ( base )] struct|itab [mapping|except] )

II. Example Code

With 7.40

TYPESBEGIN OF line1col1 TYPE icol2 TYPE iEND OF line1.
TYPESBEGIN OF line2, col1 TYPE icol2 TYPE i, col3 TYPE i, END OF line2.

DATA(ls_line1) = VALUE line1col1 col2 ).
WRITE‘ls_line1 =’ ,15 ls_line1col1ls_line1col2.
DATA(ls_line2) = VALUE line2col1 col2 col3 ).
WRITE‘ls_line2 =’ ,15 ls_line2col1ls_line2col2ls_line2col3.
SKIP 2.

ls_line2 CORRESPONDING #ls_line1 ).
WRITE‘ls_line2 = CORRESPONDING #( ls_line1 )’

     ,70 ‘Result is ls_line2 = ‘     

        ,ls_line2col1ls_line2col2ls_line2col3.
SKIP.

ls_line2 VALUE line2col1 col2 col3 ).   “Restore ls_line2
ls_line2 
CORRESPONDING #BASE ls_line2 ls_line1 ).
WRITE‘ls_line2 = CORRESPONDING #( BASE ( ls_line2 ) ls_line1 )’

        , 70 ‘Result is ls_line2 = ‘ls_line2col1

        , ls_line2col2ls_line2col3.
SKIP.

ls_line2 VALUE line2col1 col2 col3 ).   “Restore ls_line2
DATA(ls_line3) = CORRESPONDING line2BASE ls_line2 ls_line1 ).
WRITE‘DATA(ls_line3) = CORRESPONDING line2( BASE ( ls_line2 ) ls_line1 )’

         70 ‘Result is ls_line3 = ‘ ls_line3col1

         , ls_line3col2ls_line3col3.

III. Output

/wp-content/uploads/2015/10/image001_906951.jpg

IV. Explanation

Given structures ls_line1 & ls_line2 defined and populated as above.

Before 7.40

With 7.40

1

CLEAR ls_line2.

MOVE-CORRESPONDING ls_line1 

                TO ls_line2.

ls_line2 = CORRESPONDING #( ls_line1 ).

2

MOVE-CORRESPONDING ls_line1 

                TO ls_line2.

ls_line2 = CORRESPONDING #

        ( BASE ( ls_line2 ) ls_line1 ).

3

DATA: ls_line3 like ls_line2.

ls_line3 = ls_line2.

MOVE-CORRESPONDING ls_line1 

                TO ls_line2.

DATA(ls_line3) = CORRESPONDING line2

        ( BASE ( ls_line2 ) ls_line1 ).

  1.   The contents of ls_line1 are moved to ls_line2 where there is a matching column name. Where there is no

            match the column of ls_line2 is initialised.

  2. This uses the existing contents of ls_line2 as a base and overwrites the matching columns from ls_line1.

            This is exactly like MOVE-CORRESPONDING.

  3. This creates a third and new structure (ls_line3) which is based on ls_line2 but overwritten by matching

             columns of ls_line1.

V. Additions MAPPING and EXCEPT

   MAPPING allows you to map fields with non-identically named components to qualify for the data transfer.

   … MAPPING  t1 = s1 t2 = s2


   EXCEPT allows you to list fields that must be excluded from the data transfer

   … EXCEPT  {t1 t2 …}

9. Strings

I. String Templates

A string template is enclosed by two characters “|” and creates a character string.

Literal text consists of all characters that are not in braces {}. The braces can contain:

  • data objects,
  • calculation expressions,
  • constructor expressions,
  • table expressions,
  • predefined functions, or
  • functional methods and method chainings

Before 7.40

DATA itab TYPE TABLE OF scarr.

SELECT * FROM scarr INTO TABLE itab.

DATA wa LIKE LINE OF itab.

READ TABLE itab WITH KEY carrid = ‘LH’ INTO wa.

DATA output TYPE string.

CONCATENATE ‘Carrier:’ wa-carrname INTO output SEPARATED BY space.

cl_demo_output=>display( output ).

With 7.40

SELECT FROM scarr INTO TABLE @DATA(lt_scarr).
cl_demo_output
=>display|Carrier{ lt_scarr[ carrid ‘LH’ ]carrname }|  ).

II. Concatenation

Before 7.40

DATA lv_output TYPE string.
CONCATENATE 
‘Hello’ ‘world’ INTO lv_output SEPARATED BY space.

With 7.40

DATA(lv_out) = |Hello| & | | & |world|.

III. Width/Alignment/Padding

WRITE / |{ ‘Left’     WIDTH 20 ALIGN LEFT   PAD ‘0’ }|.
WRITE / |{ ‘Centre’   WIDTH 20 ALIGN CENTER PAD ‘0’ }|.
WRITE / |{ ‘Right’    WIDTH 20 ALIGN RIGHT  PAD ‘0’ }|.

IV. Case

WRITE / |{ ‘Text’ CASE = (cl_abap_format=>c_raw}|.
WRITE / |{ ‘Text’ CASE = (cl_abap_format=>c_upper}|.
WRITE / |{ ‘Text’ CASE = (cl_abap_format=>c_lower}|.

V. ALPHA conversion

DATA(lv_vbeln) = ‘0000012345’.
WRITE / |{ lv_vbeln  ALPHA OUT }|.     “or use ALPHA = IN to go in other direction

VI. Date conversion

WRITE / |{ pa_date DATE ISO }|.           “Date Format YYYY-MM-DD
WRITE / |{ pa_date DATE User }|.          “As per user settings
WRITE / |{ pa_date DATE Environment }|.   “Formatting setting of language environment

10. Loop at Group By

I. Definition

LOOP AT itab result [cond] GROUP BY key ( key1 = dobj1 key2 = dobj2 … 
      [gs = GROUP SIZE] [gi = GROUP INDEX] ) 
      [ASCENDING|DESCENDING [AS TEXT]] 
      [WITHOUT MEMBERS] 
      [{INTO group}|{ASSIGNING <group>}]
      … 
      
[LOOP AT GROUP group|<group> 
      
 
      
ENDLOOP.] 
      …

ENDLOOP.


II. Explanation

The outer loop will do one iteration per key. So if 3 records match the key there will only be one iteration for these 3 records. The structure “group” (or

“<group>” ) is unusual in that it can be looped over using the “LOOP AT GROUP” statement. This will loop over the 3 records (members) of the group. The

structure “group” also contains the current key as well as the size of the group and index of the group ( if GROUP SIZE and GROUP INDEX have been

assigned a field name). This is best understood by an example.


III. Example

With 7.40

TYPES: BEGIN OF ty_employee,

  name TYPE char30,

  role    TYPE char30,

  age    TYPE i,

END OF ty_employee,

ty_employee_t TYPE STANDARD TABLE OF ty_employee WITH KEY name.

DATA(gt_employee) = VALUE ty_employee_t(

( name = ‘John‘     role = ‘ABAP guru‘       age = 34 )

( name = ‘Alice‘     role = ‘FI Consultant‘   age = 42 )

( name = ‘Barry‘    role = ‘ABAP guru‘       age = 54 )

( name = ‘Mary‘     role = ‘FI Consultant‘   age = 37 )

( name = ‘Arthur‘   role = ‘ABAP guru‘       age = 34 )

( name = ‘Mandy‘  role = ‘SD Consultant‘  age = 64 ) ).

DATA: gv_tot_age TYPE i,

           gv_avg_age TYPE decfloat34.

“Loop with grouping on Role

LOOP AT gt_employee INTO DATA(ls_employee)

  GROUP BY ( role  = ls_employee-role

                        size  = GROUP SIZE

                       index = GROUP INDEX )

  ASCENDING

  ASSIGNING FIELD-SYMBOL(<group>).

  CLEAR: gv_tot_age.

  “Output info at group level

  WRITE: / |Group: { <group>-index }    Role: { <group>-role WIDTH = 15 }|

              & |     Number in this role: { <group>-size }|.

   “Loop at members of the group

   LOOP AT GROUP <group> ASSIGNING FIELD-SYMBOL(<ls_member>).

      gv_tot_age = gv_tot_age + <ls_member>-age.

      WRITE: /13 <ls_member>-name.

   ENDLOOP.

   “Average age

   gv_avg_age = gv_tot_age / <group>-size.

   WRITE: / |Average age: { gv_avg_age }|.

   SKIP.

ENDLOOP.

IV. Output

Group: 1    Role: ABAP guru           Number in this role: 3

                 John

                 Barry

                 Arthur

Average age: 40.66666666666666666666666666666667

Group: 2    Role: FI Consultant       Number in this role: 2

                  Alice

                  Mary

Average age: 39.5

Group: 3    Role: SD Consultant       Number in this role: 1

                  Mandy

Average age: 64

11. Classes/Methods

I. Referencing fields within returned structures

Before 7.40

DATAls_lfa1  TYPE lfa1,
      lv_name1 
TYPE lfa1name1.

ls_lfa1  = My_Class=>get_lfa1( ).
lv_name1 
ls_lfa1name1.

With 7.40

DATA(lv_name1) = My_Class=>get_lfa1( )name1.

II. Methods that return a type BOOLEAN

Before 7.40

IF My_Class=>return_boolean( ) = abap_true.

ENDIF.

With 7.40

IF My_Class=>return_boolean( ).

ENDIF.

NB: The type “BOOLEAN” is not a true Boolean but a char1 with allowed values X,- and <blank>.

       Using type “FLAG” or “WDY_BOOLEAN” works just as well.

III. NEW operator

This operator can be used to instantiate an object.

Before 7.40

DATAlo_delivs TYPE REF TO zcl_sd_delivs,

            lo_deliv  TYPE REF TO zcl_sd_deliv.

CREATE OBJECT lo_delivs.
CREATE OBJECT lo_deliv.

lo_deliv = lo_delivs->get_delivlv_vbeln ).

With 7.40

DATA(lo_deliv) = new zcl_sd_delivs( )->get_delivlv_vbeln ).

12. Meshes

Allows an association to be set up between related data groups.


I. Problem

Given the following 2 internal tables:

TYPESBEGIN OF t_manager,
name   
TYPE char10,
salary 
TYPE int4,
END OF t_manager,
tt_manager 
TYPE SORTED TABLE OF t_manager WITH UNIQUE KEY name.

TYPESBEGIN OF t_developer,
name    
TYPE char10,
salary  
TYPE int4,
manager 
TYPE char10,   “Name of manager
END OF t_developer,
tt_developer 
TYPE SORTED TABLE OF t_developer WITH UNIQUE KEY name.


Populated as follows:

RowName[C(10)]Salary[I(4)]
1Jason3000
2Thomas3200
Row
Name[C(10)]

Salary[I(4)Manager[C(10)]
1Bob2100Jason
2David2000Thomas
3Jack1000Thomas
4Jerry1000Jason
5John2100Thomas
6Tom2000Jason

Get the details of Jerry’s manager and all developers managed by Thomas.

II. Solution

With 7.40

TYPESBEGIN OF MESH m_team,
         managers   
TYPE tt_manager  ASSOCIATION my_employee TO developers

                                                            ON manager name,
         developers 
TYPE tt_developer ASSOCIATION my_manager TO managers  

                                                            ON name manager,
       END OF MESH m_team.

DATAls_team TYPE m_team.
ls_team
managers   lt_manager.
ls_team
developers lt_developer.

*Get details of Jerry’s manager *

“get line of dev table

ASSIGN lt_developer[ name ‘Jerry’ TO FIELDSYMBOL(<ls_jerry>).
DATA(ls_jmanager) =  ls_teamdevelopers\my_manager[ <ls_jerry> ].

WRITE/ |Jerry‘s manager: { ls_jmanager-name }|,30

                  |Salary: { ls_jmanager-salary }|.


“Get Thomas’ developers
SKIP.
WRITE/ |Thomas‘ developers:|.

“line of manager table

ASSIGN lt_manager[ name ‘Thomas’ TO FIELDSYMBOL(<ls_thomas>).
LOOP AT ls_teammanagers\my_employee[ <ls_thomas> ]     

        ASSIGNING FIELDSYMBOL(<ls_emp>).

  WRITE/ |Employee name{ <ls_emp>name }|.
ENDLOOP.

III. Output

     Jerry’s manager: Jason          Salary: 3000

     Thomas’ developers:

     Employee name: David

     Employee name: Jack

     Employee name: John

13. Filter

Filter the records in a table based on records in another table.


I. Definition

… FILTER type( itab [EXCEPT] [IN ftab] [USING KEY keyname] 
           WHERE c1 op f1 [AND c2 op f2 […]] )

II. Problem

Filter an internal table of Flight Schedules (SPFLI) to only those flights based on a filter table that contains the fields Cityfrom and CityTo.

III. Solution

With 7.40

TYPESBEGIN OF ty_filter,
         cityfrom 
TYPE spflicityfrom,
         cityto   
TYPE spflicityto,
         f3       
TYPE i,
       END OF ty_filter,
       ty_filter_tab 
TYPE HASHED TABLE OF ty_filter

                     WITH UNIQUE KEY cityfrom cityto.
DATAlt_splfi TYPE STANDARD TABLE OF spfli.

SELECT FROM spfli APPENDING TABLE lt_splfi.

DATA(lt_filter) = VALUE ty_filter_tabf3 2

                          cityfrom ‘NEW YORK’  cityto  ‘SAN FRANCISCO’ )
             ( cityfrom ‘FRANKFURT’ cityto  ‘NEW YORK’ )  ).

DATA(lt_myrecs) = FILTER #lt_splfi IN lt_filter

                                  WHERE cityfrom cityfrom 

                                    AND cityto cityto ).

“Output filtered records
LOOP AT lt_myrecs ASSIGNING FIELDSYMBOL(<ls_rec>).
  WRITE/ <ls_rec>carrid,<ls_rec>cityfrom,30

           <ls_rec>cityto,45 <ls_rec>deptime.

ENDLOOP.

Note: using the keyword “EXCEPT” (see definition above) would have returned the exact opposite records i.e all records EXCEPT for those those returned above.

'SAP Program > ABAP' 카테고리의 다른 글

BP Relation Table  (0) 2017.11.02
MCHBH LFGJA LFMON Max 값 select  (0) 2017.10.26
CTE Open sql  (0) 2017.10.12
so_object_send를 이용한 mail 전송  (0) 2017.10.11
QM QS24 Call transaction 이용한 조회가 안될경우  (0) 2017.09.13

설정

트랙백

댓글

MCHB & MCHBH CDS View

S4/HANA 2017. 10. 17. 11:40

CDS View를 재활용하여 CDS view를 만들때에는 association을 이용하여 만들어주어야 한다.



@AbapCatalog.sqlViewName: 'ZQMCV_SQLV_0001'

@AbapCatalog.compiler.compareFilter: true

@AccessControl.authorizationCheck: #CHECK

@ClientDependent: true

@EndUserText.label: 'MCHBH cds view test'

define view ZQMCV_0001Z as 

select from nsdm_e_mchbh as hbh

association [1] to nsdm_e_mchb as hb

    on hb.matnr = hbh.matnr

   and hb.werks = hbh.werks

   and hb.lgort = hbh.lgort

   and hb.charg = hbh.charg

{    

    key hbh.matnr,

    key hbh.werks,

    key hbh.lgort,

    key hbh.charg,

    

    key concat(hbh.lfgja, hbh.lfmon) as h_yearmon,

    concat(hb.lfgja,  hb.lfmon)  as yearmon,

    

    hbh.clabs as h_CLABS,

    hbh.cumlm as h_CUMLM,

    hbh.cinsm as h_CINSM,

    hbh.ceinm as h_CEINM,

    hbh.cspem as h_CSPEM,

    hbh.cretm as h_CRETM,

        

    hb.clabs,

    hb.cumlm,

    hb.cinsm,

    hb.ceinm,

    hb.cspem,

    hb.cretm

    



4개의 cds view를 이용하여 max h_yearmon의 값을 한꺼번에 가져오는 CDS view 생성

=======================================================================


** MCHB와 MCHBH의 data join


@AbapCatalog.sqlViewName: 'ycds_ass_trest01'

@AbapCatalog.compiler.compareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'cds association test'

define view yass_cds_test01_01 as 

select from nsdm_e_mchbh as hbh

association [1] to nsdm_e_mchb as hb

    on hb.matnr = hbh.matnr

   and hb.werks = hbh.werks

   and hb.lgort = hbh.lgort

   and hb.charg = hbh.charg 

   {

    

    key hbh.matnr,

    key hbh.werks,

    key hbh.lgort,

    key hbh.charg,

    

    key concat(hbh.lfgja, hbh.lfmon) as h_yearmon,

    concat(hb.lfgja,  hb.lfmon)  as yearmon,

    

    hbh.clabs as h_CLABS,

    hbh.cumlm as h_CUMLM,

    hbh.cinsm as h_CINSM,

    hbh.ceinm as h_CEINM,

    hbh.cspem as h_CSPEM,

    hbh.cretm as h_CRETM,

        

    hb.clabs,

    hb.cumlm,

    hb.cinsm,

    hb.ceinm,

    hb.cspem,

    hb.cretm

}  

 


=======================================================================

** MCHBH의 hbh.lfgja, hbh.lfmon concat



@AbapCatalog.sqlViewName: 'ycds_ass_trest02'

@AbapCatalog.compiler.compareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'cds association test 2'

define view yass_cds_test01_02 as 

select  

    key hbh.matnr,

    key hbh.werks,

    key hbh.lgort,

    key hbh.charg,    

    concat(hbh.lfgja, hbh.lfmon) as h_yearmon

from nsdm_e_mchbh as hbh

group by hbh.matnr,

    hbh.werks,

    hbh.lgort,

    hbh.charg,

    hbh.lfgja, hbh.lfmon


   

========================================================================

** MCHBH의 max h_yearmon data table


@AbapCatalog.sqlViewName: 'ycds_ass_trest04'

@AbapCatalog.compiler.compareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'cds association test 4'

define view yass_cds_test01_04 as

select   

    key hbh.matnr,

    key hbh.werks,

    key hbh.lgort,

    key hbh.charg,    

    max(h_yearmon) as h_yearmon

from yass_cds_test01_02 as hbh

group by hbh.matnr,

    hbh.werks,

    hbh.lgort,

    hbh.charg 

 

=======================================================================

** MCHB와 MCHBH 중 h_yearmon 값이 max 인 데이타 select


 

@AbapCatalog.sqlViewName: 'ycds_ass_trest03'

@AbapCatalog.compiler.compareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'cds association test 3'

define view yass_cds_test01_03 as 

select from yass_cds_test01_01 as hbh

   inner join yass_cds_test01_04 as hbm

    on hbh.matnr = hbm.matnr

   and hbh.werks = hbm.werks

   and hbh.lgort = hbm.lgort

   and hbh.charg = hbm.charg 

   and hbh.h_yearmon = hbm.h_yearmon {

    

    key hbh.matnr,

    key hbh.werks,

    key hbh.lgort,

    key hbh.charg,

    

    key hbm.h_yearmon,

    hbh.yearmon,

    

    hbh.h_CLABS,

    hbh.h_CUMLM,

    hbh.h_CINSM,

    hbh.h_CEINM,

    hbh.h_CSPEM,

    hbh.h_CRETM,

        

    hbh.clabs,

    hbh.cumlm,

    hbh.cinsm,

    hbh.ceinm,

    hbh.cspem,

    hbh.cretm

}

 

'S4/HANA' 카테고리의 다른 글

S4H 1511 이후 자재문서 테이블에 커스텀 필드 추가방법 [레벨:2]공상우  (0) 2018.01.03
s4/hana migration 관련  (0) 2017.11.03
SAP site  (0) 2017.08.03
SAP UI5 Step 6: Modules  (0) 2017.03.27
SAP UI5 Step 5: Controllers  (0) 2017.03.24

설정

트랙백

댓글

CTE Open sql

SAP Program/ABAP 2017. 10. 12. 14:26


When I mentioned CTEs one year ago, the reaction was that I’m “teasing“. But well, here we are. The Open SQL boys are really a hard-working bunch.

The wish was to have a SELECT … FROM subquery in Open SQL. That’s one thing, you can use CTEs for:

    WITH
      +conns AS (
        SELECT carrname, connid, cityfrom, cityto
              FROM spfli
                JOIN scarr ON spfli~carrid = scarr~carrid
              WHERE spfli~carrid = @carrid ),
      +cnts AS (
        SELECT COUNT(*) AS cnt
               FROM +conns )
      SELECT *
             FROM +cnts
               CROSS JOIN +conns
             ORDER BY carrname, connid
             INTO CORRESPONDING FIELDS of TABLE @itab.

The new SQL keyword WITH introduces the definition of one or more CTEs. Each CTE is a kind of subquery that produces a tabular result that can be used as a data source in all subsequent queries of the same WITH statement. In the example, a general table expression +conns (where the + is a mandatory prefix of the name) creates a table of flight connections. A further expression, +cnts, determines the number of entries in the result set of +conns. The closing mainquery combines the result sets of both general table expressions using a cross join (also new in ABAP 7.51).

WITH 
  +cities AS ( 
    SELECT cityfrom AS city 
           FROM spfli 
           WHERE carrid = @carrid 
    UNION DISTINCT 
    SELECT cityto AS city 
           FROM spfli 
           WHERE carrid = @carrid ) 
  SELECT * 
         FROM sgeocity 
         WHERE city IN ( SELECT city 
                                FROM +cities ) 
         INTO TABLE @DATA(result). 

In this example, there is one CTE +cities defining a subquery including a UNION. The result set of the CTE is evaluated as the data source of the subquery of the WHERE condition of the main query of the WITH statement.

The general CTE syntax is as follows:

WITH 
  +cte1[( name1, name2, ... )] AS ( SELECT subquery_clauses ... ), 
  +cte2[( name1, name2, ... )] AS ( SELECT subquery_clauses ... ), 
   ... 
  SELECT mainquery_clauses 
         ...
         INTO ...
       ... 
[ENDWITH]. 

Each WITH statement must be completed by a mainquery that uses at least one of its CTEs as a data source and each CTE must be used in at least one other subsequent query. Up to now a CTE cannot use itself as a data source. WITH can be used as a standalone statement or after the statement OPEN CURSOR. 

The ENDWITH is an ABAP specialty that fulfills the same task as ENDSELECT. If you don’t write in to an internal table behind INTO of the main query, you open a WITH loop that must be closed with ENDWITH.

With  ( name1, name2, … ) you can redefine the column names of the tabular result sets of a CTE, e.g.

WITH 
  +connections AS ( 
    SELECT spfli~carrid, carrname, connid, cityfrom, cityto 
           FROM spfli 
           INNER JOIN scarr 
             ON scarr~carrid = spfli~carrid 
           WHERE spfli~carrid BETWEEN @from_id AND @to_id ), 
  +sum_seats AS ( 
    SELECT carrid, connid, SUM( seatsocc ) AS sum_seats 
           FROM sflight 
           WHERE carrid BETWEEN @from_id AND @to_id 
           GROUP BY carrid, connid ), 
  +result( name, connection, departure, arrival, occupied ) AS ( 
    SELECT carrname, c~connid, cityfrom, cityto, sum_seats 
           FROM +connections AS c 
             INNER JOIN +sum_seats AS s 
               ON c~carrid = s~carrid AND 
                  c~connid = s~connid ) 
  SELECT * 
         FROM +result 
         ORDER BY name, connection 
         INTO TABLE @DATA(result).

The result sets of both general table expressions +connections and +sum_seats are merged in the subquery of the general table expression +result in a join expression. An explicit name list assigns names to the resulting columns. These names are used in the mainquery to sort the results.

With the introduction of WITH, the standalone statement SELECT suddenly lost a bit of its peculiarity. In fact it can be seen as a special case of a mainquery without WITH. Therefore the terminology of queries was generalized in Open SQL: Each language element SELECT implements a query and we distinguish between mainqueries and subqueries.

 

  • A mainquery is either a standalone SELECT statement, the final query of a WITH statement, or the final query of an OPEN CURSOR statement.
  • A subquery is possible in a WHERE condition, after WITH for the definition of a CTE, or as a data source of an INSERT statement.

All queries can be combined with UNION and the most clauses are common for all queries except the ABAP specific INTO that can be used for the mainqueries of a standalone WITH and a standalone SELECT and behind a FETCH only.

 

For more information see WITH.


'SAP Program > ABAP' 카테고리의 다른 글

MCHBH LFGJA LFMON Max 값 select  (0) 2017.10.26
ABAP 7.40 Quick Reference  (0) 2017.10.24
so_object_send를 이용한 mail 전송  (0) 2017.10.11
QM QS24 Call transaction 이용한 조회가 안될경우  (0) 2017.09.13
Smartforms Barcode  (0) 2017.09.01

설정

트랙백

댓글


so_object_send function을 이용하면 sender에 internet email을 지정하여 전송할 수 있다.




FUNCTION zcm_send_mail.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(IS_SENDER) TYPE  ZQMS_038
*"     VALUE(IV_TITLE) TYPE  ZWF_TITLECO
*"     VALUE(IV_RETURN) TYPE  CHAR1 OPTIONAL
*"  EXPORTING
*"     VALUE(EV_RESULT) TYPE  CHAR1
*"     VALUE(EV_ERR_MSG) TYPE  STRING
*"  TABLES
*"      T_RECEIVER TYPE  ZQMY_0001
*"      T_BODY STRUCTURE  W3HTML
*"  EXCEPTIONS
*"      INVALID_USER_ERROR
*"      NO_EMAILID
*"      INVALID_EMPLOYEE_NUMBER
*"      INVALID_MYSINGLEID
*"      INVALID_ID_TYPE
*"      INVALID_WF_OBJECT
*"----------------------------------------------------------------------

  DATA lv_object_hd     TYPE sood1.
  DATA lv_object_type          TYPE sood-objtp.
  DATA lv_originator  TYPE soos1-recextnam,
         lv_origin_type TYPE soos1-recesc.

  DATA lt_objcont       TYPE STANDARD TABLE OF soli WITH HEADER LINE.
  DATA lt_receivers     TYPE STANDARD TABLE OF soos1 WITH HEADER LINE.
  DATA lt_packing_list  TYPE STANDARD TABLE OF soxpl WITH HEADER LINE.
*
  DATAlv_lines     TYPE i,
        lo_ex_system TYPE REF TO cx_ai_system_fault,
        lo_ex_app    TYPE REF TO cx_ai_application_fault.

  CLEAR ev_resultev_err_msg", ls_en_request.

*--------------------------------------------------------------------*
* 0. Check Input Value
*--------------------------------------------------------------------*
  IF t_receiver[] IS INITIAL ).
    ev_err_msg 'Enter mail receiver (required field)'.
    ev_result  'E'.
    EXIT.
  ELSEIF t_body[] IS INITIAL ).
    ev_err_msg 'Enter mail body (required field)'.
    ev_result  'E'.
    EXIT.
  ENDIF.

*  PERFORM check_mailuser USING    is_sender  iv_return
*                         CHANGING ev_err_msg.
*  IF ev_err_msg IS NOT INITIAL.
*    ev_result = c_e.  EXIT.
*  ENDIF.

*--------------------------------------------------------------------*
* 3. Set Mail Body
*--------------------------------------------------------------------*
  CLEAR lv_object_hd.
  lv_object_hd-objla  sy-langu.
  lv_object_hd-objdes iv_title.
  lv_object_hd-objnam 'MESSAGE'.
  lv_object_hd-objsns 'O'.
  lv_object_hd-file_ext 'HTM'.
  lv_object_hd-objpri '1'.
  lv_object_hd-objcp  'X'.

  lv_object_type 'RAW'.

  LOOP AT t_body.

    lt_objcont-line t_body.
    APPEND lt_objcontCLEAR lt_objcont.

  ENDLOOP.

*  READ TABLE t_body INDEX 1.
*  SEARCH t_body FOR '<HTML>' IN CHARACTER MODE STARTING AT 1 ENDING AT 10.
*  IF sy-subrc EQ 0.
*    ls_en_request-header_helper_csvo-b_html_content_check = 'true'.
*  ENDIF.


*--------------------------------------------------------------------*
* 4. Set Recipient Info
*--------------------------------------------------------------------*
*   i_seq_id (필수값) - 일련번호 (0부터 순차적으로 증가)
*   rec_type (필수값) - 수신형태 (t : 수신, c : 참조, b : 비밀참조)
*   rec_addr (필수값) - 수신자메일주소

  CLEARlt_receiverslt_receivers[].
  LOOP AT t_receiver.

*    PERFORM check_mailuser USING    t_receiver  iv_return
*                           CHANGING ev_err_msg.
*    IF ev_err_msg IS NOT INITIAL  AND iv_return IS INITIAL.
*      ev_result = 'E'.
*      EXIT.
*    ENDIF.

    TRANSLATE  t_receiver-emailid TO LOWER CASE.
    lt_receivers-recextnam  t_receiver-emailid.
    lt_receivers-sndart 'INT'.
    lt_receivers-sndpri '1'.
    lt_receivers-recesc 'U'.

    APPEND lt_receiversCLEAR lt_receivers.
  ENDLOOP.

  lv_originator is_sender-emailid.
  lv_origin_type 'U'.

  CHECK ev_result NE 'E'.

*--------------------------------------------------------------------*
* 5. Set Resource Info
*--------------------------------------------------------------------*
*   email    (필수값) - 발신자메일주소
*   locale   (필수값) - 로케일정보 (ko_KR : 한국, 중국 : zh_CN, 일본 : ja_JP, 나머지 : en_US)
*   encoding (필수값) - 메일인코딩정보 (euc-kr 또는 utf-8)

*--------------------------------------------------------------------*
* 6. Send Mail
*--------------------------------------------------------------------*
*************************&&메일을 전송하는 FUNCTION.....

  TRY.

      CALL FUNCTION 'SO_OBJECT_SEND'
        EXPORTING
          object_hd_change           lv_object_hd
          object_type                lv_object_type
          owner                      sy-uname
          originator                 lv_originator
          originator_type            lv_origin_type
        TABLES
          objcont                    lt_objcont
          receivers                  lt_receivers
        EXCEPTIONS
          active_user_not_exist      1
          communication_failure      2
          component_not_available    3
          folder_not_exist           4
          folder_no_authorization    5
          forwarder_not_exist        6
          note_not_exist             7
          object_not_exist           8
          object_not_sent            9
          object_no_authorization    10
          object_type_not_exist      11
          operation_no_authorization 12
          owner_not_exist            13
          parameter_error            14
          substitute_not_active      15
          substitute_not_defined     16
          system_failure             17
          too_much_receivers         18
          user_not_exist             19
          originator_not_exist       20
          x_error                    21.
    CATCH cx_ai_system_fault INTO lo_ex_system.
      ev_result  'E'.
      ev_err_msg lo_ex_system->if_message~get_text).
    CATCH cx_ai_application_fault INTO lo_ex_app.
      ev_result  'E'.
      ev_err_msg lo_ex_app->if_message~get_text).
  ENDTRY.

  IF sy-subrc 0.
    "SO_OBJECT_SEND 사용시에는 commit work 해줘야 함.
    COMMIT WORK.

    ev_result 'S'.
    EXIT.
  ELSE.
    ev_result sy-subrc.
    EXIT.
  ENDIF.

ENDFUNCTION.

'SAP Program > ABAP' 카테고리의 다른 글

ABAP 7.40 Quick Reference  (0) 2017.10.24
CTE Open sql  (0) 2017.10.12
QM QS24 Call transaction 이용한 조회가 안될경우  (0) 2017.09.13
Smartforms Barcode  (0) 2017.09.01
SAP Memory ID 확인  (0) 2017.09.01

설정

트랙백

댓글


MATDOC의 BSTAUS_SG에 따라서 재고유형이 달라짐
           정의되지 않음
A 즉시 출고 가능 => 가용재고
B 품질 검사 
C 보류 재고 반품
D 보류 재고
E 제한 사용
F 재고 이전
G 고객 제공 자재
H 운송
K 고객 위탁(즉시 출고 가능)
L 품질 검사에서 고객 위탁
M 고객 위탁(사용 제한)
N 고객 반환용 포장재(즉시 출고 가능)
O 품질 검사에서 고객 반환용 포장재 
P 고객 반환용 포장재(사용 제한)
Q 공급업체에 제공된 즉시 출고 가능 자재
R 품질 검사에서 공급업체에 제공된 자재
S 공급업체에 제공된 자재 재고(사용 제한)
T 사용 용기
V 소비
W 평가 입고 보류 재고
U 외주를 위한 이전 중 재고(플랜트 간)
X 고객 위탁을 위한 이전 중 재고(플랜트 간)


'SAP Business > MM' 카테고리의 다른 글

MM Movement type 정리  (0) 2018.03.26
MM T-code 실습  (0) 2017.08.18
자재문서 취소시에 전기월이 다르면 취소하지 못하게  (0) 2017.04.11
SAP Reservation and Goods Issue  (0) 2017.03.17
SAP GR 개념 자료  (0) 2017.03.17

설정

트랙백

댓글

  CLEAR bdc_tabbdc_tab[].

  DATAbdc_opts   LIKE ctu_params.
  bdc_opts-dismode 'E'.
  bdc_opts-updmode 'S'.
  bdc_opts-NOBINPT 'X'.

  PERFORM bdc_dynpro USING :
      'SAPMQSDA'            '0100'              'X',
      'BDC_OKCODE'          '/00'               '',
      'QPMK-WERKS'          gs_alv-werks        '',
      'QPMK-MKMNR'          gs_alv-mkmnr        '',
*      'QPMK-GUELTIGAB'      gs_alv-datuv        '',

      'SAPMQSDA'            '0101'              'X',
      'BDC_OKCODE'          '/00'               ''.

  CALL TRANSACTION 'QS24' USING bdc_tab
                      OPTIONS FROM bdc_opts
                      MESSAGES INTO messtab.

'SAP Program > ABAP' 카테고리의 다른 글

CTE Open sql  (0) 2017.10.12
so_object_send를 이용한 mail 전송  (0) 2017.10.11
Smartforms Barcode  (0) 2017.09.01
SAP Memory ID 확인  (0) 2017.09.01
Field-Symbol 관련 예제 프로그램  (0) 2017.08.18

설정

트랙백

댓글