Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

HELP REQUIRED EXPERIENCED ABAP DEVELOPER.

$
0
0

Hello experts.

 

i am learning ABAP. i found in very interesting yet a bit confusing  programming language.

i am in need of some help from an expert for my problems.

 

I have a flow diagram for which i have tried coding. but in some situations i am unable to find a fit solution for the problem.

the code is below and diagram is attached in a file.

I HAVE DIVIDED THE DIAGRAM IN STEPS AND CODED ACCORDINGLY.

 

CODE :

 

TABLES: ZPATCORE, ZNPAT, ZNBEW.

 

DATA:  wa_ZPATSE TYPE ZPATSE,

            wa_ZPATCORE TYPE ZPATCORE,

             wa_ZNBEW TYPE ZNBEW,

             wa_ZNPAT TYPE ZNPAT

       date_today TYPE  d,

       alldays TYPE i.

 

DATA:       ITAB1 LIKE ZPATCORE,          /////// comment ////////// creating internal tables for Database tables.

            ITAB2 LIKE ZNPAT,

            ITAB3 LIKE ZNBEW.


SELECT * FROM ZAPTCORE INTO ITAB1.

SELECT * FROM ZNPAT INTO ITAB2.

SELECT * FROM ZNBEW INTO ITAB3.


1) Read all combination of PatID and FallID and BettNr from ZNBEW where:

Fach=’its’ and behend=”31.12.9999”

 

select PatID,FallID,BettNr

from ZNBEW

into wa_ZNBEW

where fach EQ ‘its’

and behend EQ “31.12.9999”

and  NOT BettNr  eq ‘99’.                           //////////// comment ////////////// the value with znbew-BettNr NOT EQ ‘99’ is not passed further.

 

2)      If combination of PatID and FallID exists in ZPATCORE and ZNBEW-BettNr not= “99”

 

IF sy-subrc EQ 0 wa_ZPATCORE IS INITIAL.

Select PatID ,FallID

From ZPATCORE

Into wa_ZPATCORE

Where  PatID EQ wa_ZNBEW-PatID

And FallID EQ wa_ZNBEW-FallID.


3)      Read name and vorname  and gebudat from ZNPAT where id=PatID

4)      Read ifdnr and itstag from ZPATCORE.


IF sy-subrc EQ 0.

SELECT * FROM ZNPAT INTO TABLE ITAB2

FOR ALL ENTRIES IN ITAB1

WHERE PatID = ITAB1-PatID.


          * Alldays=date _today-itstag

         date_ today = sy_datum .

alldays=  date_today –  wa_ZPATCORE-itstag    //////// as i know that days= date_1- date_2 or i should use  a function module called "C14B_DIFF_BT_2_DATES "

 

     For String output

 

SELECT  PatID, Ifdnr,  BettNr  FROM ZNBEW INTO TABLE ITAB3

FOR ALL ENTRIES IN ITAB2

WHERE PatID = ITAB2-PatID.   ////////////////////////// for the value of BettNr from table znbew according to PatID of table  ZNPAT

 

 

LOOP AT ITAB3.

     Write: / ‘ifd:’ ITAB3-Ifdnr,

                ‘Bett:’ ITAB3-BettNr ,

                ‘Name,Vorname:’ ITAB3-Name ITAB3-Vorname,

                ITAB3-Gebdat,

                ‘Tag:’ITAB3-alldays.

END LOOP.

 

xxx---------------------------------------------------------------------------------------xxx

 

 

DATABASE TABLES USED FOR THE DIAGRAM AND DESCRIPTION.

Tables:

ZNBEW:
-lfdnr (integer)
-PatID (integer)
-FallID (integer)
-BettNr (integer)
-fach (string)
-behend (date)

=>Comment: There are lines with the same PatID and FallID, lfdnr is a number from 1 to n.
at every combination of PatID and FallID, lfdnr is only once there
Example:
PatID       FallID      lfdnr
4                1               1
4                1                2
4                1                 3
4                  3                1
ZPATCORE:
-PatID
-FallID
-BewID
-aufnahmestatus_vollst (char)
-entlassstatus_vollst (char)
-itstag(date)

-ifdnr

=>Comment: There Every line with  PatID and FallID has a different value of BewID


ZNPAT:
-PatID
-Name(string)
-Vorname(string)
-Gebudat(date)

**alldays=date_today-itstag

alldays is the number of days beetween date_today and itstag.
itstag is allways a date earlier than date_today.

 

 

MY QUESTIONS ARE :

1) How to loop for the next combination? (from  flow diagram)

2) Is it ok to use “wa_ZPATCORE-itstag” for the calculation of ‘alldays’ calculation?

(* Alldays=date _today-itstag)

3) I have used ‘FOR ALL ENTRIES’ instead of joins? So is it ok to use them or joins are more beneficial?

4) will the code work as the diagram intended it to work?

 

***** please note flow diagram is in a file 'img.png' attached to this post.

 

thank you.



Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>