Application Development and Automation 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: 
Read only

psuedo code

Former Member
0 Likes
1,479

hi i want a help on this:

1. Retrieve Object type(OBJTY) , Object Id (OBJID) , Document number(DOKNR) from CRVD_A database table for selection screen document numbers. If no documents found raise an error message.

2. Extract Task list type(PLNTY) , Task list key(PLNNR) , Object type(OBJTY) , Object Id (OBJID) , Task list object (PLNAL) from PLFH table for all entries of above document numbers.

3. Retrieve material(MATNR) , plant(WERKS) , Task list type (PLNTY) , Task list key(PLNNR) , Task list object(PLNAL) from MAPL table for all entries of above internal table and selection screen material number and plant.

4. Retrieve material(MATNR) , Description(MAKTX) , Language key(SPRAS) from MAKT table for all entries of above internal table and selection screen language.

5. Loop on MAPL internal table .

a. Read PLFH internal table for Object type(OBJTY) and object id(OBJID) with current record task list type(PLNTY) , Task list key(PLNNR) , group counter(PLNAL).

b. Read CRVD_A internal table for document number DOKNR with above object type(OBJTY) and Object id(OBJID).

c. Read MAKT internal table for material description(MAKTX) , language key (SPRAS) for current record material.

d. Populate final internal table with above retrieved values.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,290

Hi Rahul,

1. Declare the intenal table to hold the data from table CRVD_A.select the fieldsbased on the selection-screen enter values.

select OBJTY OBJID DOKNR

into table itab

from CRVD_A

where doknr in s_DOKNR.

2.Declare another internal table for PLFH. select the data based on objty and objid

select...filed list

into table itab1

from PLFH for all entries in itab

where objty = itab-objty and

objid = itab-objid.

3.same like the step 2. declare internal table for the material information

and use the table itab1. In select statement put the condition on the selection screen material number and plant

select...field list

into table itab2

from MAPL for all entries in itab1

where PLNTY = itab1-PLNTY and

PLNNR = itab1-PLNNR and

matnr in s_matnr and

werks in s_werks.

4.declare internal table and get the data for all the materialsin step 3.

5.declare the final internal tabel with all the field.

loop at itab2.

read table itab with key objty =itab2-objty and

objid = itab2-objid..............

................

.........

append it_final.

clear it_fianl.

endloop.

do the same to read the material description and document number and populate the final internal table.

6 REPLIES 6
Read only

Former Member
0 Likes
1,291

Hi Rahul,

1. Declare the intenal table to hold the data from table CRVD_A.select the fieldsbased on the selection-screen enter values.

select OBJTY OBJID DOKNR

into table itab

from CRVD_A

where doknr in s_DOKNR.

2.Declare another internal table for PLFH. select the data based on objty and objid

select...filed list

into table itab1

from PLFH for all entries in itab

where objty = itab-objty and

objid = itab-objid.

3.same like the step 2. declare internal table for the material information

and use the table itab1. In select statement put the condition on the selection screen material number and plant

select...field list

into table itab2

from MAPL for all entries in itab1

where PLNTY = itab1-PLNTY and

PLNNR = itab1-PLNNR and

matnr in s_matnr and

werks in s_werks.

4.declare internal table and get the data for all the materialsin step 3.

5.declare the final internal tabel with all the field.

loop at itab2.

read table itab with key objty =itab2-objty and

objid = itab2-objid..............

................

.........

append it_final.

clear it_fianl.

endloop.

do the same to read the material description and document number and populate the final internal table.

Read only

0 Likes
1,290

hi vijaya

thanxs for ur reply

i have already done those things but having problem in looping only that u have nt written

so i m sending my codes tell me where i m wrong :

LOOP AT it_crvd_a INTO wa_crvd_a.

wa_final-doknr = s_doknr.

READ TABLE it_plfh INTO wa_plfh WITH KEY objty = wa_crvd_a-objty

objid = wa_crvd_a-objid.

if sy-subrc = 0.

READ TABLE it_mapl INTO wa_mapl WITH KEY plnty = wa_plfh-plnty

plnnr = wa_plfh-plnnr

plnal = wa_plfh-plnal.

if sy-subrc = 0.

wa_final-matnr = wa_mapl-matnr.

wa_final-werks = wa_mapl-werks.

READ TABLE it_makt INTO wa_makt WITH KEY matnr = wa_mapl-matnr.

if sy-subrc = 0.

wa_final-maktx = wa_makt-maktx.

wa_final-spras = p_lang.

ENDIF.

endif.

endif.

APPEND wa_final TO it_final.

ENDLOOP.

Read only

0 Likes
1,290

hi vijaya

i didnt get the result

Read only

0 Likes
1,290

Hi Rahul,

sorry i didn't saw ur thread y'day.

here is the loop logic.

LOOP AT it_mapl INTO wa_mapl.

READ TABLE it_plfh INTO wa_plfh WITH KEY plnty = wa_mapl-plnty

plnnr = wa_mapl-plnnr

plnal = wa-mapl-plnal.

if sy-subrc = 0.

wa_final-objty = wa_plfh-objty.

wa_final-objid = wa_plfh-objid.

*--read crvd_A

read table it_crvd_a into wa_crvd_a with key objty = wa_plfh-objty

objid = wa_plfh-objid.

if sy-subrc = 0.

wa_final-doknr = wa_crvd_a-doknr.

endif.

READ TABLE it_makt INTO wa_makt WITH KEY matnr = wa_mapl-matnr.

if sy-subrc = 0.

wa_final-maktx = wa_makt-maktx.

wa_final-spras = wa_makt-spras.

ENDIF.

endif.

APPEND wa_final TO it_final.

Read only

0 Likes
1,290

HI Vijaya

Thanxs once again

now, after doing this i am trying to findout that it_final has data or not by using debugger

as follows:

.........

APPEND wa_final TO it_final.

if sy-subrc = 0. <----


breakpoint

endif.

but it shows no data.

so please help me out am i going rit.

and i also tried write statement

but it showed only one field and that too with value '000000'.

Read only

0 Likes
1,290

Hi Rahul,

Set the breakpoints after each select statement. Select the selection criteria so that only few records were populated in to the tables. Check the records as per the statements in the program.Once you are into the loop (in debugging mode) proceed by single steps (F5). you can find the problem.

Regards

Vijaya