cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding ABAP

Former Member
0 Kudos

I am very new to ABAP so can you tell me what the following means:

-


First Question----


DATA: L_0MAT_PLANT_ATTR LIKE BIW_MARC_S.

DATA: ZPACKSTYLE(30) TYPE C VALUE '0000001800'.

DATA: ZSECTOR(30) TYPE C VALUE '0000001806'.

-


Second Question----


CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'

EXPORTING

INPUT = 'PACKAGESTYLE'

IMPORTING

OUTPUT = ZPACKSTYLE .

Third Question----


LOOP AT I_T_DATA INTO L_0MAT_PLANT_ATTR.

-


Will rewards points ...!

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

First Question----


They are variables declared.ZPACKSTYLE, ZSECTOR are char type wid length 30 and default values.

-


Second Question----


This is a call to a FM function module with PACKAGESTYLE as the input parameters and

ZPACKSTYLE as the output parameter

Third Question----


This is a loop statement for looping into each row of internal table I_T_DATA and as d loop progresses each row will be collected into L_0MAT_PLANT_ATTR. internal table.

if u have any specific quesions you can ask.

hope this helps,

regards,

Parth.

Former Member
0 Kudos

thanks, solved most of my doubts

more questions

L_0MAT_PLANT_ATTR LIKE BIW_MARC_S , what is this ? what is BIW_MARC_S

and when the code says

L_0MAT_PLANT_ATTR-ZZ_PRDHA = MARA-PRDHA

What are both these? fields in the internal table assigned form MARA internal table field right?

Thank you in advance

Former Member
0 Kudos

BIW_MARC_S could be a extraction structureas defined internally.L_0MAT_PLANT_ATTR is another structure declared just like BIW_MARC_S.

L_0MAT_PLANT_ATTR-ZZ_PRDHA is a field in the structure

MARA-PRDHA is a field in MARA table and this value is assigned to

L_0MAT_PLANT_ATTR-ZZ_PRDHA

regards,

Parth.

Former Member
0 Kudos

SO what does the following Select statement do then?

-


select single PRDHA MSTAE LVORM SPART MTART

INTO (MARA-PRDHA, MARA-MSTAE, MARA-LVORM,

MARA-SPART, MARA-MTART)

from MARA

where MATNR = L_0MAT_PLANT_ATTR-MATNR.

if sy-subrc = 0.

L_0MAT_PLANT_ATTR-ZZ_PRDHA = MARA-PRDHA.

L_0MAT_PLANT_ATTR-ZZ_MSTAE = MARA-MSTAE.

L_0MAT_PLANT_ATTR-ZZ_LVORM_MAT = MARA-LVORM.

L_0MAT_PLANT_ATTR-ZZ_SPART = MARA-SPART.

L_0MAT_PLANT_ATTR-ZZ_MTART = MARA-MTART.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

-


Thanks

Former Member
0 Kudos

its a select statement which will select the following fields

PRDHA MSTAE LVORM SPART MTART

but only one row(since single is used) and put the values in the respective fields of MARA table you can see the assignment (INTO)

for the where condition which is Material Number(MATNR) = Material Number present in this strcuture(L_0MAT_PLANT_ATTR-MATNR)

If sy-subrc = 0 is kinda check its a system variable and it checks if the select statement returns some values Sy-subrc = 0 oderwise it is > 0.

If there is some values returned then they are asigned in the respective fields of structure

L_0MAT_PLANT_ATTR using those assignment statements

L_0MAT_PLANT_ATTR-ZZ_PRDHA = MARA-PRDHA

.

.

.

after the values has been it needs to be updated into the internal table I_T_DATA.Hence the modify statement

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX

hope it helps..

Former Member
0 Kudos

But isnt it selecting from the MARA table only since it says MARA? So its selecting from the "MARA" table and putting in the same field ?

Somehow confused?

Thanks

Former Member
0 Kudos

yes it is selecting from MARA table and again putting them in MARA again.Looks like it is trying to pick some attributes of material.

Can you tell us where exactly is this code written,is it some kind of datasource/ some standard functionality or custom built.

Parth.

Former Member
0 Kudos

Its Written in

ZXRSAUO2 for OMAT_PLANT_ATTR

Former Member
0 Kudos

it looks that your 0MAT_PLANT_ATTR datasource has been enhanced and this piece of code was written to populate values in the newly added fields.

on the r/3 side.goto tcode rsa3 and give this datasource name and see if theres any value gettin picked up for these fields.

regards,

Parth.

Former Member
0 Kudos

What is happening is , For a full Load this enhancement works , but during the Delta load, only one value is populated and the remaining is now

For example,

If one material is used in 10 plants, and there is a change in one of the material , it should update in all the plans , but it updates only for one plant. It holds good for a full Load, but for a delta load , it doesnt update?

Here is the USEREXIT CODE

-


  • -----------------------------DATA DECLARATION ----------------------*

Tables : MARA, T001W, AUSP.

*local structure / Internal tables

DATA: L_0MAT_PLANT_ATTR LIKE BIW_MARC_S.

DATA: ZPACKSTYLE(30) TYPE C VALUE '0000001800'.

DATA: ZSECTOR(30) TYPE C VALUE '0000001806'.

DATA: ZSEGMENT(30) TYPE C VALUE '0000001807'.

DATA: ZSUB-SEGMENT(30) TYPE C VALUE '0000001808'.

DATA: ZPACKCAT(30) TYPE C VALUE '0000001799'.

DATA: ZPACKTYP(30) TYPE C VALUE '0000001798'.

--


END OF DATA DECLARATION--

CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'

EXPORTING

INPUT = 'PACKAGESTYLE'

IMPORTING

OUTPUT = ZPACKSTYLE .

CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'

EXPORTING

INPUT = 'PACKAGECATEGORY'

IMPORTING

OUTPUT = ZPACKCAT.

CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'

EXPORTING

INPUT = 'PACKAGETYPE'

IMPORTING

OUTPUT = ZPACKTYP.

CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'

EXPORTING

INPUT = 'SECTOR'

IMPORTING

OUTPUT = ZSECTOR.

CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'

EXPORTING

INPUT = 'SEGMENT'

IMPORTING

OUTPUT = ZSEGMENT.

CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'

EXPORTING

INPUT = 'SUB-SEGMENT'

IMPORTING

OUTPUT = ZSUB-SEGMENT.

LOOP AT I_T_DATA INTO L_0MAT_PLANT_ATTR.

L_TABIX = SY-TABIX.

*Populate Fields from Table MARA.

select single PRDHA MSTAE LVORM SPART MTART

INTO (MARA-PRDHA, MARA-MSTAE, MARA-LVORM,

MARA-SPART, MARA-MTART)

from MARA

where MATNR = L_0MAT_PLANT_ATTR-MATNR.

if sy-subrc = 0.

L_0MAT_PLANT_ATTR-ZZ_PRDHA = MARA-PRDHA.

L_0MAT_PLANT_ATTR-ZZ_MSTAE = MARA-MSTAE.

L_0MAT_PLANT_ATTR-ZZ_LVORM_MAT = MARA-LVORM.

L_0MAT_PLANT_ATTR-ZZ_SPART = MARA-SPART.

L_0MAT_PLANT_ATTR-ZZ_MTART = MARA-MTART.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single ATWRT INTO L_0MAT_PLANT_ATTR-ZZ_ATWRT_PSTYL

from AUSP

where OBJEK = L_0MAT_PLANT_ATTR-MATNR

and ATINN = ZPACKSTYLE.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single ATWRT INTO L_0MAT_PLANT_ATTR-ZZ_ATWRT_SEC

from AUSP

where OBJEK = L_0MAT_PLANT_ATTR-MATNR

and ATINN = ZSECTOR.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single ATWRT INTO L_0MAT_PLANT_ATTR-ZZ_ATWRT_SEG

from AUSP

where OBJEK = L_0MAT_PLANT_ATTR-MATNR

and ATINN = ZSEGMENT.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single ATWRT INTO L_0MAT_PLANT_ATTR-ZZ_ATWRT_SUBSG

from AUSP

where OBJEK = L_0MAT_PLANT_ATTR-MATNR

and ATINN = ZSUB-SEGMENT.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single ATWRT INTO L_0MAT_PLANT_ATTR-ZZ_ATWRT_PKCAT

from AUSP

where OBJEK = L_0MAT_PLANT_ATTR-MATNR

and ATINN = ZPACKCAT.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single ATWRT INTO L_0MAT_PLANT_ATTR-ZZ_ATWRT_PKTYP

from AUSP

where OBJEK = L_0MAT_PLANT_ATTR-MATNR

and ATINN = ZPACKTYP.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single LAND1 VKORG VTWEG

INTO (L_0MAT_PLANT_ATTR-ZZ_LAND1, L_0MAT_PLANT_ATTR-ZZ_VKORG,

L_0MAT_PLANT_ATTR-ZZ_VTWEG)

from T001W

where WERKS = L_0MAT_PLANT_ATTR-WERKS.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single MVGR4 INTO L_0MAT_PLANT_ATTR-ZZ_MVGR4

from MVKE

where MATNR = L_0MAT_PLANT_ATTR-MATNR

and VKORG = L_0MAT_PLANT_ATTR-ZZ_VKORG

and VTWEG = L_0MAT_PLANT_ATTR-ZZ_VTWEG.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

select single BUKRS INTO L_0MAT_PLANT_ATTR-ZZ_BUKRS

from TVKO

where VKORG = L_0MAT_PLANT_ATTR-ZZ_VKORG.

if sy-subrc = 0.

MODIFY I_T_DATA FROM L_0MAT_PLANT_ATTR index L_TABIX.

endif.

ENDLOOP.

-


Can you check out and inform

Thanks for all the help...!

Justin

Former Member
0 Kudos

i am not sure but can you check this if OMAT_PLANT_ATTR actually supports Delta after it has been enhanced.

Or it only supports Full Update once enhanced.

regards,

Parth.

Former Member
0 Kudos

When its taken from MARC table it does support the change ! I read in some forum , that if the table is not related to the DAtasource then the enhancement might not work , but these tables do right?

Or SAP must have had a workaround , for this?

Anybody who could help.

Thanks

Justin

mathew_muthalaly
Contributor
0 Kudos

Hi Justin,

>>But isnt it selecting from the MARA table only since it says MARA? So its selecting from the "MARA" table and putting in the same field ?<<

At the top of the large section of code you pasted, there is a TABLES declaration with MARA.

What this does is it sets up a work-area in the program context with name MARA having the same structure as table MARA.

The select statement retrieves one record at a time from table MARA and transfers it to this work-area with structure MARA, for subsequent processing.

BR/

Mathew.

P.S. I would be leaving office in a short while. It is weekend in this part of the world.

Former Member
0 Kudos

Thanks got that..!

By why doesnt the delta work in this case then ? I mean if a material has some changes , it reflects only in one plant , even though it belongs to like 10 plants? ANy suggestions

Thanks for the help

mathew_muthalaly
Contributor
0 Kudos

The basic data of a material is stored in table MARA. It does not carry plant (field -WERKS).

A material created with basic views may be extended to multiple plants. Plant related data is stored in table MARC.

If the changed data is relevant to a Plant, it need not be relevant to the other Plants.

I suggest that you see if your changes reflect in MARA (Basic data) or MARC (Plant data).

BR/

Mathew.

Former Member
0 Kudos

If the changes happen in the other table like MARA, but the datasource catches delta only delta from MARC, is there a way to check out the changes for a delta in the table like MARA, to update our datasource? or maybe there is a different datasource for it?

Thanks

Answers (0)