Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

goods movement

Former Member
0 Kudos

Hi Friends,

I would like to know how to generate a goods movement report which has the select-options for material number,(plant & posting date )which are mandatory,movement type,material type,material group.

My output would contain:

plant,material no,description,unit ofmeasure,

openingstocks(qty & amt),goods receipts(qty & amt),goods issues(qty&amt),closing stocks(qty & amt).

i would like to know how to calculate opening stocks(qty and amt)and also gr's(qty and amt) gi's( qty and amt) and closing stocks(qty and amt)

i am new to abap and would appreciate some guidance.

i would appreciate if anybody could throw some light on this issue.

Thanks in advance and sure i will reward points for helpful answers,

Vinayak

6 REPLIES 6

FredericGirod
Active Contributor
0 Kudos

Hi,

You could look for tables : MBEW, MBEWH and MSEG. But that's really not an easy report. You have to check the kind of movment, the SHKZG ... the unit of measure ...

A good start could be to make an SQL trace on MB51, MMBE, MB52 ..

Good luck

Rgd

Frédéric

former_member181962
Active Contributor
0 Kudos

HI Vinayak,

Use the BAPI BAPI_GOODSMVT_GETDETAIL to get the goods movement related data.

You can get almost all the mentioned fields from the tables parameters returned by the bapi.

You have to pass the Material Document number and the year to this BAPI.

You can get these fields from MSEG table.

Pass those values to the BAPI and build an internal table with the data you want and display the data in a report.

Regards,

Ravi

0 Kudos

<b>BAPI_GOODSMVT_GETDETAIL</b>

In this Above Mentioned BAPI,

Please pass this Parameters to the BAPI, So you will get all the Required Data for the Goods Movement, I guess, Probably this will help you to complete the Report or else just go through the Code of the BAPI so that you can get an idea of how he is getting all the related data to it.

the Parameters are:

MATERIALDOCUMENT

MATDOCUMENTYEAR

Thanks,

Satya Krishna.M

Former Member
0 Kudos

hi all...

i m also using BAPI_GOODSMVT_GETDETAIL ...but from this BAPI we can not get Ordered Quantity..

so i want to know how can i get this field ...

its very urgent.

Thanks and Regards

Sohil Shah

ferry_lianto
Active Contributor
0 Kudos

Hi Sohil,

Please use BAPI <b>BAPISDORDER_GETDETAILEDLIST</b> to get the ordered qty.

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

*********************************************************************

  • PROGRAM ID : ZGOODSMVT

  • PROGRAM TITLE : Documented Goods Movements Report *

*

  • DESCRIPTION : This report is required for the production *

  • areas to tract the consumptions and *

  • declarations they have done against a *

  • process order on a detailed level. *

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

  • CHANGE HISTORY LOG *

----


  • MOD. NO.| DATE | NAME | CORRECTION NUMBER | CHANGE REFERENCE #*

----


  • *

  • DESCRIPTION:

*Functionality Change *

----


  • MOD-002 |DD/MM/YYYY| XXXXXX | XXXXXXXXXX *

  • *

  • DESCRIPTION: *

**********************************************************************

  • AUTHOR........ Aveek Ghose

  • DATE WRITTEN.. 15/09/2006

  • R/3 RELEASE... 4.6C

  • =====================================================================*

REPORT ZGOODSMVTAG MESSAGE-ID /glb/rgtptmanuf .

----


  • TYPE POOL DECLARATION FOR ALV REPORT ONLY

----


TYPE-POOLS : slis. "Type Pool for ALV

----


  • SAP tables

----


TABLES:

mseg, " Document Segment: Material

mkpf, " Header: Material Document

lein, " Storage unit header records

aufk, " Order master data

usr02, " Logon data

lagp, " Storage bins

mara, " Material master

mcha, " Batches

t156, " Movement type

t301. " WM Storage Types

----


  • CONSTANTS

----


CONSTANTS: c_a(1) TYPE c VALUE 'A', " value of A

c_x(1) TYPE c VALUE 'X', " value of X

c_l(1) TYPE c VALUE 'L', " value of L

c_r(1) TYPE c VALUE 'R', " value of R

c_h(1) TYPE c VALUE 'H', " value of H

c_s(1) TYPE c VALUE 'S', " value of S

c_01(2) TYPE c VALUE '01', " value of 01

c_02(2) TYPE c VALUE '02', " value of 02

c_03(2) TYPE c VALUE '03', " value of 03

c_04(2) TYPE c VALUE '04', " value of 04

c_05(2) TYPE c VALUE '05', " value of 05

c_06(2) TYPE c VALUE '06', " value of 06

c_07(2) TYPE c VALUE '07', " value of 07

c_08(2) TYPE c VALUE '08', " value of 08

c_09(2) TYPE c VALUE '09', " value of 09

c_10(2) TYPE c VALUE '10', " value of 10

c_11(2) TYPE c VALUE '11', " value of 11

c_12(2) TYPE c VALUE '12', " value of 12

c_13(2) TYPE c VALUE '13', " value of 13

c_14(2) TYPE c VALUE '14', " value of 14

c_15(2) TYPE c VALUE '15', " value of 15

c_16(2) TYPE c VALUE '16', " value of 16

c_17(2) TYPE c VALUE '17', " value of 17

c_18(2) TYPE c VALUE '18', " value of 18

c_19(2) TYPE c VALUE '19', " value of 19

c_20(2) TYPE c VALUE '20', " value of 20

c_21(2) TYPE c VALUE '21', " value of 21

c_22(2) TYPE c VALUE '22', " value of 22

c_23(2) TYPE c VALUE '23', " value of 23

c_24(2) TYPE c VALUE '24', " value of 24

c_25(2) TYPE c VALUE '25', " value of 25

c_26(2) TYPE c VALUE '26', " value of 26

c_27(2) TYPE c VALUE '27', " value of 27

c_28(2) TYPE c VALUE '28', " value of 28

c_29(2) TYPE c VALUE '29', " value of 29

c_30(2) TYPE c VALUE '30', " value of 30

c_31(2) TYPE c VALUE '31', " value of 31

c_32(2) TYPE c VALUE '32', " value of 32

c_33(2) TYPE c VALUE '33', " value of 33

c_34(2) TYPE c VALUE '34', " value of 34

c_35(2) TYPE c VALUE '35', " value of 35

c_36(2) TYPE c VALUE '36', " value of 36

c_37(2) TYPE c VALUE '37', " value of 37

c_38(2) TYPE c VALUE '38', " value of 38

c_39(2) TYPE c VALUE '39', " value of 39

c_40(2) TYPE c VALUE '40', " value of 40

c_41(2) TYPE c VALUE '41', " value of 41

c_42(2) TYPE c VALUE '42', " value of 42

c_43(2) TYPE c VALUE '43', " value of 43

c_44(2) TYPE c VALUE '44', " value of 44

c_45(2) TYPE c VALUE '45', " value of 45

c_46(2) TYPE c VALUE '46', " value of 46

c_mseg TYPE tabname VALUE 'MSEG', " table name MSEG

c_mkpf TYPE tabname VALUE 'MKPF', " table name MKPF

c_ltak TYPE tabname VALUE 'LTAK', " table name LTAK

c_ltap TYPE tabname VALUE 'LTAP', " table name LTAP

c_makt TYPE tabname VALUE 'MAKT', " table name MAKT

c_lein TYPE tabname VALUE 'LEIN'. " table name LEIN

*&----


&

  • TYPES *

*&----


&

  • Type for declaring table I_matdoc

TYPES: BEGIN OF ty_matdoc,

matnr TYPE matnr,

charg TYPE charg_d,

werks TYPE werks_d,

lgort TYPE lgort_d,

bwart TYPE bwart,

sobkz TYPE sobkz,

mblnr TYPE mblnr,

zeile TYPE mblpo,

budat TYPE budat,

erfmg TYPE erfmg,

erfme TYPE erfme,

lgnum TYPE lgnum,

lgtyp TYPE lgtyp,

lgpla TYPE lgpla,

  • Additional fields

insmk TYPE insmk,

aufpl TYPE co_aufpl,

aufnr TYPE aufnr,

bktxt TYPE bktxt,

bldat TYPE bldat,

cpudt TYPE cpudt,

cputm TYPE cputm,

kzbew TYPE kzbew,

lifnr TYPE lifnr,

meins TYPE meins,

menge TYPE menge_d,

mjahr TYPE mjahr,

rsnum TYPE rsnum,

rspos TYPE rspos,

rsart TYPE rsart,

shkzg TYPE shkzg,

usnam TYPE usnam,

vgart TYPE vgart,

xabln TYPE xabln,

tbnum TYPE tbnum,

maktx TYPE maktx,

END OF ty_matdoc,

  • Type for declaring table I_matnr

BEGIN OF ty_matnr,

matnr TYPE matnr,

maktx TYPE maktx,

END OF ty_matnr,

  • Type for declaring table I_mh

BEGIN OF ty_mh,

aufnr TYPE aufnr,

werks TYPE werks,

matnr TYPE matnr,

charg TYPE charg_d,

lgnum TYPE lgnum,

lgpla TYPE lgpla,

lgtyp TYPE lgtyp,

bwart TYPE bwart,

rsnum TYPE rsnum,

rspos TYPE rspos,

rsart TYPE rsart,

lenvw TYPE t331_lenvw,

END OF ty_mh,

  • Type for declaring table I_t331

BEGIN OF ty_t331,

lgnum TYPE lgnum,

lgtyp TYPE lgtyp,

lenvw TYPE t331_lenvw,

END OF ty_t331,

  • Type for declaring table I_detl

BEGIN OF ty_detl,

matnr TYPE matnr,

charg TYPE charg_d,

werks TYPE werks,

lgort TYPE lgort_d,

bwart TYPE bwart,

sobkz TYPE sobkz,

mblnr TYPE mblnr,

zeile TYPE mblpo,

budat TYPE budat,

erfmg TYPE erfmg,

erfme TYPE erfme,

lgtyp TYPE lgtyp,

lgpla TYPE lgpla,

lenum TYPE lenum,

  • Additional fields

maktx TYPE maktx,

insmk TYPE insmk,

aufpl TYPE co_aufpl,

aufnr TYPE aufnr,

bktxt TYPE bktxt,

bldat TYPE bldat,

cpudt TYPE cpudt,

cputm TYPE cputm,

kzbew TYPE kzbew,

lifnr TYPE lifnr,

meins TYPE meins,

menge TYPE menge_d,

mjahr TYPE mjahr,

rsnum TYPE rsnum,

rspos TYPE rspos,

shkzg TYPE shkzg,

usnam TYPE usnam,

vgart TYPE vgart,

xabln TYPE xabln,

tbnum TYPE tbnum,

lgnum TYPE lgnum,

tanum TYPE tanum,

tapos TYPE tapos,

bwlvs TYPE bwlvs,

betyp TYPE lvs_betyp,

benum TYPE lvs_benum,

bestq TYPE bestq,

vltyp TYPE ltap_vltyp,

vlpla TYPE ltap_vlpla,

vlenr TYPE ltap_vlenr,

nltyp TYPE ltap_nltyp,

nlpla TYPE ltap_nlpla,

nlenr TYPE ltap_nlenr,

*Begin of changes Sutapa - May 26, 2003

meins_to TYPE MEINS,

altme TYPE LRMEI,

vsola TYPE LTAP_vsola,

vsolm TYPE LTAP_vsolm,

nsola TYPE LTAP_nsola,

nsolm TYPE LTAP_nsolm,

*End of changes Sutapa - May 26, 2003

color TYPE slis_specialcol_alv OCCURS 3, "for cell color

END OF ty_detl,

*Begin of changes Sutapa - May 26, 2003

  • Type for declaring table I_meins_ltap

BEGIN OF ty_meins_ltap,

lgnum TYPE lgnum,

tanum TYPE tanum,

tapos TYPE tapos,

matnr TYPE matnr,

meins TYPE meins,

END OF ty_meins_ltap.

*End of changes Sutapa - May 26, 2003

*&----


&

  • STRUCTURES *

*&----


&

*Structure to hold variant information

DATA: struct_variant TYPE disvariant.

  • Workarea to hold the header line of i_matdoc

DATA: struct_matdoc TYPE ty_matdoc.

*&----


&

  • INTERNAL TABLES *

*&----


&

*Internal tables to hold material documenmt information

DATA: i_matdoc TYPE STANDARD TABLE OF ty_matdoc WITH HEADER LINE,

i_matdoc_distinct TYPE STANDARD TABLE OF ty_matdoc WITH HEADER

LINE,

*Internal table to hold material description information

i_matnr TYPE STANDARD TABLE OF ty_matnr WITH HEADER LINE,

*Internal table to hold RESB information

i_mh TYPE STANDARD TABLE OF ty_mh WITH HEADER LINE,

*Internal table to hold T331 information

i_t331 TYPE STANDARD TABLE OF ty_t331 WITH HEADER LINE,

*Internal table to hold detail transfer order information

i_detl TYPE STANDARD TABLE OF ty_detl WITH HEADER LINE,

*Internal table to hold output

i_output TYPE STANDARD TABLE OF ty_detl WITH HEADER LINE,

*Internal table for field catalog

i_fcat TYPE slis_t_fieldcat_alv,

*Internal table for sort table

i_sort TYPE slis_t_sortinfo_alv, "Sort parameters

*Internal table for layout

i_layout TYPE slis_layout_alv,

*Internal table for coloring cells

i_col_layout TYPE slis_t_specialcol_alv,

*Begin of changes Sutapa - May 26, 2003

i_meins_ltap TYPE STANDARD TABLE OF ty_meins_ltap WITH HEADER

LINE.

*End of changes Sutapa - May 26, 2003

*&----


&

  • VARIABLES *

*&----


&

DATA: v_repid LIKE sy-repid, " To store program name

v_title(100) TYPE c. " Report title

*&----


&

  • SELECTION SCREEN *

*&----


&

SELECTION-SCREEN: BEGIN OF BLOCK order WITH FRAME TITLE text-001.

PARAMETERS: p_order LIKE mseg-aufnr MEMORY ID ANR OBLIGATORY .

" Process Order

SELECTION-SCREEN: END OF BLOCK order.

SELECTION-SCREEN: BEGIN OF BLOCK component WITH FRAME TITLE text-002.

SELECT-OPTIONS: s_mat FOR mseg-matnr, " Material No.

s_batch FOR mseg-charg, " Batch

s_mvtype FOR mseg-bwart, " Movement type

s_pstdte FOR mkpf-budat, " Posting date

s_user FOR mkpf-usnam, " User

s_strtyp FOR mseg-lgtyp, " Storage type

s_strbin FOR mseg-lgpla, " Storage bin

s_strunt FOR lein-lenum. " Storage unit

SELECTION-SCREEN: END OF BLOCK component.

*&----


&

  • INITIALIZATION *

*&----


&

CLEAR:

  • Internal Tables

i_matdoc,

i_detl,

i_mh,

i_t331,

i_matnr,

i_output,

i_sort,

i_fcat,

i_meins_ltap,

  • Variables

v_repid,

v_title.

  • Refresh Internal Tables

REFRESH: i_matdoc,

i_detl,

i_mh,

i_t331,

i_matnr,

i_output,

i_sort,

i_fcat,

i_meins_ltap.

  • Assign value to v_repid

v_repid = sy-repid.

*&----


&

  • AT SELECTION SCREEN *

*&----


&

*Validation of Process Order

AT SELECTION-SCREEN ON p_order.

PERFORM validate_order.

*Validation of Material

AT SELECTION-SCREEN ON s_mat.

PERFORM validate_material.

*Validation of Batch

AT SELECTION-SCREEN ON s_batch.

PERFORM validate_batch.

*Validation of Movement Type

AT SELECTION-SCREEN ON s_mvtype.

PERFORM validate_movemnttype.

*Validation of User Name

AT SELECTION-SCREEN ON s_user.

PERFORM validate_user.

*Validation of Storage Type

AT SELECTION-SCREEN ON s_strtyp.

PERFORM validate_storagetype.

*Validation of Storage Bin

AT SELECTION-SCREEN ON s_strbin.

PERFORM validate_storagebin.

*Validation of Storage Unit

AT SELECTION-SCREEN ON s_strunt.

PERFORM validate_storageunit.

*&----


&

  • START OF SELECTION *

*&----


&

START-OF-SELECTION.

*&----


&

  • This subroutine retrieves data from MSEG and MKPF

  • tables depending on the selection screen values

  • and modifies the table with Material description.

*&----


&

PERFORM populate_matdoc.

*&----


&

  • This subroutine retrieves data from LTAK and LTAP

  • tables dependingon the selection screen values and

  • populates the table with Transferorder information.

*&----


&

PERFORM populate_detl.

*&----


&

  • This subroutine retrieves data from RESB and T331

  • tables and populates the table with Reservation

  • information.

*&----


&

PERFORM populate_mh.

*&----


&

  • This subroutine retrieves data from T331

  • tables and populates the table with SU non SU managed

  • information.

*&----


&

PERFORM populate_t331.

*&----


&

  • This subroutine modifies anmd creates the final

  • result table.

*&----


&

PERFORM create_output. " To update I_detl

*&----


&

  • END OF SELECTION *

*&----


&

END-OF-SELECTION.

  • The final output is obtained by transferring the necessary fields

  • from table I_DETL to I_OUTPUT.

  • Check if the table I_detl is not initial

IF NOT i_detl[] IS INITIAL.

i_output[] = i_detl[]. " Get the final output

ENDIF.

  • Display the Report Title

CONCATENATE text-003 p_order INTO v_title SEPARATED BY space.

sy-title = v_title.

  • Display the Report in ALV

PERFORM prepare_alv_output. " To display result as alv

&----


*& Form validate_order

&----


  • This subroutine validates the value of process order entered

----


FORM validate_order .

*Check if value is entered for Order.

IF NOT p_order IS INITIAL.

SELECT SINGLE aufnr " Process Order

INTO aufk-aufnr

FROM aufk

WHERE aufnr = p_order.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'PO does not exist'(096).

ENDIF.

ENDIF.

ENDFORM. " validate_order

&----


*& Form validate_material

&----


  • This subroutine validates the value of material entered

----


FORM validate_material .

*Check if value is entered for Material.

IF NOT s_mat IS INITIAL.

SELECT matnr " Material

INTO mara-matnr

UP TO 1 ROWS

FROM mara

WHERE matnr IN s_mat.

ENDSELECT.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'Invalid Material.'(097).

ENDIF.

ENDIF.

ENDFORM. " validate_material

&----


*& Form validate_batch

&----


  • This subroutine validates the value of batch entered

----


FORM validate_batch .

*Check if value is entered for Batch.

IF NOT s_batch IS INITIAL.

SELECT charg " Batch

INTO mcha-charg

UP TO 1 ROWS

FROM mcha

WHERE charg IN s_batch.

ENDSELECT.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'Invalid Batch.'(098).

ENDIF.

ENDIF.

ENDFORM. " validate_batch

&----


*& Form validate_movemnttype

&----


  • This subroutine validates the value of movement type entered

----


FORM validate_movemnttype .

*Check if value is entered for Movement type.

IF NOT s_mvtype IS INITIAL.

SELECT bwart " Movement type

INTO t156-bwart

UP TO 1 ROWS

FROM t156

WHERE bwart IN s_mvtype.

ENDSELECT.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'Invalid Movement type.'(099).

ENDIF.

ENDIF.

ENDFORM. " validate_movemnttype

&----


*& Form validate_user

&----


  • This subroutine validates the value of user name entered

----


FORM validate_user .

IF NOT s_user IS INITIAL.

SELECT bname " User

INTO usr02-bname

UP TO 1 ROWS

FROM usr02

WHERE bname IN s_user.

ENDSELECT.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'Invalid User.'(100).

ENDIF.

ENDIF.

ENDFORM. " validate_user

&----


*& Form validate_storagetype

&----


  • This subroutine validates the value of storage type entered

----


FORM validate_storagetype .

*Check if value is entered for storage type.

IF NOT s_strtyp IS INITIAL.

SELECT lgtyp " storage type

INTO t301-lgtyp

UP TO 1 ROWS

FROM t301

WHERE lgtyp IN s_strtyp.

ENDSELECT.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'Invalid Storage type.'(101).

ENDIF.

ENDIF.

ENDFORM. " validate_storagetype

&----


*& Form validate_storagebin

&----


  • This subroutine validates the value of storage bin entered

----


FORM validate_storagebin .

*Check if value is entered for storage bin.

IF NOT s_strbin IS INITIAL.

SELECT lgpla " storage bin

INTO lagp-lgpla

UP TO 1 ROWS

FROM lagp

WHERE lgpla IN s_strbin.

ENDSELECT.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'Invalid storage bin.'(102).

ENDIF.

ENDIF.

ENDFORM. " validate_storagebin

&----


*& Form validate_storageunit

&----


  • This subroutine validates the value of storage unit entered

----


FORM validate_storageunit .

*Check if value is entered for storage unit.

IF NOT s_strunt IS INITIAL.

SELECT lenum " storageunit

INTO lein-lenum

UP TO 1 ROWS

FROM lein

WHERE lenum IN s_strunt.

ENDSELECT.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE e999 WITH 'Invalid storage unit.'(103).

ENDIF.

ENDIF.

ENDFORM. " validate_storageunit

&----


*& Form populate_matdoc

&----


  • This subroutine retrieves data from MSEG and MKPF tables depending

  • on the selection screen values and modifies the table with Material

  • description.

----


FORM populate_matdoc .

*Retreieve Data from MSEG and MKPF

SELECT a~matnr " Material

a~charg " Batch

a~werks " Plant

a~lgort " Storage Location

a~bwart " Movement type

a~sobkz " Special stock indicator

a~mblnr " Material document no.

a~zeile " Item in material document

b~budat " Posting date

a~erfmg " Quantity in entry unit

a~erfme " Entry unit

a~lgnum " Warehouse no.

a~lgtyp " Storage type

a~lgpla " Storage bin

a~insmk " Stock type

a~aufpl " Routing no.

a~aufnr " Process order

b~bktxt " Document header text

b~bldat " Document date

b~cpudt " Entry date

b~cputm " Entry time

a~kzbew " Movement indicator

a~lifnr " Vendor

a~meins " Base unit of measure

a~menge " Base quantity

a~mjahr " Material document year

a~rsnum " Reservation no.

a~rspos " Reservation item

a~rsart " Record type

a~shkzg " Debit / Credit indicator

b~usnam " User Name

b~vgart " Trans. / Event type

b~xabln " Goods Receipt/Issue Slip Number

a~tbnum " Transfer Requirement Number

INTO TABLE i_matdoc

FROM mseg AS a INNER JOIN mkpf AS b

ON amblnr = bmblnr

AND amjahr = bmjahr

WHERE a~aufnr = p_order "process order

AND a~matnr IN s_mat

AND a~charg IN s_batch

AND a~bwart IN s_mvtype

AND b~budat IN s_pstdte

AND b~usnam IN s_user.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE i999 WITH 'No data found!'(104).

LEAVE LIST-PROCESSING.

ELSE.

  • Sort the table I_MATDOC

SORT i_matdoc BY matnr.

  • Create a table i_matdoc_disctinct identical to i_matdoc

i_matdoc_distinct[] = i_matdoc[].

DELETE ADJACENT DUPLICATES FROM i_matdoc_distinct COMPARING matnr.

ENDIF.

*Check if the table i_matdoc is not initial

IF NOT i_matdoc_distinct[] IS INITIAL.

  • Retrieve Material Description from MAKT

SELECT a~matnr " Material no.

a~maktx " Material description

INTO TABLE i_matnr

FROM makt AS a

FOR ALL ENTRIES IN i_matdoc_distinct

WHERE a~matnr = i_matdoc_distinct-matnr

AND a~spras = sy-langu.

IF sy-subrc = 0.

  • Sort the table I_MATNR

SORT i_matnr BY matnr.

ENDIF.

  • Update Material Description from MAKT

CLEAR i_matdoc.

LOOP AT i_matdoc.

IF i_matdoc-maktx = space.

CLEAR struct_matdoc.

struct_matdoc = i_matdoc.

AT NEW matnr.

CLEAR i_matnr.

READ TABLE i_matnr WITH KEY matnr = struct_matdoc-matnr BINARY

SEARCH.

IF sy-subrc = 0. " If reading is successful

*Modify material description for row(s) corresponding to the material

*no.

struct_matdoc-maktx = i_matnr-maktx.

ENDIF.

ENDAT.

i_matdoc-maktx = struct_matdoc-maktx.

MODIFY i_matdoc TRANSPORTING maktx WHERE matnr = i_matnr-matnr.

CLEAR i_matnr.

ENDIF.

CLEAR i_matdoc.

ENDLOOP.

ENDIF.

  • Free the I_matdoc_distinct table.

FREE I_MATDOC_DISTINCT.

ENDFORM. " populate_matdoc

&----


*& Form populate_detl

&----


  • This subroutine retrieves data from LTAK and LTAP tables depending

  • on the selection screen values and populates the table with Transfer

  • order information.

----


FORM populate_detl .

*Check if the table i_matdoc is not initial

IF NOT i_matdoc[] IS INITIAL.

  • Retreieve Transfer Order from LTAK and LTAP

SELECT a~mblnr " Material document no.

a~mjahr " Material document year

a~lgnum " Warehouse no.

a~tanum " Transfer order no.

b~matnr " Material no.

b~tapos " Transfer order item

a~bwlvs " Movement type for WM

a~betyp " Requirement type

a~benum " Requirement tracking no.

b~bestq " Stock Category in the WM

b~vltyp " Source storage type

b~vlpla " Source storage bin

b~vlenr " Source storage unit

b~nltyp " Destination storage type

b~nlpla " Destination storage bin

b~nlenr " Destination storage unit

  • Begin of Changes Sutapa, May 26, 2003

b~altme

" Alternative Unit of Measure for Stockkeeping Unit

b~vsola " Source target quantity in alternate unit

b~vsolm " Source target quantity in stockkeeping unit

b~nsola " Destination target quantity in alternative unit

b~nsolm " Destination target quantity in stockkeeping unit

  • End of Changes Sutapa, May 26, 2003

INTO CORRESPONDING FIELDS OF TABLE i_detl

FROM ltak AS a INNER JOIN ltap AS b

ON algnum = blgnum

AND atanum = btanum

FOR ALL ENTRIES IN i_matdoc

WHERE a~mblnr = i_matdoc-mblnr

AND a~mjahr = i_matdoc-mjahr

AND b~matnr = i_matdoc-matnr.

IF sy-subrc = 0.

  • Sort the table I_DETL

SORT i_detl BY mblnr mjahr matnr.

ENDIF.

Perform Populate_detl_meins.

ENDIF.

ENDFORM. " populate_detl

&----


*& Form populate_mh

&----


  • This subroutine retrieves data from RESB and T331 tables

  • and populates the table with Reservation information.

----


FORM populate_mh .

*Check if the table i_matdoc is not initial

IF NOT i_matdoc[] IS INITIAL.

  • Retreieve Transfer Order from RESB

SELECT a~aufnr " Process order

a~werks " Plant

a~matnr " Material no.

a~charg " Batch

a~lgnum " Warehouse no.

a~lgpla " Storage bin

a~lgtyp " Storage type

a~bwart " Movement type

a~rsnum " Reservation no.

a~rspos " Reservation item

a~rsart " Record type

b~lenvw " Indicator - SU Managed

INTO TABLE i_mh

FROM resb AS a INNER JOIN t331 AS b

ON algnum = blgnum

AND algtyp = blgtyp

FOR ALL ENTRIES IN i_matdoc

WHERE a~rsnum = i_matdoc-rsnum

AND a~rspos = i_matdoc-rspos

AND a~rsart = i_matdoc-rsart

AND a~aufnr = i_matdoc-aufnr

AND a~matnr = i_matdoc-matnr.

IF sy-subrc = 0.

  • Sort the table

SORT i_mh BY rsnum rspos rsart matnr.

ENDIF.

ENDIF.

ENDFORM. " populate_mh

&----


*& Form populate_t331

&----


  • This subroutine retrieves data from T331

  • tables and populates the table with SU non SU managed

  • information.

*&----


&

FORM populate_t331 .

*Check if the table i_matdoc is not initial

IF NOT i_matdoc[] IS INITIAL.

  • Retreieve Transfer Order from T331

SELECT a~lgnum

a~lgtyp

a~lenvw

INTO TABLE i_t331

FROM t331 AS a

FOR ALL ENTRIES IN i_matdoc

WHERE a~lgnum = i_matdoc-lgnum

AND a~lgtyp = i_matdoc-lgtyp.

IF sy-subrc = 0.

  • Sort the table

SORT i_t331 BY lgnum lgtyp.

ENDIF.

ENDIF.

ENDFORM. " populate_t331

&----


*& Form create_output

&----


  • This subroutine modifies anmd creates the final result table.

  • Depending on different conditions the i_detl table is modified to hold

  • Material Document Information, Transfer Order inmformation along with

  • all goods issues, goods receipts, items genearted with reference to a

*reservation and for stocks which is Storage Unit managed and

*non-storage

  • unit managed.

----


FORM create_output .

CLEAR i_matdoc.

LOOP AT i_matdoc.

IF i_matdoc-rsnum <> space AND i_matdoc-rspos <> space AND

i_matdoc-tbnum <> space.

CLEAR i_detl.

READ TABLE i_detl WITH KEY mblnr = i_matdoc-mblnr

mjahr = i_matdoc-mjahr

matnr = i_matdoc-matnr BINARY SEARCH.

IF sy-subrc = 0. " If reading is successful

  • Modify row(s) corresponding to the material document to I_DETL

PERFORM modify_i_detl.

ELSE. " If reading is not successful

  • Add a row corresponding to the material document to I_DETL

PERFORM add_i_detl.

ENDIF.

ELSEIF i_matdoc-rsnum <> space AND i_matdoc-rspos <> space AND

i_matdoc-tbnum = space.

  • Read the Reservation data from I_MH

CLEAR i_mh.

READ TABLE i_mh WITH KEY rsnum = i_matdoc-rsnum

rspos = i_matdoc-rspos

rsart = i_matdoc-rsart

matnr = i_matdoc-matnr BINARY SEARCH.

IF sy-subrc = 0. " If reading is successful

IF i_mh-lenvw = c_x. " SU Managed

CLEAR i_detl.

READ TABLE i_detl WITH KEY mblnr = i_matdoc-mblnr

mjahr = i_matdoc-mjahr

matnr = i_matdoc-matnr BINARY

SEARCH.

IF sy-subrc = 0. " If reading is successful

*Modify row(s) corresponding to the material document to I_DETL

PERFORM modify_i_detl.

ELSE. " If reading is not successful

  • Add a row corresponding to the material document to I_DETL

PERFORM add_i_detl.

ENDIF. " Reading of I_DETL

ELSE. " Not SU Manged

PERFORM add_i_detl_sp.

ENDIF. " checking of C_X

ELSE. " Reading of i_MH not succesful

CLEAR i_detl.

READ TABLE i_detl WITH KEY mblnr = i_matdoc-mblnr

mjahr = i_matdoc-mjahr

matnr = i_matdoc-matnr BINARY SEARCH.

IF sy-subrc = 0. " If reading is successful

  • Modify row(s) corresponding to the material document to I_DETL

PERFORM modify_i_detl.

ELSE. " If reading is not successful

  • Add a row corresponding to the material document to I_DETL

PERFORM add_i_detl.

ENDIF. " Reading of I_DETL

ENDIF. " Reading of I_MH

ELSE.

IF i_matdoc-rsnum = space AND i_matdoc-rspos = space .

IF i_matdoc-tbnum <> space.

CLEAR i_detl.

READ TABLE i_detl WITH KEY mblnr = i_matdoc-mblnr

mjahr = i_matdoc-mjahr

matnr = i_matdoc-matnr BINARY

SEARCH.

IF sy-subrc = 0. " If reading is successful

*Modify row(s) corresponding to the material document to I_DETL

PERFORM modify_i_detl.

ELSE. " If reading is not successful

  • Check for SU managed or not in the table i_t331

CLEAR i_t331.

READ TABLE i_t331 WITH KEY lgnum = i_matdoc-lgnum

lgtyp = i_matdoc-lgtyp BINARY

SEARCH.

IF i_t331-lenvw = c_x. " SU Managed

PERFORM add_i_detl.

ELSE. " Non SU Managed

PERFORM add_i_detl_sp.

ENDIF.

ENDIF. " Reading of I_DETL

ELSE. " I_MATDOC-TBNUM is space

PERFORM add_i_detl_sp.

ENDIF.

ENDIF.

ENDIF.

  • Clear the header line.

CLEAR i_matdoc.

ENDLOOP.

  • Delete rows for which the Material document item has no value

DELETE i_detl WHERE zeile = space.

IF NOT s_strtyp IS INITIAL.

*Delete rows from internal table not pertaining to the Storage Type

*passed

DELETE i_detl WHERE NOT lgtyp IN s_strtyp.

ENDIF.

IF NOT s_strbin IS INITIAL.

*Delete rows from internal table not pertaining to the Storage Bin

*passed

DELETE i_detl WHERE NOT lgpla IN s_strbin.

ENDIF.

IF NOT s_strunt IS INITIAL.

*Delete rows from internal table not pertaining to the Storage Unit

*number passed

DELETE i_detl WHERE NOT lenum IN s_strunt.

ENDIF.

  • Change the sign for Quantity depending whether debit / credit

LOOP AT i_detl.

IF i_detl-shkzg = c_h . " For credit

i_detl-erfmg = - i_detl-erfmg.

i_detl-menge = - i_detl-menge.

MODIFY i_detl TRANSPORTING erfmg menge.

ENDIF.

CLEAR i_detl.

ENDLOOP.

ENDFORM . " create_output

&----


*& Form modify_i_detl

&----


  • This subroutine modifies row(s) corresponding to material document

----


FORM modify_i_detl .

  • Modify row(s) corresponding to the material document to I_DETL

  • Begin of Changes made by Sutapa May 26, 2003

DATA : l_index TYPE i.

CLEAR: l_index.

l_index = 1.

CLEAR i_detl.

LOOP AT i_detl.

IF i_detl-mblnr = i_matdoc-mblnr AND i_detl-mjahr = i_matdoc-mjahr

AND i_detl-matnr = i_matdoc-matnr.

  • End of Changes made by Sutapa May 26, 2003

i_detl-matnr = i_matdoc-matnr.

i_detl-charg = i_matdoc-charg.

i_detl-werks = i_matdoc-werks.

i_detl-lgort = i_matdoc-lgort.

i_detl-bwart = i_matdoc-bwart.

i_detl-sobkz = i_matdoc-sobkz.

i_detl-mblnr = i_matdoc-mblnr.

i_detl-zeile = i_matdoc-zeile.

i_detl-budat = i_matdoc-budat.

  • Begin of Changes made by Sutapa May 26, 2003

  • i_detl-erfmg = i_matdoc-erfmg.

  • i_detl-erfme = i_matdoc-erfme.

  • IF i_matdoc-shkzg = c_h.

  • i_detl-lgtyp = i_detl-vltyp.

  • i_detl-lgpla = i_detl-vlpla.

  • i_detl-lenum = i_detl-vlenr.

  • ELSE.

  • IF i_matdoc-shkzg = c_s.

  • i_detl-lgtyp = i_detl-nltyp.

  • i_detl-lgpla = i_detl-nlpla.

  • i_detl-lenum = i_detl-nlenr.

  • ENDIF. " checking of C-s

  • ENDIF.

IF i_matdoc-shkzg = c_h.

i_detl-erfmg = i_detl-vsola.

i_detl-erfme = i_detl-altme. " Unit in Alternative Unit of entry

i_detl-lgtyp = i_detl-vltyp.

i_detl-lgpla = i_detl-vlpla.

i_detl-lenum = i_detl-vlenr.

i_detl-meins = i_detl-meins_to.

i_detl-menge = i_detl-vsolm.

ELSE.

IF i_matdoc-shkzg = c_s.

i_detl-erfmg = i_detl-nsola.

i_detl-erfme = i_detl-altme.

" Unit in Alternative Unit of entry

i_detl-lgtyp = i_detl-nltyp.

i_detl-lgpla = i_detl-nlpla.

i_detl-lenum = i_detl-nlenr.

i_detl-meins = i_detl-meins_to.

i_detl-menge = i_detl-nsolm.

ENDIF. " checking of C-s

ENDIF.

  • End of Changes made by Sutapa May 26, 2003

  • Additional fields

i_detl-maktx = i_matdoc-maktx.

i_detl-insmk = i_matdoc-insmk.

i_detl-aufnr = i_matdoc-aufnr.

i_detl-aufpl = i_matdoc-aufpl.

i_detl-bktxt = i_matdoc-bktxt.

i_detl-bldat = i_matdoc-bldat.

i_detl-cpudt = i_matdoc-cpudt.

i_detl-cputm = i_matdoc-cputm.

i_detl-kzbew = i_matdoc-kzbew.

i_detl-lifnr = i_matdoc-lifnr.

  • Begin of Changes made by Sutapa May 26, 2003

  • i_detl-meins = i_matdoc-meins.

  • i_detl-menge = i_matdoc-menge.

  • End of Changes made by Sutapa May 26, 2003

i_detl-mjahr = i_matdoc-mjahr.

i_detl-rsnum = i_matdoc-rsnum.

i_detl-rspos = i_matdoc-rspos.

i_detl-shkzg = i_matdoc-shkzg.

i_detl-usnam = i_matdoc-usnam.

i_detl-vgart = i_matdoc-vgart.

i_detl-xabln = i_matdoc-xabln.

i_detl-tbnum = i_matdoc-tbnum.

  • Begin of Changes made by Sutapa May 26, 2003

*MODIFY i_detl TRANSPORTING matnr charg werks lgort bwart sobkz mblnr

*zeile budat erfmg erfme lgtyp lgpla lenum lgtyp lgpla

*lenum maktx insmk aufnr aufpl bktxt bldat cpudt cputm kzbew lifnr meins

*menge mjahr rsnum rspos shkzg usnam vgart xabln

  • WHERE mblnr = i_matdoc-mblnr

  • AND mjahr = i_matdoc-mjahr

  • AND matnr = i_matdoc-matnr.

MODIFY i_detl index l_index TRANSPORTING matnr charg werks lgort

bwart sobkz mblnr zeile budat erfmg erfme lgtyp lgpla lenum lgtyp

lgpla

lenum maktx insmk aufnr aufpl bktxt bldat cpudt cputm kzbew lifnr

meins menge mjahr rsnum rspos shkzg usnam vgart xabln.

ENDIF.

l_index = l_index + 1.

CLEAR i_detl.

ENDLOOP.

  • End of Changes made by Sutapa May 26, 2003

ENDFORM. " modify_i_detl

&----


*& Form add_i_detl

&----


  • This subroutine adds row(s) corresponding to material document

----


FORM add_i_detl .

  • Add a row corresponding to the material document to I_DETL

i_detl-matnr = i_matdoc-matnr.

i_detl-charg = i_matdoc-charg.

i_detl-lgort = i_matdoc-lgort.

i_detl-werks = i_matdoc-werks.

i_detl-bwart = i_matdoc-bwart.

i_detl-sobkz = i_matdoc-sobkz.

i_detl-mblnr = i_matdoc-mblnr.

i_detl-zeile = i_matdoc-zeile.

i_detl-budat = i_matdoc-budat.

i_detl-erfmg = i_matdoc-erfmg.

i_detl-erfme = i_matdoc-erfme.

i_detl-lgtyp = text-108. " Err

i_detl-lgpla = text-108. " Err

i_detl-lenum = text-109. " Err

  • Additional fields

i_detl-maktx = i_matdoc-maktx.

i_detl-insmk = i_matdoc-insmk.

i_detl-aufnr = i_matdoc-aufnr.

i_detl-aufpl = i_matdoc-aufpl.

i_detl-bktxt = i_matdoc-bktxt.

i_detl-bldat = i_matdoc-bldat.

i_detl-cpudt = i_matdoc-cpudt.

i_detl-cputm = i_matdoc-cputm.

i_detl-kzbew = i_matdoc-kzbew.

i_detl-lifnr = i_matdoc-lifnr.

i_detl-meins = i_matdoc-meins.

i_detl-menge = i_matdoc-menge.

i_detl-mjahr = i_matdoc-mjahr.

i_detl-rsnum = i_matdoc-rsnum.

i_detl-rspos = i_matdoc-rspos.

i_detl-shkzg = i_matdoc-shkzg.

i_detl-usnam = i_matdoc-usnam.

i_detl-vgart = i_matdoc-vgart.

i_detl-xabln = i_matdoc-xabln.

i_detl-lgnum = space.

i_detl-tanum = space.

i_detl-tapos = space.

i_detl-bwlvs = space.

i_detl-betyp = space.

i_detl-benum = space.

i_detl-bestq = space.

i_detl-vltyp = space.

i_detl-vlpla = space.

i_detl-vlenr = space.

i_detl-nltyp = space.

i_detl-nlpla = space.

i_detl-nlenr = space.

  • Append to the I_DETL table

APPEND i_detl.

ENDFORM. " add_i_detl

&----


*& Form add_i_detl_sp

&----


  • This subroutine adds a row corresponding to the material document

  • with Storage Unit as space

----


FORM add_i_detl_sp .

*Add a row corresponding to the material document to I_DETL with Storage

*Unit as space

i_detl-matnr = i_matdoc-matnr.

i_detl-charg = i_matdoc-charg.

i_detl-lgort = i_matdoc-lgort.

i_detl-werks = i_matdoc-werks.

i_detl-bwart = i_matdoc-bwart.

i_detl-sobkz = i_matdoc-sobkz.

i_detl-mblnr = i_matdoc-mblnr.

i_detl-zeile = i_matdoc-zeile.

i_detl-budat = i_matdoc-budat.

i_detl-erfmg = i_matdoc-erfmg.

i_detl-erfme = i_matdoc-erfme.

i_detl-lgtyp = i_matdoc-lgtyp.

i_detl-lgpla = i_matdoc-lgpla.

i_detl-lenum = space.

  • Additional fields

i_detl-maktx = i_matdoc-maktx.

i_detl-insmk = i_matdoc-insmk.

i_detl-aufnr = i_matdoc-aufnr.

i_detl-aufpl = i_matdoc-aufpl.

i_detl-bktxt = i_matdoc-bktxt.

i_detl-bldat = i_matdoc-bldat.

i_detl-cpudt = i_matdoc-cpudt.

i_detl-cputm = i_matdoc-cputm.

i_detl-kzbew = i_matdoc-kzbew.

i_detl-lifnr = i_matdoc-lifnr.

i_detl-meins = i_matdoc-meins.

i_detl-menge = i_matdoc-menge.

i_detl-mjahr = i_matdoc-mjahr.

i_detl-rsnum = i_matdoc-rsnum.

i_detl-rspos = i_matdoc-rspos.

i_detl-shkzg = i_matdoc-shkzg.

i_detl-usnam = i_matdoc-usnam.

i_detl-vgart = i_matdoc-vgart.

i_detl-xabln = i_matdoc-xabln.

i_detl-lgnum = space.

i_detl-tanum = space.

i_detl-tapos = space.

i_detl-bwlvs = space.

i_detl-betyp = space.

i_detl-benum = space.

i_detl-bestq = space.

i_detl-vltyp = space.

i_detl-vlpla = space.

i_detl-vlenr = space.

i_detl-nltyp = space.

i_detl-nlpla = space.

i_detl-nlenr = space.

  • Append to the I_DETL table

APPEND i_detl.

  • Sort the I_DETL table

SORT i_detl BY mblnr.

ENDFORM. " add_i_detl_sp

&----


*& Form prepare_alv_output

&----


  • This subroutine preapres the ALV output

----


FORM prepare_alv_output .

*Build up fieldcatalog for the fields to be displayed

IF NOT i_output[] IS INITIAL.

PERFORM sub_fcat_build. " Build the field catalog

ELSE.

MESSAGE i999 WITH 'No records found to be displayed'(106).

LEAVE LIST-PROCESSING.

ENDIF.

*Build up keyinfo for the fields to be displayed

PERFORM sortinfo_build.

*Build up layoutinfo for the fields to be displayed

PERFORM layout_build USING i_layout.

*Build up Variant information for the fields to be displayed

PERFORM varinfo_build.

  • Check if the Field Catalog internal Table is not empty

IF NOT i_fcat[] IS INITIAL.

  • Call ALV Grid Viewer

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

is_layout = i_layout

it_fieldcat = i_fcat

it_sort = i_sort

i_default = c_x

i_save = c_a

is_variant = struct_variant

TABLES

t_outtab = i_output

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • Issue error message and stop processing

MESSAGE i999 WITH 'Error in ALV Function'(107).

LEAVE LIST-PROCESSING.

ENDIF.

ENDIF.

ENDFORM. " prepare_alv_output

&----


*& Form sub_fcat_build

&----


  • This subroutine builds the field catalog

----


FORM sub_fcat_build .

DATA : l_tabname1 TYPE tabname, "table name

l_tabname2 TYPE tabname, "table name

l_tabname3 TYPE tabname, "table name

l_tabname4 TYPE tabname, "table name

l_tabname5 TYPE tabname, "table name

l_tabname6 TYPE tabname, "table name

l_field1 TYPE fieldname, "field name

l_field2 TYPE fieldname, "field name

l_field3 TYPE fieldname, "field name

l_field4 TYPE fieldname, "field name

l_field5 TYPE fieldname, "field name

l_field6 TYPE fieldname, "field name

l_field7 TYPE fieldname, "field name

l_field8 TYPE fieldname, "field name

l_field9 TYPE fieldname, "field name

l_field10 TYPE fieldname, "field name

l_field11 TYPE fieldname, "field name

l_field12 TYPE fieldname, "field name

l_field13 TYPE fieldname, "field name

l_field14 TYPE fieldname, "field name

l_field15 TYPE fieldname, "field name

l_field16 TYPE fieldname, "field name

l_field17 TYPE fieldname, "field name

l_field18 TYPE fieldname, "field name

l_field19 TYPE fieldname, "field name

l_field20 TYPE fieldname, "field name

l_field21 TYPE fieldname, "field name

l_field22 TYPE fieldname, "field name

l_field23 TYPE fieldname, "field name

l_field24 TYPE fieldname, "field name

l_field25 TYPE fieldname, "field name

l_field26 TYPE fieldname, "field name

l_field27 TYPE fieldname, "field name

l_field28 TYPE fieldname, "field name

l_field29 TYPE fieldname, "field name

l_field30 TYPE fieldname, "field name

l_field31 TYPE fieldname, "field name

l_field32 TYPE fieldname, "field name

l_field33 TYPE fieldname, "field name

l_field34 TYPE fieldname, "field name

l_field35 TYPE fieldname, "field name

l_field36 TYPE fieldname, "field name

l_field37 TYPE fieldname, "field name

l_field38 TYPE fieldname, "field name

l_field39 TYPE fieldname, "field name

l_field40 TYPE fieldname, "field name

l_field41 TYPE fieldname, "field name

l_field42 TYPE fieldname, "field name

l_field43 TYPE fieldname, "field name

l_field44 TYPE fieldname, "field name

l_field45 TYPE fieldname, "field name

l_field46 TYPE fieldname, "field name

l_sycucol01 TYPE sycucol, "current column

l_sycucol02 TYPE sycucol, "current column

l_sycucol03 TYPE sycucol, "current column

l_sycucol04 TYPE sycucol, "current column

l_sycucol05 TYPE sycucol, "current column

l_sycucol06 TYPE sycucol, "current column

l_sycucol07 TYPE sycucol, "current column

l_sycucol08 TYPE sycucol, "current column

l_sycucol09 TYPE sycucol, "current column

l_sycucol10 TYPE sycucol, "current column

l_sycucol11 TYPE sycucol, "current column

l_sycucol12 TYPE sycucol, "current column

l_sycucol13 TYPE sycucol, "current column

l_sycucol14 TYPE sycucol, "current column

l_sycucol15 TYPE sycucol, "current column

l_sycucol16 TYPE sycucol, "current column

l_sycucol17 TYPE sycucol, "current column

l_sycucol18 TYPE sycucol, "current column

l_sycucol19 TYPE sycucol, "current column

l_sycucol20 TYPE sycucol, "current column

l_sycucol21 TYPE sycucol, "current column

l_sycucol22 TYPE sycucol, "current column

l_sycucol23 TYPE sycucol, "current column

l_sycucol24 TYPE sycucol, "current column

l_sycucol25 TYPE sycucol, "current column

l_sycucol26 TYPE sycucol, "current column

l_sycucol27 TYPE sycucol, "current column

l_sycucol28 TYPE sycucol, "current column

l_sycucol29 TYPE sycucol, "current column

l_sycucol30 TYPE sycucol, "current column

l_sycucol31 TYPE sycucol, "current column

l_sycucol32 TYPE sycucol, "current column

l_sycucol33 TYPE sycucol, "current column

l_sycucol34 TYPE sycucol, "current column

l_sycucol35 TYPE sycucol, "current column

l_sycucol36 TYPE sycucol, "current column

l_sycucol37 TYPE sycucol, "current column

l_sycucol38 TYPE sycucol, "current column

l_sycucol39 TYPE sycucol, "current column

l_sycucol40 TYPE sycucol, "current column

l_sycucol41 TYPE sycucol, "current column

l_sycucol42 TYPE sycucol, "current column

l_sycucol43 TYPE sycucol, "current column

l_sycucol44 TYPE sycucol, "current column

l_sycucol45 TYPE sycucol, "current column

l_sycucol46 TYPE sycucol, "current column

l_txt1 TYPE reptxt, "header text

l_txt2 TYPE reptxt, "header text

l_txt3 TYPE reptxt, "header text

l_txt4 TYPE reptxt, "header text

l_txt5 TYPE reptxt, "header text

l_txt6 TYPE reptxt, "header text

l_txt7 TYPE reptxt, "header text

l_txt8 TYPE reptxt, "header text

l_txt9 TYPE reptxt, "header text

l_txt10 TYPE reptxt, "header text

l_txt11 TYPE reptxt, "header text

l_txt12 TYPE reptxt, "header text

l_txt13 TYPE reptxt, "header text

l_txt14 TYPE reptxt, "header text

l_txt15 TYPE reptxt, "header text

l_txt16 TYPE reptxt, "header text

l_txt17 TYPE reptxt, "header text

l_txt18 TYPE reptxt, "header text

l_txt19 TYPE reptxt, "header text

l_txt20 TYPE reptxt, "header text

l_txt21 TYPE reptxt, "header text

l_txt22 TYPE reptxt, "header text

l_txt23 TYPE reptxt, "header text

l_txt24 TYPE reptxt, "header text

l_txt25 TYPE reptxt, "header text

l_txt26 TYPE reptxt, "header text

l_txt27 TYPE reptxt, "header text

l_txt28 TYPE reptxt, "header text

l_txt29 TYPE reptxt, "header text

l_txt30 TYPE reptxt, "header text

l_txt31 TYPE reptxt, "header text

l_txt32 TYPE reptxt, "header text

l_txt33 TYPE reptxt, "header text

l_txt34 TYPE reptxt, "header text

l_txt35 TYPE reptxt, "header text

l_txt36 TYPE reptxt, "header text

l_txt37 TYPE reptxt, "header text

l_txt38 TYPE reptxt, "header text

l_txt39 TYPE reptxt, "header text

l_txt40 TYPE reptxt, "header text

l_txt41 TYPE reptxt, "header text

l_txt42 TYPE reptxt, "header text

l_txt43 TYPE reptxt, "header text

l_txt44 TYPE reptxt, "header text

l_txt45 TYPE reptxt, "header text

l_txt46 TYPE reptxt, "header text

l_sel_ltxt1 TYPE reptxt, "header text

l_sel_ltxt2 TYPE reptxt, "header text

l_sel_ltxt3 TYPE reptxt, "header text

l_sel_ltxt4 TYPE reptxt, "header text

l_sel_ltxt5 TYPE reptxt, "header text

l_sel_ltxt6 TYPE reptxt, "header text

l_sel_ltxt7 TYPE reptxt, "header text

l_sel_ltxt8 TYPE reptxt, "header text

l_sel_ltxt9 TYPE reptxt, "header text

l_sel_ltxt10 TYPE reptxt, "header text

l_sel_ltxt11 TYPE reptxt, "header text

l_sel_ltxt12 TYPE reptxt, "header text

l_sel_ltxt13 TYPE reptxt, "header text

l_sel_ltxt14 TYPE reptxt, "header text

l_sel_ltxt15 TYPE reptxt, "header text

l_sel_ltxt16 TYPE reptxt, "header text

l_sel_ltxt17 TYPE reptxt, "header text

l_sel_ltxt18 TYPE reptxt, "header text

l_sel_ltxt19 TYPE reptxt, "header text

l_sel_ltxt20 TYPE reptxt, "header text

l_sel_ltxt21 TYPE reptxt, "header text

l_sel_ltxt22 TYPE reptxt, "header text

l_sel_ltxt23 TYPE reptxt, "header text

l_sel_ltxt24 TYPE reptxt, "header text

l_sel_ltxt25 TYPE reptxt, "header text

l_sel_ltxt26 TYPE reptxt, "header text

l_sel_ltxt27 TYPE reptxt, "header text

l_sel_ltxt28 TYPE reptxt, "header text

l_sel_ltxt29 TYPE reptxt, "header text

l_sel_ltxt30 TYPE reptxt, "header text

l_sel_ltxt31 TYPE reptxt, "header text

l_sel_ltxt32 TYPE reptxt, "header text

l_sel_ltxt33 TYPE reptxt, "header text

l_sel_ltxt34 TYPE reptxt, "header text

l_sel_ltxt35 TYPE reptxt, "header text

l_sel_ltxt36 TYPE reptxt, "header text

l_sel_ltxt37 TYPE reptxt, "header text

l_sel_ltxt38 TYPE reptxt, "header text

l_sel_ltxt39 TYPE reptxt, "header text

l_sel_ltxt40 TYPE reptxt, "header text

l_sel_ltxt41 TYPE reptxt, "header text

l_sel_ltxt42 TYPE reptxt, "header text

l_sel_ltxt43 TYPE reptxt, "header text

l_sel_ltxt44 TYPE reptxt, "header text

l_sel_ltxt45 TYPE reptxt, "header text

l_sel_ltxt46 TYPE reptxt, "header text

l_sel_mtxt1 TYPE reptxt, "header text

l_sel_mtxt2 TYPE reptxt, "header text

l_sel_mtxt3 TYPE reptxt, "header text

l_sel_mtxt4 TYPE reptxt, "header text

l_sel_mtxt5 TYPE reptxt, "header text

l_sel_mtxt6 TYPE reptxt, "header text

l_sel_mtxt7 TYPE reptxt, "header text

l_sel_mtxt8 TYPE reptxt, "header text

l_sel_mtxt9 TYPE reptxt, "header text

l_sel_mtxt10 TYPE reptxt, "header text

l_sel_mtxt11 TYPE reptxt, "header text

l_sel_mtxt12 TYPE reptxt, "header text

l_sel_mtxt13 TYPE reptxt, "header text

l_sel_mtxt14 TYPE reptxt, "header text

l_sel_mtxt15 TYPE reptxt, "header text

l_sel_mtxt16 TYPE reptxt, "header text

l_sel_mtxt17 TYPE reptxt, "header text

l_sel_mtxt18 TYPE reptxt, "header text

l_sel_mtxt19 TYPE reptxt, "header text

l_sel_mtxt20 TYPE reptxt, "header text

l_sel_mtxt21 TYPE reptxt, "header text

l_sel_mtxt22 TYPE reptxt, "header text

l_sel_mtxt23 TYPE reptxt, "header text

l_sel_mtxt24 TYPE reptxt, "header text

l_sel_mtxt25 TYPE reptxt, "header text

l_sel_mtxt26 TYPE reptxt, "header text

l_sel_mtxt27 TYPE reptxt, "header text

l_sel_mtxt28 TYPE reptxt, "header text

l_sel_mtxt29 TYPE reptxt, "header text

l_sel_mtxt30 TYPE reptxt, "header text

l_sel_mtxt31 TYPE reptxt, "header text

l_sel_mtxt32 TYPE reptxt, "header text

l_sel_mtxt33 TYPE reptxt, "header text

l_sel_mtxt34 TYPE reptxt, "header text

l_sel_mtxt35 TYPE reptxt, "header text

l_sel_mtxt36 TYPE reptxt, "header text

l_sel_mtxt37 TYPE reptxt, "header text

l_sel_mtxt38 TYPE reptxt, "header text

l_sel_mtxt39 TYPE reptxt, "header text

l_sel_mtxt40 TYPE reptxt, "header text

l_sel_mtxt41 TYPE reptxt, "header text

l_sel_mtxt42 TYPE reptxt, "header text

l_sel_mtxt43 TYPE reptxt, "header text

l_sel_mtxt44 TYPE reptxt, "header text

l_sel_mtxt45 TYPE reptxt, "header text

l_sel_mtxt46 TYPE reptxt, "header text

l_sel_stxt1 TYPE reptxt, "header text

l_sel_stxt2 TYPE reptxt, "header text

l_sel_stxt3 TYPE reptxt, "header text

l_sel_stxt4 TYPE reptxt, "header text

l_sel_stxt5 TYPE reptxt, "header text

l_sel_stxt6 TYPE reptxt, "header text

l_sel_stxt7 TYPE reptxt, "header text

l_sel_stxt8 TYPE reptxt, "header text

l_sel_stxt9 TYPE reptxt, "header text

l_sel_stxt10 TYPE reptxt, "header text

l_sel_stxt11 TYPE reptxt, "header text

l_sel_stxt12 TYPE reptxt, "header text

l_sel_stxt13 TYPE reptxt, "header text

l_sel_stxt14 TYPE reptxt, "header text

l_sel_stxt15 TYPE reptxt, "header text

l_sel_stxt16 TYPE reptxt, "header text

l_sel_stxt17 TYPE reptxt, "header text

l_sel_stxt18 TYPE reptxt, "header text

l_sel_stxt19 TYPE reptxt, "header text

l_sel_stxt20 TYPE reptxt, "header text

l_sel_stxt21 TYPE reptxt, "header text

l_sel_stxt22 TYPE reptxt, "header text

l_sel_stxt23 TYPE reptxt, "header text

l_sel_stxt24 TYPE reptxt, "header text

l_sel_stxt25 TYPE reptxt, "header text

l_sel_stxt26 TYPE reptxt, "header text

l_sel_stxt27 TYPE reptxt, "header text

l_sel_stxt28 TYPE reptxt, "header text

l_sel_stxt29 TYPE reptxt, "header text

l_sel_stxt30 TYPE reptxt, "header text

l_sel_stxt31 TYPE reptxt, "header text

l_sel_stxt32 TYPE reptxt, "header text

l_sel_stxt33 TYPE reptxt, "header text

l_sel_stxt34 TYPE reptxt, "header text

l_sel_stxt35 TYPE reptxt, "header text

l_sel_stxt36 TYPE reptxt, "header text

l_sel_stxt37 TYPE reptxt, "header text

l_sel_stxt38 TYPE reptxt, "header text

l_sel_stxt39 TYPE reptxt, "header text

l_sel_stxt40 TYPE reptxt, "header text

l_sel_stxt41 TYPE reptxt, "header text

l_sel_stxt42 TYPE reptxt, "header text

l_sel_stxt43 TYPE reptxt, "header text

l_sel_stxt44 TYPE reptxt, "header text

l_sel_stxt45 TYPE reptxt, "header text

l_sel_stxt46 TYPE reptxt, "header text

l_reffield1 TYPE fieldname, "Reference field name

l_reffield2 TYPE fieldname, "Reference field name

l_reffield3 TYPE fieldname, "Reference field name

l_reffield4 TYPE fieldname, "Reference field name

l_reffield5 TYPE fieldname, "Reference field name

l_reffield6 TYPE fieldname, "Reference field name

l_reffield7 TYPE fieldname, "Reference field name

l_reffield8 TYPE fieldname, "Reference field name

l_reffield9 TYPE fieldname, "Reference field name

l_reffield10 TYPE fieldname, "Reference field name

l_reffield11 TYPE fieldname, "Reference field name

l_reffield12 TYPE fieldname, "Reference field name

l_reffield13 TYPE fieldname, "Reference field name

l_reffield14 TYPE fieldname, "Reference field name

l_reffield15 TYPE fieldname, "Reference field name

l_reffield16 TYPE fieldname, "Reference field name

l_reffield17 TYPE fieldname, "Reference field name

l_reffield18 TYPE fieldname, "Reference field name

l_reffield19 TYPE fieldname, "Reference field name

l_reffield20 TYPE fieldname, "Reference field name

l_reffield21 TYPE fieldname, "Reference field name

l_reffield22 TYPE fieldname, "Reference field name

l_reffield23 TYPE fieldname, "Reference field name

l_reffield24 TYPE fieldname, "Reference field name

l_reffield25 TYPE fieldname, "Reference field name

l_reffield26 TYPE fieldname, "Reference field name

l_reffield27 TYPE fieldname, "Reference field name

l_reffield28 TYPE fieldname, "Reference field name

l_reffield29 TYPE fieldname, "Reference field name

l_reffield30 TYPE fieldname, "Reference field name

l_reffield31 TYPE fieldname, "Reference field name

l_reffield32 TYPE fieldname, "Reference field name

l_reffield33 TYPE fieldname, "Reference field name

l_reffield34 TYPE fieldname, "Reference field name

l_reffield35 TYPE fieldname, "Reference field name

l_reffield36 TYPE fieldname, "Reference field name

l_reffield37 TYPE fieldname, "Reference field name

l_reffield38 TYPE fieldname, "Reference field name

l_reffield39 TYPE fieldname, "Reference field name

l_reffield40 TYPE fieldname, "Reference field name

l_reffield41 TYPE fieldname, "Reference field name

l_reffield42 TYPE fieldname, "Reference field name

l_reffield43 TYPE fieldname, "Reference field name

l_reffield44 TYPE fieldname, "Reference field name

l_reffield45 TYPE fieldname, "Reference field name

l_reffield46 TYPE fieldname, "Reference field name

l_int_tabname TYPE tabname. "internal table name

  • Assign table name for ALV report

l_tabname1 = c_mseg.

l_tabname2 = c_mkpf.

l_tabname3 = c_ltak.

l_tabname4 = c_ltap.

l_tabname5 = c_makt.

l_tabname6 = c_lein.

  • Assign Current column position

l_sycucol01 = c_01. " value 01

l_sycucol02 = c_02. " value 02

l_sycucol03 = c_03. " value 03

l_sycucol04 = c_04. " value 04

l_sycucol05 = c_05. " value 05

l_sycucol06 = c_06. " value 06

l_sycucol07 = c_07. " value 07

l_sycucol08 = c_08. " value 08

l_sycucol09 = c_09. " value 09

l_sycucol10 = c_10. " value 10

l_sycucol11 = c_11. " value 11

l_sycucol12 = c_12. " value 12

l_sycucol13 = c_13. " value 13

l_sycucol14 = c_14. " value 14

l_sycucol15 = c_15. " value 15

l_sycucol16 = c_16. " value 16

l_sycucol17 = c_17. " value 17

l_sycucol18 = c_18. " value 18

l_sycucol19 = c_19. " value 19

l_sycucol20 = c_20. " value 20

l_sycucol21 = c_21. " value 21

l_sycucol22 = c_22. " value 22

l_sycucol23 = c_23. " value 23

l_sycucol24 = c_24. " value 24

l_sycucol25 = c_25. " value 25

l_sycucol26 = c_26. " value 26

l_sycucol27 = c_27. " value 27

l_sycucol28 = c_28. " value 28

l_sycucol29 = c_29. " value 29

l_sycucol30 = c_30. " value 30

l_sycucol31 = c_31. " value 31

l_sycucol32 = c_32. " value 32

l_sycucol33 = c_33. " value 33

l_sycucol34 = c_34. " value 34

l_sycucol35 = c_35. " value 35

l_sycucol36 = c_36. " value 36

l_sycucol37 = c_37. " value 37

l_sycucol38 = c_38. " value 38

l_sycucol39 = c_39. " value 39

l_sycucol40 = c_40. " value 40

l_sycucol41 = c_41. " value 41

l_sycucol42 = c_42. " value 42

l_sycucol43 = c_43. " value 43

l_sycucol44 = c_44. " value 44

l_sycucol45 = c_45. " value 45

l_sycucol46 = c_46. " value 46

  • Assign Internal table name

l_int_tabname = 'I_OUTPUT'.

  • Assign Detailed text to printed

l_txt1 = text-050. "Material.

l_txt2 = text-051. "Batch.

l_txt3 = text-052. "Plant.

l_txt4 = text-053. "Sloc.

l_txt5 = text-054. "Mvt.

l_txt6 = text-055. "S.

l_txt7 = text-056. "Material Doc.

l_txt8 = text-057. "Item.

l_txt9 = text-058. "Posting Date.

l_txt10 = text-059. "Qty in unit of Entry.

l_txt11 = text-060. "EUn.

l_txt12 = text-061. "St. Typ.

l_txt13 = text-062. "St. Bin.

l_txt14 = text-063. "Storage Unit.

l_txt15 = text-064. "Material Description.

l_txt16 = text-065. "Stock Type.

l_txt17 = text-066. "Order.

l_txt18 = text-067. "Routing Number for Operations.

l_txt19 = text-068. "Document Header Text.

l_txt20 = text-069. "Document Date.

l_txt21 = text-070. "Entry Date.

l_txt22 = text-071. "Time of Entry.

l_txt23 = text-072. "Movement Indicator.

l_txt24 = text-073. "Vendor.

l_txt25 = text-074. "Base Unit of Measure.

l_txt26 = text-075. "Quantity.

l_txt27 = text-076. "Material Doc. Year.

l_txt28 = text-077. "Reservation.

l_txt29 = text-078.

"Item No. Reservation/Dependent Reservation.

l_txt30 = text-079. "Debit/Credit Ind.

l_txt31 = text-080. "User Name.

l_txt32 = text-081. "Trans./Event Type.

l_txt33 = text-082. "GR/GI Slip No..

l_txt34 = text-083. "Warehouse Number.

l_txt35 = text-084. "Transfer Order Number.

l_txt36 = text-085. "Transfer Order Item.

l_txt37 = text-086. "WM Movement Type.

l_txt38 = text-087. "Requirement Type.

l_txt39 = text-088. "Requirement Tracking Number.

l_txt40 = text-089. "Stock Category in Warehouse Mgmt System.

l_txt41 = text-090. "Source Storage Type.

l_txt42 = text-091. "Source Storage Bin.

l_txt43 = text-092. "Source Storage Unit.

l_txt44 = text-093. "Destination Storage Type.

l_txt45 = text-094. "Destination Storage Bin.

l_txt46 = text-095. "Destination Storage Unit.

  • Assign Detailed text to printed-long

l_sel_ltxt1 = text-050. "Material.

l_sel_ltxt2 = text-051. "Batch.

l_sel_ltxt3 = text-052. "Plant.

l_sel_ltxt4 = text-053. "Sloc.

l_sel_ltxt5 = text-054. "Mvt.

l_sel_ltxt6 = text-055. "S.

l_sel_ltxt7 = text-056. "Material Doc.

l_sel_ltxt8 = text-057. "Item.

l_sel_ltxt9 = text-058. "Posting Date.

l_sel_ltxt10 = text-059. "Qty in unit of Entry.

l_sel_ltxt11 = text-060. "EUn.

l_sel_ltxt12 = text-061. "St. Typ.

l_sel_ltxt13 = text-062. "St. Bin.

l_sel_ltxt14 = text-063. "Storage Unit.

l_sel_ltxt15 = text-064. "Material Description.

l_sel_ltxt16 = text-065. "Stock Type.

l_sel_ltxt17 = text-066. "Order.

l_sel_ltxt18 = text-067. "Routing Number for Operations.

l_sel_ltxt19 = text-068. "Document Header Text.

l_sel_ltxt20 = text-069. "Document Date.

l_sel_ltxt21 = text-070. "Entry Date.

l_sel_ltxt22 = text-071. "Time of Entry.

l_sel_ltxt23 = text-072. "Movement Indicator.

l_sel_ltxt24 = text-073. "Vendor.

l_sel_ltxt25 = text-074. "Base Unit of Measure.

l_sel_ltxt26 = text-075. "Quantity.

l_sel_ltxt27 = text-076. "Material Doc. Year.

l_sel_ltxt28 = text-077. "Reservation.

l_sel_ltxt29 = text-078.

"Item No. Reservation/Dependent Reservation.

l_sel_ltxt30 = text-079. "Debit/Credit Ind.

l_sel_ltxt31 = text-080. "User Name.

l_sel_ltxt32 = text-081. "Trans./Event Type.

l_sel_ltxt33 = text-082. "GR/GI Slip No..

l_sel_ltxt34 = text-083. "Warehouse Number.

l_sel_ltxt35 = text-084. "Transfer Order Number.

l_sel_ltxt36 = text-085. "Transfer Order Item.

l_sel_ltxt37 = text-086. "WM Movement Type.

l_sel_ltxt38 = text-087. "Requirement Type.

l_sel_ltxt39 = text-088. "Requirement Tracking Number.

l_sel_ltxt40 = text-089.

"Stock Category in Warehouse Mgmt System.

l_sel_ltxt41 = text-090. "Source Storage Type.

l_sel_ltxt42 = text-091. "Source Storage Bin.

l_sel_ltxt43 = text-092. "Source Storage Unit.

l_sel_ltxt44 = text-093. "Destination Storage Type.

l_sel_ltxt45 = text-094. "Destination Storage Bin.

l_sel_ltxt46 = text-095. "Destination Storage Unit.

  • Assign Detailed text to printed-medium

l_sel_mtxt1 = text-050. "Material.

l_sel_mtxt2 = text-051. "Batch.

l_sel_mtxt3 = text-052. "Plant.

l_sel_mtxt4 = text-053. "Sloc.

l_sel_mtxt5 = text-054. "Mvt.

l_sel_mtxt6 = text-055. "S.

l_sel_mtxt7 = text-056. "Material Doc.

l_sel_mtxt8 = text-057. "Item.

l_sel_mtxt9 = text-058. "Posting Date.

l_sel_mtxt10 = text-059. "Qty in unit of Entry.

l_sel_mtxt11 = text-060. "EUn.

l_sel_mtxt12 = text-061. "St. Typ.

l_sel_mtxt13 = text-062. "St. Bin.

l_sel_mtxt14 = text-063. "Storage Unit.

l_sel_mtxt15 = text-064. "Material Description.

l_sel_mtxt16 = text-065. "Stock Type.

l_sel_mtxt17 = text-066. "Order.

l_sel_mtxt18 = text-067. "Routing Number for Operations.

l_sel_mtxt19 = text-068. "Document Header Text.

l_sel_mtxt20 = text-069. "Document Date.

l_sel_mtxt21 = text-070. "Entry Date.

l_sel_mtxt22 = text-071. "Time of Entry.

l_sel_mtxt23 = text-072. "Movement Indicator.

l_sel_mtxt24 = text-073. "Vendor.

l_sel_mtxt25 = text-074. "Base Unit of Measure.

l_sel_mtxt26 = text-075. "Quantity.

l_sel_mtxt27 = text-076. "Material Doc. Year.

l_sel_mtxt28 = text-077. "Reservation.

l_sel_mtxt29 = text-078.

"Item No. Reservation/Dependent Reservation.

l_sel_mtxt30 = text-079. "Debit/Credit Ind.

l_sel_mtxt31 = text-080. "User Name.

l_sel_mtxt32 = text-081. "Trans./Event Type.

l_sel_mtxt33 = text-082. "GR/GI Slip No..

l_sel_mtxt34 = text-083. "Warehouse Number.

l_sel_mtxt35 = text-084. "Transfer Order Number.

l_sel_mtxt36 = text-085. "Transfer Order Item.

l_sel_mtxt37 = text-086. "WM Movement Type.

l_sel_mtxt38 = text-087. "Requirement Type.

l_sel_mtxt39 = text-088. "Requirement Tracking Number.

l_sel_mtxt40 = text-089.

"Stock Category in Warehouse Mgmt System.

l_sel_mtxt41 = text-090. "Source Storage Type.

l_sel_mtxt42 = text-091. "Source Storage Bin.

l_sel_mtxt43 = text-092. "Source Storage Unit.

l_sel_mtxt44 = text-093. "Destination Storage Type.

l_sel_mtxt45 = text-094. "Destination Storage Bin.

l_sel_mtxt46 = text-095. "Destination Storage Unit.

  • Assign Detailed text to printed-short

l_sel_stxt1 = text-050. "Material.

l_sel_stxt2 = text-051. "Batch.

l_sel_stxt3 = text-052. "Plant.

l_sel_stxt4 = text-053. "Sloc.

l_sel_stxt5 = text-054. "Mvt.

l_sel_stxt6 = text-055. "S.

l_sel_stxt7 = text-056. "Material Doc.

l_sel_stxt8 = text-057. "Item.

l_sel_stxt9 = text-058. "Posting Date.

l_sel_stxt10 = text-059. "Qty in unit of Entry.

l_sel_stxt11 = text-060. "EUn.

l_sel_stxt12 = text-061. "St. Typ.

l_sel_stxt13 = text-062. "St. Bin.

l_sel_stxt14 = text-063. "Storage Unit.

l_sel_stxt15 = text-064. "Material Description.

l_sel_stxt16 = text-065. "Stock Type.

l_sel_stxt17 = text-066. "Order.

l_sel_stxt18 = text-067. "Routing Number for Operations.

l_sel_stxt19 = text-068. "Document Header Text.

l_sel_stxt20 = text-069. "Document Date.

l_sel_stxt21 = text-070. "Entry Date.

l_sel_stxt22 = text-071. "Time of Entry.

l_sel_stxt23 = text-072. "Movement Indicator.

l_sel_stxt24 = text-073. "Vendor.

l_sel_stxt25 = text-074. "Base Unit of Measure.

l_sel_stxt26 = text-075. "Quantity.

l_sel_stxt27 = text-076. "Material Doc. Year.

l_sel_stxt28 = text-077. "Reservation.

l_sel_stxt29 = text-078.

"Item No. Reservation/Dependent Reservation.

l_sel_stxt30 = text-079. "Debit/Credit Ind.

l_sel_stxt31 = text-080. "User Name.

l_sel_stxt32 = text-081. "Trans./Event Type.

l_sel_stxt33 = text-082. "GR/GI Slip No..

l_sel_stxt34 = text-083. "Warehouse Number.

l_sel_stxt35 = text-084. "Transfer Order Number.

l_sel_stxt36 = text-085. "Transfer Order Item.

l_sel_stxt37 = text-086. "WM Movement Type.

l_sel_stxt38 = text-087. "Requirement Type.

l_sel_stxt39 = text-088. "Requirement Tracking Number.

l_sel_stxt40 = text-089.

"Stock Category in Warehouse Mgmt System.

l_sel_stxt41 = text-090. "Source Storage Type.

l_sel_stxt42 = text-091. "Source Storage Bin.

l_sel_stxt43 = text-092. "Source Storage Unit.

l_sel_stxt44 = text-093. "Destination Storage Type.

l_sel_stxt45 = text-094. "Destination Storage Bin.

l_sel_stxt46 = text-095. "Destination Storage Unit.

  • Assign field name to be passed

l_field1 = text-004. "MATNR.

l_field2 = text-005. "CHARG.

l_field3 = text-006. "WERKS.

l_field4 = text-007. "LGORT.

l_field5 = text-008. "BWART.

l_field6 = text-009. "SOBKZ.

l_field7 = text-010. "MBLNR.

l_field8 = text-011. "ZEILE.

l_field9 = text-012. "BUDAT.

l_field10 = text-013. "ERFMG.

l_field11 = text-014. "ERFME.

l_field12 = text-015. "LGTYP.

l_field13 = text-016. "LGPLA.

l_field14 = text-017. "LENUM.

l_field15 = text-018. "MAKTX.

l_field16 = text-019. "INSMK.

l_field17 = text-020. "AUFNR.

l_field18 = text-021. "AUFPL.

l_field19 = text-022. "BKTXT.

l_field20 = text-023. "BLDAT.

l_field21 = text-024. "CPUDT.

l_field22 = text-025. "CPUTM.

l_field23 = text-026. "KZBEW.

l_field24 = text-027. "LIFNR.

l_field25 = text-028. "MEINS.

l_field26 = text-029. "MENGE.

l_field27 = text-030. "MJAHR.

l_field28 = text-031. "RSNUM.

l_field29 = text-032. "RSPOS.

l_field30 = text-033. "SHKZG.

l_field31 = text-034. "USNAM.

l_field32 = text-035. "VGART.

l_field33 = text-036. "XABLN.

l_field34 = text-037. "LGNUM.

l_field35 = text-038. "TANUM.

l_field36 = text-039. "tapos.

l_field37 = text-040. "BWLVS.

l_field38 = text-041. "BETYP.

l_field39 = text-042. "BENUM.

l_field40 = text-043. "BESTQ.

l_field41 = text-044. "VLTYP.

l_field42 = text-045. "VLPLA.

l_field43 = text-046. "VLENR.

l_field44 = text-047. "NLTYP.

l_field45 = text-048. "NLPLA.

l_field46 = text-049. "NLENR.

  • Assign Reference field name to be passed

l_reffield1 = text-004. "MATNR.

l_reffield2 = text-005. "CHARG.

l_reffield3 = text-006. "WERKS.

l_reffield4 = text-007. "LGORT.

l_reffield5 = text-008. "BWART.

l_reffield6 = text-009. "SOBKZ.

l_reffield7 = text-010. "MBLNR.

l_reffield8 = text-011. "ZEILE.

l_reffield9 = text-012. "BUDAT.

l_reffield10 = text-013. "ERFMG.

l_reffield11 = text-014. "ERFME.

l_reffield12 = text-015. "LGTYP.

l_reffield13 = text-016. "LGPLA.

l_reffield14 = text-017. "LENUM.

l_reffield15 = text-018. "MAKTX.

l_reffield16 = text-019. "INSMK.

l_reffield17 = text-020. "AUFNR.

l_reffield18 = text-021. "AUFPL.

l_reffield19 = text-022. "BKTXT.

l_reffield20 = text-023. "BLDAT.

l_reffield21 = text-024. "CPUDT.

l_reffield22 = text-025. "CPUTM.

l_reffield23 = text-026. "KZBEW.

l_reffield24 = text-027. "LIFNR.

l_reffield25 = text-028. "MEINS.

l_reffield26 = text-029. "MENGE.

l_reffield27 = text-030. "MJAHR.

l_reffield28 = text-031. "RSNUM.

l_reffield29 = text-032. "RSPOS.

l_reffield30 = text-033. "SHKZG.

l_reffield31 = text-034. "USNAM.

l_reffield32 = text-035. "VGART.

l_reffield33 = text-036. "XABLN.

l_reffield34 = text-037. "LGNUM.

l_reffield35 = text-038. "TANUM.

l_reffield36 = ''.

l_reffield37 = text-040. "BWLVS.

l_reffield38 = text-041. "BETYP.

l_reffield39 = text-042. "BENUM.

l_reffield40 = text-043. "BESTQ.

l_reffield41 = text-044. "VLTYP.

l_reffield42 = text-045. "VLPLA.

l_reffield43 = text-046. "VLENR.

l_reffield44 = text-047. "NLTYP.

l_reffield45 = text-048. "NLPLA.

l_reffield46 = text-049. "NLENR.

  • Populate the field catalog

PERFORM sub_fcat_fill USING:

*POS FIELD TABLE KEY JUST TITLE REFTAB TYPE

*REFFIELD SELTEXTLONG SELTEXTMEDIUM SELTEXTSHORT DOSUM NO_OUT

l_sycucol01 l_field1 l_int_tabname c_x c_l l_txt1

l_tabname1

l_reffield1 l_sel_ltxt1 l_sel_mtxt1 l_sel_stxt1 '' '' ,

l_sycucol02 l_field2 l_int_tabname '' c_l l_txt2

l_tabname1

l_reffield2 l_sel_ltxt2 l_sel_mtxt2 l_sel_stxt2 '' '' ,

l_sycucol03 l_field3 l_int_tabname '' c_l l_txt3

l_tabname1

l_reffield3 l_sel_ltxt3 l_sel_mtxt3 l_sel_stxt3 '' '' ,

l_sycucol04 l_field4 l_int_tabname '' c_l l_txt4

l_tabname1

l_reffield4 l_sel_ltxt4 l_sel_mtxt4 l_sel_stxt4 '' '' ,

l_sycucol05 l_field5 l_int_tabname '' c_l l_txt5

l_tabname1

l_reffield5 l_sel_ltxt5 l_sel_mtxt5 l_sel_stxt5 '' '' ,

l_sycucol06 l_field6 l_int_tabname '' c_l l_txt6

l_tabname1

l_reffield6 l_sel_ltxt6 l_sel_mtxt6 l_sel_stxt6 '' '' ,

l_sycucol07 l_field7 l_int_tabname '' c_l l_txt7

l_tabname1

l_reffield7 l_sel_ltxt7 l_sel_mtxt7 l_sel_stxt7 '' '' ,

l_sycucol08 l_field8 l_int_tabname '' c_l l_txt8

l_tabname1

l_reffield8 l_sel_ltxt8 l_sel_mtxt8 l_sel_stxt8 '' '' ,

l_sycucol09 l_field9 l_int_tabname '' c_l l_txt9 ''

l_reffield9

l_sel_ltxt9 l_sel_mtxt9 l_sel_stxt9 '' '' ,

l_sycucol10 l_field10 l_int_tabname '' c_r l_txt10

l_tabname1

l_reffield10 l_sel_ltxt10 l_sel_mtxt10 l_sel_stxt10 c_x'' ,

l_sycucol11 l_field11 l_int_tabname '' c_l l_txt11

l_tabname1

l_reffield11 l_sel_ltxt11 l_sel_mtxt11 l_sel_stxt11 '' '' ,

l_sycucol12 l_field12 l_int_tabname '' c_l l_txt12

l_tabname1

l_reffield12 l_sel_ltxt12 l_sel_mtxt12 l_sel_stxt12 '' '' ,

l_sycucol13 l_field13 l_int_tabname '' c_l l_txt13

l_tabname1

l_reffield13 l_sel_ltxt13 l_sel_mtxt13 l_sel_stxt13 '' '' ,

l_sycucol14 l_field14 l_int_tabname '' c_l l_txt14

l_tabname6

l_reffield14 l_sel_ltxt14 l_sel_mtxt14 l_sel_stxt14 '' '' ,

l_sycucol15 l_field15 l_int_tabname '' c_l l_txt15

l_tabname5

l_reffield15 l_sel_ltxt15 l_sel_mtxt15 l_sel_stxt15 '' c_x ,

l_sycucol16 l_field16 l_int_tabname '' c_l l_txt16

l_tabname1

l_reffield16 l_sel_ltxt16 l_sel_mtxt16 l_sel_stxt16 '' c_x ,

l_sycucol17 l_field17 l_int_tabname '' c_l l_txt17

l_tabname1

l_reffield17 l_sel_ltxt17 l_sel_mtxt17 l_sel_stxt17 '' c_x ,

l_sycucol18 l_field18 l_int_tabname '' c_l l_txt18

l_tabname1

l_reffield18 l_sel_ltxt18 l_sel_mtxt18 l_sel_stxt18 '' c_x ,

l_sycucol19 l_field19 l_int_tabname '' c_l l_txt19

l_tabname2

l_reffield19 l_sel_ltxt19 l_sel_mtxt19 l_sel_stxt19 '' c_x ,

l_sycucol20 l_field20 l_int_tabname '' c_l l_txt20

l_tabname2

l_reffield20 l_sel_ltxt20 l_sel_mtxt20 l_sel_stxt20 '' c_x ,

l_sycucol21 l_field21 l_int_tabname '' c_l l_txt21

l_tabname2

l_reffield21 l_sel_ltxt21 l_sel_mtxt21 l_sel_stxt21 '' c_x ,

l_sycucol22 l_field22 l_int_tabname '' c_l l_txt22

l_tabname2

l_reffield22 l_sel_ltxt22 l_sel_mtxt22 l_sel_stxt22 '' c_x ,

l_sycucol23 l_field23 l_int_tabname '' c_l l_txt23

l_tabname1

l_reffield23 l_sel_ltxt23 l_sel_mtxt23 l_sel_stxt23 '' c_x ,

l_sycucol24 l_field24 l_int_tabname '' c_l l_txt24

l_tabname1

l_reffield24 l_sel_ltxt24 l_sel_mtxt24 l_sel_stxt24 '' c_x ,

l_sycucol25 l_field25 l_int_tabname '' c_l l_txt25

l_tabname1

l_reffield25 l_sel_ltxt25 l_sel_mtxt25 l_sel_stxt25 '' c_x ,

l_sycucol26 l_field26 l_int_tabname '' c_r l_txt26

l_tabname1

l_reffield26 l_sel_ltxt26 l_sel_mtxt26 l_sel_stxt26 c_x c_x

,

l_sycucol27 l_field27 l_int_tabname '' c_l l_txt27

l_tabname1

l_reffield27 l_sel_ltxt27 l_sel_mtxt27 l_sel_stxt27 '' c_x ,

l_sycucol28 l_field28 l_int_tabname '' c_l l_txt28

l_tabname1

l_reffield28 l_sel_ltxt28 l_sel_mtxt28 l_sel_stxt28 '' c_x ,

l_sycucol29 l_field29 l_int_tabname '' c_l l_txt29

l_tabname1

l_reffield29 l_sel_ltxt29 l_sel_mtxt29 l_sel_stxt29 '' c_x ,

l_sycucol30 l_field30 l_int_tabname '' c_l l_txt30

l_tabname1

l_reffield30 l_sel_ltxt30 l_sel_mtxt30 l_sel_stxt30 '' c_x ,

l_sycucol31 l_field31 l_int_tabname '' c_l l_txt31

l_tabname2

l_reffield31 l_sel_ltxt31 l_sel_mtxt31 l_sel_stxt31 '' c_x ,

l_sycucol32 l_field32 l_int_tabname '' c_l l_txt32

l_tabname2

l_reffield32 l_sel_ltxt32 l_sel_mtxt32 l_sel_stxt32 '' c_x ,

l_sycucol33 l_field33 l_int_tabname '' c_l l_txt33

l_tabname2

l_reffield33 l_sel_ltxt33 l_sel_mtxt33 l_sel_stxt33 '' c_x ,

l_sycucol34 l_field34 l_int_tabname '' c_l l_txt34

l_tabname3

l_reffield34 l_sel_ltxt34 l_sel_mtxt34 l_sel_stxt34 '' c_x ,

l_sycucol35 l_field35 l_int_tabname '' c_l l_txt35

l_tabname3

l_reffield35 l_sel_ltxt35 l_sel_mtxt35 l_sel_stxt35 '' c_x ,

l_sycucol36 l_field36 l_int_tabname '' c_l l_txt36 ''

l_reffield36 l_sel_ltxt36 l_sel_mtxt36 l_sel_stxt36 '' c_x ,

l_sycucol37 l_field37 l_int_tabname '' c_l l_txt37

l_tabname3

l_reffield37 l_sel_ltxt37 l_sel_mtxt37 l_sel_stxt37 '' c_x ,

l_sycucol38 l_field38 l_int_tabname '' c_l l_txt38

l_tabname3

l_reffield38 l_sel_ltxt38 l_sel_mtxt38 l_sel_stxt38 '' c_x ,

l_sycucol39 l_field39 l_int_tabname '' c_l l_txt39

l_tabname3

l_reffield39 l_sel_ltxt39 l_sel_mtxt39 l_sel_stxt39 '' c_x ,

l_sycucol40 l_field40 l_int_tabname '' c_l l_txt40

l_tabname4

l_reffield40 l_sel_ltxt40 l_sel_mtxt40 l_sel_stxt40 '' c_x ,

l_sycucol41 l_field41 l_int_tabname '' c_l l_txt41

l_tabname4

l_reffield41 l_sel_ltxt41 l_sel_mtxt41 l_sel_stxt41 '' c_x ,

l_sycucol42 l_field42 l_int_tabname '' c_l l_txt42

l_tabname4

l_reffield42 l_sel_ltxt42 l_sel_mtxt42 l_sel_stxt42 '' c_x ,

l_sycucol43 l_field43 l_int_tabname '' c_l l_txt43

l_tabname4

l_reffield43 l_sel_ltxt43 l_sel_mtxt43 l_sel_stxt43 '' c_x ,

l_sycucol44 l_field44 l_int_tabname '' c_l l_txt44

l_tabname4

l_reffield44 l_sel_ltxt44 l_sel_mtxt44 l_sel_stxt44 '' c_x ,

l_sycucol45 l_field45 l_int_tabname '' c_l l_txt45

l_tabname4

l_reffield45 l_sel_ltxt45 l_sel_mtxt45 l_sel_stxt45 '' c_x ,

l_sycucol46 l_field46 l_int_tabname '' c_l l_txt46

l_tabname4

l_reffield46 l_sel_ltxt46 l_sel_mtxt46 l_sel_stxt46 '' c_x .

ENDFORM. " sub_fcat_build

&----


*& Form sub_fcat_fill

&----


  • This subroutine populates the field catalog

----


FORM sub_fcat_fill USING in_pos TYPE sycucol

in_fld TYPE fieldname

in_tab TYPE tabname

in_key TYPE char1

in_jus TYPE char1

in_txt TYPE reptext

in_reftab TYPE char30

in_reffld TYPE fieldname

in_seltxtl TYPE reptxt

in_seltxtm TYPE reptxt

in_seltxts TYPE reptxt

in_do_sum TYPE char1

in_no_out TYPE char1.

CONSTANTS: c_ddictxt TYPE c VALUE 'L'. " value of L

DATA : i_lfl_fcat TYPE slis_fieldcat_alv.

i_lfl_fcat-col_pos = in_pos. "position of column

i_lfl_fcat-fieldname = in_fld. "name of field

i_lfl_fcat-tabname = in_tab. "name of table

i_lfl_fcat-key = in_key. "key flag

i_lfl_fcat-just = in_jus. "justified - R/L

i_lfl_fcat-reptext_ddic = in_txt. "text header

i_lfl_fcat-ref_tabname = in_reftab. "reference table

i_lfl_fcat-ref_fieldname = in_reffld. "reference field

i_lfl_fcat-seltext_l = in_seltxtl. "selection text long

i_lfl_fcat-seltext_m = in_seltxtm. "selection text medium

i_lfl_fcat-seltext_s = in_seltxts. "selection text short

i_lfl_fcat-do_sum = in_do_sum."do sum

i_lfl_fcat-no_out = in_no_out."no out

i_lfl_fcat-ddictxt = c_ddictxt.

IF in_fld = text-013. " ERFMG

i_lfl_fcat-QFIELDNAME = text-014. " ERFME

ELSEIF in_fld = text-029. " MENGE

i_lfl_fcat-QFIELDNAME = text-028. " MEINS

ENDIF.

APPEND i_lfl_fcat TO i_fcat.

CLEAR i_lfl_fcat.

ENDFORM. " sub_fcat_fill

&----


*& Form sortinfo_build

&----


  • This subroutine builds the sort table passed to the ALV

----


FORM sortinfo_build .

DATA: l_sort TYPE slis_sortinfo_alv.

  • Sort criteria material number and batch

CLEAR l_sort.

l_sort-spos = c_01.

l_sort-fieldname = text-004. " MATNR

l_sort-tabname = 'I_OUTPUT'.

l_sort-up = c_x.

l_sort-subtot = c_x.

APPEND l_sort TO i_sort.

CLEAR l_sort.

l_sort-spos = c_02.

l_sort-fieldname = text-005. " CHARG

l_sort-tabname = 'I_OUTPUT'.

l_sort-up = c_x.

APPEND l_sort TO i_sort.

ENDFORM. " sortinfo_build

&----


*& Form varinfo_build

&----


  • This subroutines builds up the variant information

----


FORM varinfo_build .

struct_variant-report = v_repid.

ENDFORM. " varinfo_build

&----


*& Form layout_build

&----


  • This subroutine builds the layout for column optmise and color

  • display.

----


FORM layout_build USING l_layout TYPE slis_layout_alv.

DATA : lv_colno TYPE i.

l_layout-colwidth_optimize = 'X'.

l_layout-coltab_fieldname = 'COLOR'.

REFRESH: i_output-color,

i_col_layout.

LOOP AT i_output.

IF i_output-shkzg = c_h.

lv_colno = 6. "color RED

PERFORM sub_set_color USING i_col_layout

text-013 "ERFMG

text-014 "ERFME

text-028 "MEINS

text-029 "MENGE

lv_colno.

ELSE.

lv_colno = 5. "color GREEN

PERFORM sub_set_color USING i_col_layout

text-013 "ERFMG

text-014 "ERFME

text-028 "MEINS

text-029 "MENGE

lv_colno.

ENDIF.

i_output-color[] = i_col_layout[].

MODIFY i_output TRANSPORTING color.

CLEAR: i_col_layout[].

ENDLOOP.

ENDFORM. " layout_build

&----


*& Form SUB_SET_COLOR

&----


  • This subroutine sets the colour of the Quantity and Unit of measure

  • cells depending on Debit/Credit

----


FORM sub_set_color USING ls_color LIKE i_col_layout

p_fieldname1

p_fieldname2

p_fieldname3

p_fieldname4

p_colno.

DATA: i_lfl_color TYPE slis_specialcol_alv.

CLEAR i_lfl_color.

i_lfl_color-fieldname = p_fieldname1.

i_lfl_color-color-col = p_colno.

i_lfl_color-nokeycol = 'X'.

APPEND i_lfl_color TO ls_color.

CLEAR i_lfl_color.

i_lfl_color-fieldname = p_fieldname2.

i_lfl_color-color-col = p_colno.

i_lfl_color-nokeycol = 'X'.

APPEND i_lfl_color TO ls_color.

CLEAR i_lfl_color.

i_lfl_color-fieldname = p_fieldname3.

i_lfl_color-color-col = p_colno.

i_lfl_color-nokeycol = 'X'.

APPEND i_lfl_color TO ls_color.

CLEAR i_lfl_color.

i_lfl_color-fieldname = p_fieldname4.

i_lfl_color-color-col = p_colno.

i_lfl_color-nokeycol = 'X'.

APPEND i_lfl_color TO ls_color.

ENDFORM. " SUB_SET_COLOR

&----


*& Form Populate_detl_meins

&----


  • This subroutine populates the Base Unit (MEINS) from LTAP table

  • into the i_detl internal table.

----


FORM Populate_detl_meins .

DATA l_index type i.

CLEAR l_index.

IF NOT i_detl[] IS INITIAL.

  • Retreieve BAse UNit (MEINS) from LTAP

SELECT a~lgnum " Warehouse no.

a~tanum " Transfer order no.

a~tapos " Transfer order item

a~matnr " Material no.

a~meins " Base unit

INTO TABLE i_meins_ltap

FROM ltap AS a

FOR ALL ENTRIES IN i_detl

WHERE a~lgnum = i_detl-lgnum

AND a~tanum = i_detl-tanum

AND a~tapos = i_detl-tapos

AND a~matnr = i_detl-matnr.

l_index = 1.

LOOP AT i_detl.

CLEAR i_meins_ltap.

READ TABLE i_meins_ltap WITH KEY lgnum = i_detl-lgnum

tanum = i_detl-tanum

tapos = i_detl-tapos

matnr = i_detl-matnr.

IF sy-subrc = 0.

i_detl-meins_to = i_meins_ltap-meins.

MODIFY i_detl index l_index TRANSPORTING meins_to.

ENDIF.

CLEAR i_detl.

l_index = l_index + 1.

ENDLOOP.

ENDIF.

ENDFORM. " Populate_detl_meins